Lab 8 Overlapping VPNs 01
Topology:
实验目的:理解overlapping vpns.(R4/r1r2r3 中间使用帧中继,右边也一样)
R1--->Site A-1
R2--->Site B-2
R3--->A-Central
R4--->PE1
R5--->PE2
R6--->Site B-1
R7--->Site A-2
R8--->B-Central
(1)Site A-1,Site A-2,A-Central 可以互相访问。
(2)Site B-1,Site B-2,B-Central 可以互相访问。
(3)A-Central,B-Central 可以互相访问。
解决方案图:
Step 1、配置各台路由器的IP地址,并且使用Ping命令确认各路由器的直连口的互通性。
R1: int lo 0 ip add 1.1.1.1 255.255.255.255
int s2/0 encap frame no frame inver ip add 14.1.1.1 255.255.255.0 frame map ip 14.1.1.4 104 broadcast no sh |
R2: int lo 0 ip add 2.2.2.2 255.255.255.255
int s2/0 encap frame no frame inver ip add 24.1.1.2 255.255.255.0 frame map ip 24.1.1.4 204 broadcast no sh |
R3: int lo 0 ip add 3.3.3.3 255.255.255.255
int s2/0 encap frame no frame inver ip add 34.1.1.3 255.255.255.0 frame map ip 34.1.1.4 304 broadcast no sh |
R4: int lo 0 ip add 4.4.4.4 255.255.255.255
int s2/0 encap frame no frame-relay inver no sh exit int s2/0.401 point-to-point ip add 14.1.1.4 255.255.255.0 frame-relay interface-dlci 401
int s2/0.402 point-to-point ip add 24.1.1.4 255.255.255.0 frame-relay interface-dlci 402
int s2/0.403 point-to-point ip add 34.1.1.4 255.255.255.0 frame-relay interface-dlci 403
int f0/0 ip add 45.1.1.4 255.255.255.0 no sh |
R5: int lo 0 ip add 5.5.5.5 255.255.255.255
int f0/0 ip add 45.1.1.5 255.255.255.0
int s2/0 encapsulation frame-relay no frame-relay inverse-arp no sh
int s2/0.506 point-to-point ip add 56.1.1.5 255.255.255.0 frame-relay interface-dlci 506
int s2/0.507 point-to-point ip address 57.1.1.5 255.255.255.0 frame-relay interface-dlci 507
int s2/0.508 point-to-point ip address 58.1.1.5 255.255.255.0 frame-relay interface-dlci 508 |
R6: int lo 0 ip add 6.6.6.6 255.255.255.0
int s2/0 encapsulation frame-relay no frame-relay inverse-arp ip add 56.1.1.6 255.255.255.0 no sh |
R7: int lo 0 ip add 7.7.7.7 255.255.255.255
int s2/0 encapsulation frame-relay no frame-relay inverse-arp ip add 57.1.1.7 255.255.255.0 no sh |
R8: int lo 0 ip add 8.8.8.8 255.255.255.255
int s2/0 ip add encapsulation frame-relay no frame-relay inverse-arp ip add 58.1.1.8 255.255.255.0 no sh |
Step 2、在R4,R5之间运行igp。
R4: router isis net 49.0001.4444.4444.4444.00
int lo 0 ip router isis
int f0/0 ip router isis |
R5: router isis net 49.0001.5555.5555.5555.00
int lo 0 ip router isis
int f0/0 ip router isis |
Step 3、启用ip cef。
全局模式下:ip cef |
Step 4、R4,R5配置MPLS。
R4(config)#mpls label range 4000 4999 R4(config)#mpls label protocol ldp R4(config)#mpls ldp router-id lo 0 R4(config)# R4(config)#int f0/0 R4(config-if)#mpls ip |
R5(config)#mpls label range 5000 5999 R5(config)#mpls label protocol ldp R5(config)#mpls ldp router-id lo 0 R5(config)#int f0/0 R5(config-if)#mpls ip |
Step 5、R4,R5配置VRF。
R4(config)#ip vrf SiteA R4(config-vrf)#rd 123:750 R4(config-vrf)#route-target both 123:750 R4(config-vrf)#exit R4(config)#ip vrf SiteB R4(config-vrf)#rd 123:760 R4(config-vrf)#route-target both 123:760 R4(config-vrf)#exit R4(config)#ip vrf A-central R4(config-vrf)#rd 123:751 R4(config-vrf)#route-target both 123:1001 R4(config-vrf)#route-target import 123:750 R4(config-vrf)#route-target export 123:750 R4(config)#int s2/0.401 R4(config-if)#ip vrf forwarding SiteA R4(config-if)#ip add 14.1.1.4 255.255.255.0 R4(config-if)# R4(config-if)#int s2/0.402 R4(config-if)#ip vrf forwarding SiteB R4(config-if)#ip add 24.1.1.4 255.255.255.0 R4(config-if)# R4(config-if)#int s2/0.403 R4(config-if)#ip vrf forwarding A-central R4(config-if)#ip add 34.1.1.4 255.255.255.0 |
R5(config)#ip vrf SiteA R5(config-vrf)#rd 123:750 R5(config-vrf)#route-target both 123:750 R5(config-vrf)#exit R5(config)#ip vrf SiteB R5(config-vrf)#rd 123:760 R5(config-vrf)#route-target both 123:760 R5(config-vrf)#exit R5(config)#ip vrf B-central R5(config-vrf)#rd 123:761 R5(config-vrf)#route-target both 123:1001 R5(config-vrf)#route-target import 123:760 R5(config-vrf)#route-target export 123:760 R5(config)#int s2/0.506 R5(config-if)#ip vrf forwarding SiteB R5(config-if)#ip add 56.1.1.5 255.255.255.0 R5(config-if)# R5(config-if)#int s2/0.507 R5(config-if)#ip vrf forwarding SiteA R5(config-if)#ip add 57.1.1.5 255.255.255.0 R5(config-if)#int s2/0.508 R5(config-if)#ip vrf forwarding B-central R5(config-if)#ip add 58.1.1.5 255.255.255.0 |
Step 6、R4,R5配置MP-BGP。
R4(config)#router bgp 45 R4(config-router)#no au R4(config-router)#no sy R4(config-router)#bgp router-id 4.4.4.4 R4(config-router)#no bgp default ipv4-unicast R4(config-router)#nei 5.5.5.5 remote-as 45 R4(config-router)#neighbor 5.5.5.5 update-source lo 0 R4(config-router)#address-family vpnv4 R4(config-router-af)#nei 5.5.5.5 activate R4(config-router-af)#exit |
R5(config)#router bgp 45 R5(config-router)#no au R5(config-router)#no sy R5(config-router)#bgp router-id 5.5.5.5 R5(config-router)#nei 4.4.4.4 remote-as 45 R5(config-router)#nei 4.4.4.4 update-source lo 0 R5(config-router)#no bgp default ipv4-unicast R5(config-router)#address-family vpnv4 R5(config-router-af)#nei 4.4.4.4 activate R5(config-router-af)#exit |
Step 7、R1,R2,R3,R6,R7,R8配置rip。
R1(config)#router rip R1(config-router)#ver 2 R1(config-router)#no au R1(config-router)#net 1.0.0.0 R1(config-router)#net 14.0.0.0 |
R2(config)#router rip R2(config-router)#ver 2 R2(config-router)#no au R2(config-router)#net 2.0.0.0 R2(config-router)#net 24.0.0.0 |
R3(config)#router rip R3(config-router)#ver 2 R3(config-router)#no au R3(config-router)#net 3.0.0.0 R3(config-router)#net 34.0.0.0 |
R6(config)#router rip R6(config-router)#ver 2 R6(config-router)#no au R6(config-router)#net 6.0.0.0 R6(config-router)#net 56.0.0.0 |
R7(config)#router rip R7(config-router)#ver 2 R7(config-router)#no au R7(config-router)#net 7.0.0.0 R7(config-router)#net 57.0.0.0 |
R8(config)#router rip R8(config-router)#ver 2 R8(config-router)#no au R8(config-router)#net 8.0.0.0 R8(config-router)#net 58.0.0.0 |
Step 8、R4,R5也配置rip及重分发。
R4(config)#router bgp 45 R4(config-router)#address-family ipv4 vrf SiteA R4(config-router-af)#redistribute rip R4(config-router-af)#address-family ipv4 vrf SiteB R4(config-router-af)#red rip R4(config-router-af)#address-family ipv4 vrf A-central R4(config-router-af)#red rip R4(config-router-af)#exit R4(config-router)# R4(config-router)#router rip R4(config-router)#address-family ipv4 vrf SiteA R4(config-router-af)#net 14.0.0.0 R4(config-router-af)#no au R4(config-router-af)#ver 2 R4(config-router-af)#redistribute bgp 45 metric 5 R4(config-router-af)#address-family ipv4 vrf SiteB R4(config-router-af)#ver 2 R4(config-router-af)#no au R4(config-router-af)#net 24.0.0.0 R4(config-router-af)#redistribute bgp 45 metric 5 R4(config-router-af)#address-family ipv4 vrf A-central R4(config-router-af)#net 34.0.0.0 R4(config-router-af)#ver 2 R4(config-router-af)#no au R4(config-router-af)#redistribute bgp 45 metric 5 R4(config-router-af)#end |
R5(config)#router bgp 45 R5(config-router)#address-family ipv4 vrf SiteA R5(config-router-af)#redistribute rip R5(config-router-af)#address-family ipv4 vrf SiteB R5(config-router-af)#red rip R5(config-router-af)#address-family ipv4 vrf A-central R5(config-router-af)#red rip R5(config-router-af)#exit R5(config-router)# R5(config-router)#router rip R5(config-router)#address-family ipv4 vrf SiteA R5(config-router-af)#net 57.0.0.0 R5(config-router-af)#no au R5(config-router-af)#ver 2 R5(config-router-af)#redistribute bgp 45 metric 5 R5(config-router-af)#address-family ipv4 vrf SiteB R5(config-router-af)#ver 2 R5(config-router-af)#no au R5(config-router-af)#net 56.0.0.0 R5(config-router-af)#redistribute bgp 45 metric 5 R5(config-router-af)#address-family ipv4 vrf A-central R5(config-router-af)#net 58.0.0.0 R5(config-router-af)#ver 2 R5(config-router-af)#no au R5(config-router-af)#redistribute bgp 45 metric 5 R5(config-router-af)#end |
Step 9、查看的相关命令以及测试结果。
#sh ip bgp vpn4 all su ---------查看mp-bgp 邻居
#sh ip route vrf SiteA----------查看vrf里的路由
#sh mpls forwarding-table-------查看mpls转发表
#sh ip bgp vpn all labels-------MP-BGP标签表
#sh mpls ldp nei ---------------ldp 邻居表
R1#sh ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
34.0.0.0/24 is subnetted, 1 subnets R 34.1.1.0 [120/1] via 14.1.1.4, 00:00:25, Serial2/0 1.0.0.0/32 is subnetted, 1 subnets C 1.1.1.1 is directly connected, Loopback0 3.0.0.0/32 is subnetted, 1 subnets R 3.3.3.3 [120/1] via 14.1.1.4, 00:00:25, Serial2/0 7.0.0.0/32 is subnetted, 1 subnets R 7.7.7.7 [120/1] via 14.1.1.4, 00:00:25, Serial2/0 57.0.0.0/24 is subnetted, 1 subnets R 57.1.1.0 [120/1] via 14.1.1.4, 00:00:25, Serial2/0 14.0.0.0/24 is subnetted, 1 subnets C 14.1.1.0 is directly connected, Serial2/0 |
R3#sh ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
34.0.0.0/24 is subnetted, 1 subnets C 34.1.1.0 is directly connected, Serial2/0 1.0.0.0/32 is subnetted, 1 subnets R 1.1.1.1 [120/1] via 34.1.1.4, 00:00:16, Serial2/0 3.0.0.0/32 is subnetted, 1 subnets C 3.3.3.3 is directly connected, Loopback0 7.0.0.0/32 is subnetted, 1 subnets R 7.7.7.7 [120/1] via 34.1.1.4, 00:00:16, Serial2/0 8.0.0.0/32 is subnetted, 1 subnets R 8.8.8.8 [120/1] via 34.1.1.4, 00:00:16, Serial2/0 58.0.0.0/24 is subnetted, 1 subnets R 58.1.1.0 [120/1] via 34.1.1.4, 00:00:16, Serial2/0 57.0.0.0/24 is subnetted, 1 subnets R 57.1.1.0 [120/1] via 34.1.1.4, 00:00:17, Serial2/0 14.0.0.0/24 is subnetted, 1 subnets R 14.1.1.0 [120/1] via 34.1.1.4, 00:00:17, Serial2/0 |
R2#sh ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
2.0.0.0/32 is subnetted, 1 subnets C 2.2.2.2 is directly connected, Loopback0 6.0.0.0/32 is subnetted, 1 subnets R 6.6.6.6 [120/1] via 24.1.1.4, 00:00:18, Serial2/0 8.0.0.0/32 is subnetted, 1 subnets R 8.8.8.8 [120/1] via 24.1.1.4, 00:00:18, Serial2/0 24.0.0.0/24 is subnetted, 1 subnets C 24.1.1.0 is directly connected, Serial2/0 58.0.0.0/24 is subnetted, 1 subnets R 58.1.1.0 [120/1] via 24.1.1.4, 00:00:18, Serial2/0 56.0.0.0/24 is subnetted, 1 subnets R 56.1.1.0 [120/1] via 24.1.1.4, 00:00:18, Serial2/0 |
R6#sh ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
2.0.0.0/32 is subnetted, 1 subnets R 2.2.2.2 [120/1] via 56.1.1.5, 00:00:17, Serial2/0 6.0.0.0/32 is subnetted, 1 subnets C 6.6.6.6 is directly connected, Loopback0 8.0.0.0/32 is subnetted, 1 subnets R 8.8.8.8 [120/1] via 56.1.1.5, 00:00:17, Serial2/0 24.0.0.0/24 is subnetted, 1 subnets R 24.1.1.0 [120/1] via 56.1.1.5, 00:00:17, Serial2/0 58.0.0.0/24 is subnetted, 1 subnets R 58.1.1.0 [120/1] via 56.1.1.5, 00:00:17, Serial2/0 56.0.0.0/24 is subnetted, 1 subnets C 56.1.1.0 is directly connected, Serial2/0 |
R7#sh ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
34.0.0.0/24 is subnetted, 1 subnets R 34.1.1.0 [120/1] via 57.1.1.5, 00:00:01, Serial2/0 1.0.0.0/32 is subnetted, 1 subnets R 1.1.1.1 [120/1] via 57.1.1.5, 00:00:01, Serial2/0 3.0.0.0/32 is subnetted, 1 subnets R 3.3.3.3 [120/1] via 57.1.1.5, 00:00:01, Serial2/0 7.0.0.0/32 is subnetted, 1 subnets C 7.7.7.7 is directly connected, Loopback0 57.0.0.0/24 is subnetted, 1 subnets C 57.1.1.0 is directly connected, Serial2/0 14.0.0.0/24 is subnetted, 1 subnets R 14.1.1.0 [120/1] via 57.1.1.5, 00:00:01, Serial2/0 |
R8#sh ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
34.0.0.0/24 is subnetted, 1 subnets R 34.1.1.0 [120/1] via 58.1.1.5, 00:00:03, Serial2/0 2.0.0.0/32 is subnetted, 1 subnets R 2.2.2.2 [120/1] via 58.1.1.5, 00:00:03, Serial2/0 3.0.0.0/32 is subnetted, 1 subnets R 3.3.3.3 [120/1] via 58.1.1.5, 00:00:03, Serial2/0 6.0.0.0/32 is subnetted, 1 subnets R 6.6.6.6 [120/1] via 58.1.1.5, 00:00:03, Serial2/0 8.0.0.0/32 is subnetted, 1 subnets C 8.8.8.8 is directly connected, Loopback0 24.0.0.0/24 is subnetted, 1 subnets R 24.1.1.0 [120/1] via 58.1.1.5, 00:00:03, Serial2/0 58.0.0.0/24 is subnetted, 1 subnets C 58.1.1.0 is directly connected, Serial2/0 56.0.0.0/24 is subnetted, 1 subnets R 56.1.1.0 [120/1] via 58.1.1.5, 00:00:04, Serial2/0 |