配置
r1
建立EBGP对等体
[r1]bgp 100
[r1-bgp]router-id 1.1.1.1
[r1-bgp]peer 12.0.0.2 as-number 200[r1]ip route-static 2.2.2.2 32 12.0.0.2
[r1]bgp 100
[r1-bgp]router-id 1.1.1.1
[r1-bgp]peer 2.2.2.2 as-number 200
[r1-bgp]peer 2.2.2.2 connect-interface LoopBack 0
[r1-bgp]peer 2.2.2.2 ebgp-max-hop 2发布路由1.1.1.1
[r1]bgp 100
[r1-bgp]network 1.1.1.1 32
r2
建立EBGP对等体
[r2]bgp 200
[r2-bgp]router-id 2.2.2.2
[r2-bgp]peer 12.0.0.1 as-number 100[r2]ip route-static 2.2.2.2 32 12.0.0.1
[r2]bgp 200
[r2-bgp]router-id 2.2.2.2
[r2-bgp]peer 1.1.1.1 as-number 100
[r2-bgp]peer 1.1.1.1 connect-interface LoopBack 0
[r2-bgp]peer 1.1.1.1 ebgp-max-hop 2ospf
[r2]ospf 1 router-id 10.0.2.2
[r2-ospf-1]a 0
[r2-ospf-1]network 2.2.2.2 0.0.0.0
[r2-ospf-1]network 23.0.0.2 0.0.0.0建立IBGP对等体
[r2]bgp 200
[r2-bgp]router-id 2.2.2.2
[r2-bgp]peer 3.3.3.3 as-number 200
[r2-bgp]peer 3.3.3.3 connect-interface LoopBack 0改下一跳解决无法递归
[r2-bgp]peer 3.3.3.3 next-hop-local
建立全连的IBGP对等体
[r2-bgp]peer 4.4.4.4 as-number 200
[r2-bgp]peer 4.4.4.4 connect-interface LoopBack 0更改下一跳
[r2]bgp 200
[r2-bgp]peer 4.4.4.4 next-hop-local
r3
ospf
[r3]ospf 1 router-id 10.0.3.3
[r3-ospf-1]a 0
[r3-ospf-1]network 3.3.3.3 0.0.0.0
[r3-ospf-1]network 23.0.0.3 0.0.0.0
[r3-ospf-1]network 34.0.0.3 0.0.0.0建立IBGP对等体
[r3]bgp 200
[r3-bgp]router-id 3.3.3.3
[r3-bgp]peer 2.2.2.2 as-number 200
[r3-bgp]peer 2.2.2.2 connect-interface LoopBack 0
r4
ospf
[r4]ospf 1 router-id 10.0.4.4
[r4-ospf-1]a 0
[r4-ospf-1]network 4.4.4.4 0.0.0.0
[r4-ospf-1]network 34.0.0.4 0.0.0.0IBGP对等体
[r4]bgp 200
[r4-bgp]router-id 4.4.4.4
[r4-bgp]peer 3.3.3.3 as-number 200
[r4-bgp]peer 3.3.3.3 connect-interface LoopBack 0建立全连的IBGP对等体
[r4]bgp 200
[r4-bgp]peer 2.2.2.2 as-number 200
[r4-bgp]peer 2.2.2.2 connect-interface LoopBack 0更改下一跳
[r4]bgp 200
[r4-bgp]peer 2.2.2.2 next-hop-local
[r4-bgp]peer 3.3.3.3 next-hop-local
r5
发布路由5.5.5.5
[r5-bgp]network 5.5.5.5 32发布路由10.1.1.1 删除5.5.5.5
[r5-bgp]undo network 5.5.5.5
[r5-bgp]network 10.1.1.1 24