PE2: PE2(config)#router ospf 1 vrf vpn2 PE2(config)#redistribute bgp 100 subnets //将 BGP 重分发入 OSPF 中 PE2(config)#network 172.16.1.1 0.0.0.0 area 0 将 B2 的 OSPF 重分发入 MP-BGP 中: PE2(config)#router bgp 100 PE2(config-router)#address-family ipv4 vrf vpn2 PE2(config-router-af)#redistribute ospf 1 vrf vpn2 配置 CE 与 PE 端的 BGP 路由协议: R5: R5(config)#int l0 R5(config-if)#ip add 8.8.8.8 255.255.255.0 R5(config)#router bgp 200 R5(config-router)#neighbor 66.66.66.66 remote-as 100 R5(config-router)#neighbor 66.66.66.66 ebgp-multihop 10 R5(config-router)#neighbor 66.66.66.66 update-source Loopback R5(config)#ip route 66.66.66.0 255.255.255.0 Serial1/0 PE2(直接通过 MP-BGP 学习对方路由): PE2(config)#int l0 PE2(config-if)#ip vrf forwarding vpn3 PE2(config-if)#ip add 66.66.66.66 255.255.255.0 PE2(config)#router bgp 200 PE2(config-router)#address-family ipv4 vrf vpn3 PE2(config-router-af)#neighbor 8.8.8.8 remote-as 200 PE2(config-router-af)#neighbor 8.8.8.8 ebgp-multihop 10 PE2(config-router-af)#neighbor 8.8.8.8 update-source Loopback1 PE2(config-router-af)#neighbor 8.8.8.8 activate PE2(config-router-af)#network 192.168.1.0 mask 255.255.255.0 PE2(config)#ip route vrf vpn3 8.8.8.0 255.255.255.0 Serial1/2 查看 A 公司的路由表: R1#show ip rou Gateway of last resort is not set 172.16.0.0/24 is subnetted, 2 subnets R 172.16.1.0 [120/1] via 10.1.1.1, 00:00:02, Serial1/0 10.0.0.0/24 is subnetted, 2 subnets C 10.2.2.0 is directly connected, Loopback0 C 10.1.1.0 is directly connected, Serial1/0 R 192.168.1.0/24 [120/1] via 10.1.1.1, 00:00:02, Serial1/0 R4#show ip rou Gateway of last resort is not set 172.16.0.0/24 is subnetted, 2 subnets C 172.16.1.0 is directly connected, Serial1/0 C 172.16.2.0 is directly connected, Loopback0 10.0.0.0/24 is subnetted, 2 subnets R 10.1.1.0 [120/1] via 172.16.1.1, 00:00:21, Serial1/0 R5#show ip rou Gateway of last resort is not set 66.0.0.0/24 is subnetted, 1 subnets S 66.66.66.0 is directly connected, Serial1/0 8.0.0.0/24 is subnetted, 1 subnets C 8.8.8.0 is directly connected, Loopback0 10.0.0.0/24 is subnetted, 2 subnets B 10.1.1.0 [20/0] via 66.66.66.66, 00:18:48 C 192.168.1.0/24 is directly connected, Serial1/0 总部 A1 通过 MPLS-VPN 学到了两个A 公司分部的路由,分部 A2 和A3 只学到了总部 A1 的路由。因此 A2 和A3 可以和A1 通信,但它们相互之间不能通信。 6、配置 B 公司总分部之间的帧中继 FR-SW: FR-SW(config)#frame-relay switching FR-SW(config)#interface Serial1/0 FR-SW(config-if)#encapsulation frame-relay FR-SW(config-if)#frame-relay intf-type dce FR-SW(config-if)#frame-relay route 201 interface Serial1/1 102 FR-SW(config)#interface Serial1/1 FR-SW(config-if)#encapsulation frame-relay FR-SW(config-if)#frame-relay intf-type dce FR-SW(config-if)#frame-relay route 102 interface Serial1/0 201 R7: R7(config)#interface Serial1/1 R7(config-if)#ip address 10.2.1.1 255.255.255.0 R7(config-if)#encapsulation frame-relay R7(config-if)#ip ospf network point-to-point //在帧中继环境下设置为 OSPF 点到点模式 R7(config-if)#ip ospf 1 area 0 R7(config-if)#frame-relay map ip 10.2.1.2 102 broadcast R7(config-if)#no frame-relay inverse-arp R6: R6(config)#interface Serial1/1 R6(config-if)#ip address 10.2.1.2 255.255.255.0 R6(config-if)#encapsulation frame-relay R6(config-if)#ip ospf network point-to-point //在帧中继环境下设置为 OSPF 点到点模式 R6(config-if)#ip ospf 1 area 0 R6(config-if)#frame-relay map ip 10.2.1.1 201 broadcast R6(config-if)#no frame-relay inverse-arp 查看帧中继建立情况: R10#show frame-relay rou Input Intf Input Dlci Output Intf Output Dlci Status Serial1/0 201 Serial1/1 102 active Serial1/1 102 Serial1/0 201 active 查看 B 公司路由表: R7#show ip rou Gateway of last resort is not set 3.0.0.0/24 is subnetted, 1 subnets C 3.3.3.0 is directly connected, Loopback0 172.16.0.0/24 is subnetted, 1 subnets O 172.16.1.0 [110/164] via 10.2.1.2, 00:22:15, Serial1/1 9.0.0.0/32 is subnetted, 1 subnets O 9.9.9.9 [110/101] via 10.2.1.2, 00:22:15, Serial1/1 10.0.0.0/24 is subnetted, 2 subnets C 10.2.1.0 is directly connected, Serial1/1 C 10.1.1.0 is directly connected, Serial1/0 7、确保 B 公司更倾向于走 MPLS –VPN 由于 B 公司的 MPLS VPN 和帧中继都是起的 OSPF,所以可以通过修改链路的 OSPF 开销值来 决定数据走哪一条链路,哪条开销值小走哪一条。 R7(config)#interface Serial1/1 R7(config-if)#ip ospf cost 100 R6(config)#interface Serial1/1 R6(config-if)#ip ospf cost 100 通过 traceroute 查看数据走哪一条链路: R3#traceroute 9.9.9.9 source 3.3.3.3 Type escape sequence to abort. Tracing the route to 9.9.9.9 1 10.1.1.1 556 msec 160 msec 576 msec 2 100.1.1.2 1532 msec 1028 msec 2004 msec 3 100.2.2.2 1264 msec 1296 msec 2072 msec 4 172.16.1.1 1348 msec 1404 msec 1140 msec 5 172.16.1.2 1860 msec 1516 msec 1640 msec 可以发现 B 公司的流量是优先通过 MPLS VPN 传输的. |