首先配置as1 as3的环回,as2基于172.16.0.0/16进行ip规划,如图所示配置ip(as2内路由的环回为x.x.x.x,如r2环回为2.2.2.2/24)
第二步,在as2内启动ospf并宣告172.16.0.0/16网段和环回
r2
[r2]ospf 1 router-id 2.2.2.2
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]netework 172.16.1.0 0.0.0.255
r3
[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]netework 172.16.1.0 0.0.0.255
[r3-ospf-1-area-0.0.0.0]netework 172.16.1.4 0.0.0.255
r4
[r4]ospf 1 router-id 4.4.4.4
[r4-ospf-1]area 0
[r4-ospf-1-area-0.0.0.0]netework 172.16.1.4 0.0.0.255
[r4-ospf-1-area-0.0.0.0]netework 172.16.1.8 0.0.0.255
r5
[r5]ospf 1 router-id 5.5.5.5
[r5-ospf-1]area 0
[r5-ospf-1-area-0.0.0.0]netework 172.16.1.16 0.0.0.255
[r5-ospf-1-area-0.0.0.0]netework 172.16.1.20 0.0.0.255
r6
[r6]ospf 1 router-id 6.6.6.6
[r6-ospf-1]area 0
[r6-ospf-1-area-0.0.0.0]netework 172.16.1.12 0.0.0.255
[r6-ospf-1-area-0.0.0.0]netework 172.16.1.16 0.0.0.255
r7
[r7]ospf 1 router-id 7.7.7.7
[r7-ospf-1]area 0
[r7-ospf-1-area-0.0.0.0]netework 172.16.1.8 0.0.0.255
[r7-ospf-1-area-0.0.0.0]netework 172.16.1.12 0.0.0.255
第三步,配置bgp
r1 ,r8使用直练建邻
[r1]bgp 1
[r1-bgp]peer 12.0.0.2 as-number 2
[r8]bgp 3
[r8-bgp]peer 78.0.0.1 as-number 2
r2用环回建邻,as2内路由器以此类推配置
[r2]bgp 64512
[r2-bgp]confederation id 2
[r2-bgp]confederation peer-as 64513
[r2-bgp]peer 12.1.1.1 as-number 1
[r2-bgp]peer 3.3.3.3 as-number 64512
[r2-bgp]peer 3.3.3.3 connect-interface l0
[r2-bgp]peer 3.3.3.3 next-hop-local
[r2-bgp]peer 5.5.5.5 as-number 64513
[r2-bgp]peer 5.5.5.5 connect-interface l0
[r2-bgp]peer 5.5.5.5 ebgp-max-hop
[r2-bgp]peer 5.5.5.5 next-hop-local
邻居间可以相互建立邻居关系,但是由于联邦内水平分割,路由无法传递,所以要配置路由反射器
选用r3和r6作为路由反射器,r4,r7为其客户
[r3]bgp 64512
[r3-bgp]peer 4.4.4.4 reflect-client
[r6]bgp 64513
[r6-bgp]peer 7.7.7.7 reflect-client
第四步,减少路由条目数量,避免环路出现
[r2-bgp]aggregate 172.16.0.0 16 detail-suppressed
[r2-bgp]ip route-static 172.16.0.0 16 NULL 0
[r3-bgp]aggregate 172.16.0.0 16 detail-suppressed
[r3-bgp]ip route-static 172.16.0.0 16 NULL 0
[r4-bgp]aggregate 172.16.0.0 16 detail-suppressed
[r4-bgp]ip route-static 172.16.0.0 16 NULL 0
[r5-bgp]aggregate 172.16.0.0 16 detail-suppressed
[r5-bgp]ip route-static 172.16.0.0 16 NULL 0
[r6-bgp]aggregate 172.16.0.0 16 detail-suppressed
[r6-bgp]ip route-static 172.16.0.0 16 NULL 0
[r7-bgp]aggregate 172.16.0.0 16 detail-suppressed
[r7-bgp]ip route-static 172.16.0.0 16 NULL 0
第五步as1和as3环回互通
R1
上创建隧道
[r1]interface Tunnel0/0/0
[r1-tunnel0/0/0]description 78.0.0.2
[r1-tunnel0/0/0]ip address 10.0.0.1 255.255.255.0
[r1-tunnel0/0/0]tunnel-protocol gre
[r1-tunnel0/0/0]source 12.0.0.1
R8
配置:
[r8]interface Tunnel0/0/0
[r8-tunnel0/0/0]ip address 10.0.0.2 255.255.255.0
[r8-tunnel0/0/0]tunnel-protocol gre
[r8-tunnel0/0/0]source 78.0.0.2
[r8-tunnel0/0/0]destination 12.0.0.1
为了使全网可达,又不能宣告
AS1-3
的环回,写一条静态让目标下一跳指向
Tunnel
隧道
[r1]ip-route-static 192.168.1.1 24 12.0.0.1
[r8]ip-route-static 192.168.2.1 24 78.0.0.2