实验拓补:
![](https://i-blog.csdnimg.cn/direct/e52437a24b084db0acbfd73496553ed0.png)
需求分析:
这个拓扑图中想实现的功能就是AS2两边各有一个AS,AS2内部的的用户网段可以访问两边的域外路由;AS2中采用了联邦打破了BGP的水平分割,可以让每台路由器搬运路由,最终实现用户互访,在一个簇中,至少存在一个客户端,一个RR(路由反射器)
AS网段划分:
根据实际情况我们应该把172.16.0.0/16网段化成一组专门给用户使用的 ,另外一组用于 BGP的 环回建邻!
环回建邻
R3172.16.3.0/24
R4:172.16.4.0/24
R5:172.16..5.0/24
R6:172.16.6.0/24
R7:172.16.7.0/24
AS2内部的路由器的网段
172.16.1.0/30
172.16.1.4/30
172.16.1.8/30
172.16.1.12/30
172.16.1.16/30
172.16.1.20/30
划分如下:
操作步骤:
1.ip配置
r1
r2
r3
r4
r5
r6
r7
r8
2.AS2配置OSPF
r2
r3
r4
r5
r6
r7
3.配置BGP建立对等体,发布路由
r1
[r1]bgp 1
[r1-bgp]router-id 1.1.1.1
[r1-bgp]peer 12.0.0.2 as 2
[r1-bgp]network 10.0.0.0 24
r2
[r2]bgp 64512
[r2-bgp]router-id 2.2.2.2
[r2-bgp]confederation id 2
[r2-bgp]confederation peer-as 64513
[r2-bgp]peer 12.0.0.1 as 1
[r2-bgp]peer 172.16.3.1 as 64512
[r2-bgp]peer 172.16.5.1 as 64513
[r2-bgp]peer 172.16.3.1 connect-interface LoopBack 0
[r2-bgp]peer 172.16.5.1 connect-interface LoopBack 0
[r2-bgp]peer 172.16.5.1 ebgp-max-hop 2
[r2-bgp]peer 172.16.3.1 next-hop-local
[r2-bgp]peer 172.16.5.1 next-hop-local
r3
[r3]bgp 64512
[r3-bgp]router-id 3.3.3.3
[r3-bgp]confederation id 2
[r3-bgp]peer 172.16.2.1 as 64512
[r3-bgp]peer 172.16.2.1 connect-interface LoopBack 0
[r3-bgp]peer 172.16.4.1 as 64512
[r3-bgp]peer 172.16.4.1 connect-interface LoopBack 0
r4
[r4]bgp 64512
[r4-bgp]router-id 4.4.4.4
[r4-bgp]confederation id 2
[r4-bgp]confederation peer-as 64513
[r4-bgp]peer 172.16.3.1 as 64512
[r4-bgp]peer 172.16.3.1 connect-interface LoopBack 0
[r4-bgp]peer 172.16.7.1 as 64513
[r4-bgp]peer 172.16.7.1 connect-interface LoopBack 0
[r4-bgp]peer 172.16.7.1 ebgp-max-hop 2
r5
[r5]bgp 64513
[r5-bgp]router-id 5.5.5.5
[r5-bgp]confederation id 2
[r5-bgp]confederation peer-as 64512
[r5-bgp]peer 172.16.2.1 as 64512
[r5-bgp]peer 172.16.2.1 connect-interface LoopBack 0
[r5-bgp]peer 172.16.6.1 as 64513
[r5-bgp]peer 172.16.6.1 connect-interface LoopBack 0
[r5-bgp]peer 172.16.2.1 ebgp-max-hop 2
r6
[r6]bgp 64513
[r6-bgp]router-id 6.6.6.6
[r6-bgp]confederation id 2
[r6-bgp]peer 172.16.5.1 as 64513
[r6-bgp]peer 172.16.5.1 connect-interface LoopBack 0
[r6-bgp]peer 172.16.7.1 as 64513
[r6-bgp]peer 172.16.7.1 connect-interface LoopBack 0
r7
[r7]bgp 64513
[r7-bgp]router-id 7.7.7.7
[r7-bgp]confederation id 2
[r7-bgp]confederation peer-as 64512
[r7-bgp]peer 172.16.6.1 as 64513
[r7-bgp]peer 172.16.6.1 connect-interface LoopBack 0
[r7-bgp]peer 172.16.4.1 as 64512
[r7-bgp]peer 172.16.4.1 connect-interface LoopBack 0
[r7-bgp]peer 172.16.4.1 ebgp-max-hop 2
[r7-bgp]peer 78.0.0.2 as 3
[r7-bgp]peer 172.16.4.1 next-hop-local
[r7-bgp]peer 172.16.6.1 next-hop-local
r8
[r8]bgp 3
[r8-bgp]router-id 8.8.8.8
[r8-bgp]peer 78.0.0.1 as 2
[r8-bgp]network 11.0.0.0 24
4.配置路由反射器
r3
r6
5.做空接口,汇总和宣告
r2
r7
6.建立GRE隧道
r1
[r1]int t 0/0/0
[r1-Tunnel0/0/0]ip add 192.168.9.1 24
[r1-Tunnel0/0/0]tunnel-protocol gre
[r1-Tunnel0/0/0]source 10.0.0.1
[r1-Tunnel0/0/0]destination 11.0.0.1
[r1-Tunnel0/0/0]q
[r1]ip route-static 192.168.2.0 24 192.168.9.2
r8
[r8]int t 0/0/0
[r8-Tunnel0/0/0]ip add 192.168.9.2 24
[r8-Tunnel0/0/0]tunnel-protocol gre
[r8-Tunnel0/0/0]source 11.0.0.1
[r8-Tunnel0/0/0]destination 10.0.0.1
[r8-Tunnel0/0/0]q
[r8]ip route-static 192.168.1.0 24 192.168.9.1
7.查看GRE路由表
r1
r2
r3
r4
r5
r6
r7
r8
8.测试
用r1pingr8的环回接口