一、拓扑图
二、实验配置
(1)配置ospf
[r2]ospf 1 router-id 2.2.2.2
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]net 2.2.2.2 0.0.0.0
[r2-ospf-1-area-0.0.0.0]net 23.0.0.2 0.0.0.0
[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]net 3.3.3.3 0.0.0.0
[r3-ospf-1-area-0.0.0.0]net 23.0.0.3 0.0.0.0
[r3-ospf-1-area-0.0.0.0]net 34.0.0.3 0.0.0.0
[r4]ospf 1 router-id 4.4.4.4
[r4-ospf-1]area 0
[r4-ospf-1-area-0.0.0.0]net 4.4.4.4 0.0.0.0
[r4-ospf-1-area-0.0.0.0]net 34.0.0.4 0.0.0.0
(2)配置bgp
r1-r2
[r1]bgp 100
[r1-bgp]router-id 1.1.1.1
[r1-bgp]peer 12.0.0.2 as-number 200
[r2]bgp 200
[r2-bgp]router-id 2.2.2.2
[r2-bgp]peer 12.0.0.1 as-number 100
r2-r3
[r2-bgp]bgp 200
[r2-bgp]peer 3.3.3.3 as-number 200
[r2-bgp]peer 3.3.3.3 connect-interface LoopBack 0
[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
r3-r4
[r3]bgp 200
[r3-bgp]peer 4.4.4.4 as-number 200
[r3-bgp]peer 4.4.4.4 connect-interface LoopBack 0
[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
r4-r5
[r4]bgp 200
[r4-bgp]peer 45.0.0.5 as-number 300
[r5]bgp 300
[r5-bgp]router-id 5.5.5.5
[r5-bgp]peer 45.0.0.4 as-number 200
测试
(3)发布路由
[r1]bgp 100
[r1-bgp]network 1.1.1.1 24
[r2]dis bgp routing-table---查看BGP路由表
[r2]bgp 200
[r2-bgp]peer 3.3.3.3 next-hop-local----在给3.3.3.3传递路由信息时,将下一跳属性修改为本地
[r2-bgp]peer 4.4.4.4 as-number 200
[r2-bgp]peer 4.4.4.4 connect-interface LoopBack 0
[r2-bgp]peer 4.4.4.4 next-hop-local
[r4]bgp 200
[r4-bgp]peer 2.2.2.2 as-number 200
[r4-bgp]peer 2.2.2.2 connect-interface LoopBack 0
测试