其他配置同实验一配置到R2、R4的bgp200,不同的地方从R1和R5配置开始,若要看配置可以去实验一看。在这个实验二中R1和R5配置OSPF。
[R1]ospf 1 route-id 1.1.1.1
[R1-ospf-1]ar 0
[R1-ospf-1-area-0.0.0.0]network 12.1.1.1 0.0.0.0
[R1-ospf-1-area-0.0.0.0]network 1.1.1.1 0.0.0.0
[R2]ospf 1 router-id 2.2.2.2 vpn-instance 1
[R2-ospf-1]ar 0
[R2-ospf-1-area-0.0.0.0]network 12.1.1.2 0.0.0.0
[R4]ospf 1 router-id 4.4.4.4 vpn-instance 5
[R4-ospf-1]ar 0
[R4-ospf-1-area-0.0.0.0]network 45.1.1.4 0.0.0.0
[R5]ospf 1 rou
[R5]ospf 1 router-id 5.5.5.5
[R5-ospf-1-area-0.0.0.0]network 45.1.1.5 0.0.0.0
[R5-ospf-1-area-0.0.0.0]network 5.5.5.5 0.0.0.0
接下来,可以配置前缀列表抓取1.1.1.1和5.5.5.5,然后引入bgp。
[R2]ip ip-prefix 1 index 10 permit 1.1.1.1 32
[R2-...]route-policy tobgp permit node 10
[R2-...]if-match ip-prefix 1
[R2]bgp 200
[R2-...]ipv4-family vpn-instance 1
[R2-...]import-route ospf 1 route-policy tobgp
[R2]ospf 1
[R2]import-route bgp
[R4]ip ip-prefix 1 index 10 permit 5.5.5.5 32
[R4-...]route-policy tobgp permit node 10
[R4-...]if-match ip-prefix 1
[R4]bgp 200
[R4-...]ipv4-family vpn-instance 1
[R4-...]import-route ospf 1 route-policy tobgp
[R4]ospf 1
[R4]import-route bgp
测试:
[R1]ping -a 1.1.1.1 5.5.5.5
PING 5.5.5.5: 56 data bytes, press CTRL_C to break
Reply from 5.5.5.5: bytes=56 Sequence=1 ttl=253 time=120 ms
Reply from 5.5.5.5: bytes=56 Sequence=2 ttl=253 time=90 ms
Reply from 5.5.5.5: bytes=56 Sequence=3 ttl=253 time=100 ms
Reply from 5.5.5.5: bytes=56 Sequence=4 ttl=253 time=110 ms
Reply from 5.5.5.5: bytes=56 Sequence=5 ttl=253 time=90 ms
--- 5.5.5.5 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 90/102/120 ms
类似双点双向引入。最后,这个实验二应该算是一个扩展吧,具体原理我也只是一知半解,实验仅作记录,防止以后遗忘。如有错误欢迎指正~