1、理解sham-link作用和限制。
2、熟练使用Tunnel跨设备完成OSPF邻接关系的建立 。
3、熟练利用OSPF 选路机制完成BACKDOOR链路的。

接口ip配置
- R1(config)#interface e0/0
- R1(config-if)#ip address 12.12.12.1 255.255.255.0
- R1(config-if)#no shutdown
- R1(config-if)#interface e0/1
- R1(config-if)#ip address 13.13.13.1 255.255.255.0
- R1(config-if)#no shutdown
- R1(config)#interface loopback 0
- R1(config-if)#ip address 10.1.1.1 255.255.255.0
-
- R2(config)#interface e0/0
- R2(config-if)#ip address 12.12.12.2 255.255.255.0
- R2(config-if)#no shutdown
- R2(config-if)#interface e0/1
- R2(config-if)#ip address 25.25.25.2 255.255.255.0
- R2(config-if)#no shutdown
- R2(config)#interface loopback 0
- R2(config-if)#ip address 10.2.2.2 255.255.255.0
-
- R3(config)#interface e0/1
- R3(config-if)#ip address 13.13.13.3 255.255.255.0
- R3(config-if)#no shutdown
- R3(config-if)#interface e0/0
- R3(config-if)#ip address 34.34.34.3 255.255.255.0
- R3(config-if)#no shutdown
- R3(config)#interface loopback 0
- R3(config-if)#ip address 10.3.3.3 255.255.255.0
-
- R4(config)#interface e0/0
- R4(config-if)#ip address 34.34.34.4 255.255.255.0
- R4(config-if)#no shutdown
- R4(config-if)#interface e0/1
- R4(config-if)#ip address 45.45.45.4 255.255.255.0
- R4(config-if)#no shutdown
- R4(config)#interface loopback 0
- R4(config-if)#ip address 10.4.4.4 255.255.255.0
-
- R5(config)#interface e0/1
- R5(config-if)#ip address 45.45.45.5 255.255.255.0
- R5(config-if)#no shutdown
- R5(config-if)#interface e0/0
- R5(config-if)#ip address 25.25.25.5 255.255.255.0
- R5(config-if)#no shutdown
- R5(config)#interface loopback 0
- R5(config-if)#ip add 10.5.5.5 255.255.255.0
p-network配置(isis\mpls)
- R1(config)#router isis
- R1(config-router)#net 49.0001.0000.0000.0001.00
- R1(config)#interface e0/0
- R1(config-if)#ip router isis
- R1(config)#interface loopback 0
- R1(config-if)#ip router isis
- R1(config)#mpls label protocol ldp
- R1(config)#mpls label range 100 199
- R1(config)#mpls ldp router-id loopback 0
- R1(config)#interface e0/0
- R1(config-if)#mpls ip
-
- R2(config)#router isis
- R2(config-router)#net 49.0001.0000.0000.0002.00
- R2(config)#interface e0/0
- R2(config-if)#ip router isis
- R2(config)#interface loopback 0
- R2(config-if)#ip router isis
- R2(config)#mpls label protocol ldp
- R2(config)#mpls label range 200 299
- R2(config)#mpls ldp router-id loopback 0
- R2(config)#interface e0/0
- R2(config-if)#mpls ip
查看isis邻接关系建立情况
- R1#show clns neighbors
-
- Tag null:
- System Id Interface SNPA State Holdtime Type Protocol
- R2 Et0/0 aabb.cc00.0200 Up 7 L1L2 IS-IS
查看mpls邻接关系建立情况
- R1#show mpls ldp neighbor
- Peer LDP Ident: 10.2.2.2:0; Local LDP Ident 10.1.1.1:0
- TCP connection: 10.2.2.2.45343 - 10.1.1.1.646
- State: Oper; Msgs sent/rcvd: 13/12; Downstream
- Up time: 00:05:13
- LDP discovery sources:
- Ethernet0/0, Src IP addr: 12.12.12.2
- Addresses bound to peer LDP Ident:
- 12.12.12.2 25.25.25.2 10.2.2.2
检查网络联通性
- R1#ping 10.2.2.2 source 10.1.1.1
- Type escape sequence to abort.
- Sending 5, 100-byte ICMP Echos to 10.2.2.2, timeout is 2 seconds:
- Packet sent with a source address of 10.1.1.1
- !!!!!
- Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms
mp-bgp配置
- R1(config)#router bgp 12
- R1(config-router)#bgp router-id 10.1.1.1
- R1(config-router)#neighbor 10.2.2.2 remote-as 12
- R1(config-router)#neighbor 10.2.2.2 update-source loopback 0
- R1(config-router)#address-family vpnv4
- R1(config-router-af)#neighbor 10.2.2.2 activate
- R1(config-router-af)#neighbor 10.2.2.2 send-community extended
-
- R2(config)#router bgp 12
- R2(config-router)#bgp router-id 10.2.2.2
- R2(config-router)#neighbor 10.1.1.1 remote-as 12
- R2(config-router)#neighbor 10.1.1.1 update-source loopback 0
- R2(config-router)#address-family vpnv4
- R2(config-router-af)#neighbor 10.1.1.1 activate
- R2(config-router-af)#neighbor 10.1.1.1 send-community extended
校验MP-BGP PEER 关系是否建立:
- R1#show ip bgp vpnv4 all summary
- BGP router identifier 10.1.1.1, local AS number 12
- BGP table version is 1, main routing table version 1
-
- Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
- 10.2.2.2 4 12 16 16 1 0 0 00:10:43 0
- R1(config)#ip vrf r12
- R1(config-vrf)#rd 1:2
- R1(config-vrf)#route-target 1:2
- R1(config-vrf)#int e0/1
- R1(config-if)#ip vrf forwarding r12
- R1(config-if)#ip address 13.13.13.1 255.255.255.0
-
- R2(config)#ip vrf r12
- R2(config-vrf)#rd 1:2
- R2(config-vrf)#route-target 1:2
- R2(config)#interface e0/1
- R2(config-if)#ip vrf r12
- R2(config-vrf)#interface e0/1
- R2(config-if)#ip vrf forwarding r12
完成PE CE 上OSPF 的配置,并且校验PE 学习C-NETWORK 路由的结果。
R4 R5 间OSPF 此时先不去配置。
- R1(config)#router ospf 1 vrf r12
- R1(config-router)#network 13.13.13.0 0.0.0.255 area 1
-
- R2(config)#router ospf 1 vrf r12
- R2(config-router)#network 25.25.25.2 255.255.255.0 area 0
-
- R3(config)#router ospf 1
- R3(config-router)#router-id 10.3.3.3
- R3(config-router)#network 10.3.3.3 0.0.0.0 area 0
- R3(config-router)#network 13.13.13.0 0.0.0.255 area 1
- R3(config-router)#network 34.34.34.0 0.0.0.255 area 0
-
- R4(config)#router ospf 1
- R4(config-router)#router-id 10.4.4.4
- R4(config-router)#network 10.4.4.4 0.0.0.0 area 0
- R4(config-router)#network 34.34.34.0 0.0.0.255 area 0
-
- R5(config)#router ospf 1
- R5(config-router)#router-id 10.5.5.5
- R5(config-router)#network 10.5.5.5 0.0.0.0 area 0
- R5(config-router)#network 25.25.25.0 0.0.0.255 area 0
PE路由重分发
- R1(config)#router bgp 12
- R1(config-router)#address-family ipv4 vrf r12
- R1(config-router-af)#redistribute ospf 1
- R1(config)#router ospf 1 vrf r12
- R1(config-router)#redistribute bgp 12 subnets
-
- R2(config)#router bgp 12
- R2(config-router)#address-family ipv4 vrf r12
- R2(config-router-af)#redistribute ospf 1
- R2(config)#router ospf 1 vrf r12
- R2(config-router)#redistribute bgp 12 subnets
完成如上配置后,请在R1 上校验VRF 路由表,现象如下;
- R1#show ip route vrf r12 ospf
-
-
- Gateway of last resort is not set
-
- 10.0.0.0/32 is subnetted, 1 subnets
- O 10.3.3.3 [110/11] via 13.13.13.3, 00:00:22, Ethernet0/1
- //如上现象表明R1并没有学习area 0的路由。
-
- R3#show ip route ospf
-
-
- Gateway of last resort is not set
-
- 10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
- O 10.4.4.4/32 [110/11] via 34.34.34.4, 00:00:01, Ethernet0/0
- //如上现象表明R3学习了R4路由。
-
- R2#show ip route vrf r12 ospf
-
-
-
- Gateway of last resort is not set
-
- 10.0.0.0/32 is subnetted, 1 subnets
- O 10.5.5.5 [110/11] via 25.25.25.5, 00:07:57, Ethernet0/1
在R1 R3 间配置虚链路,帮助PE设备R1 学习R4 loopback 0路由。
- R1(config)#router ospf 1 vrf r12
- R1(config-router)#area 1 virtual-link 10.3.3.3
-
- R3(config)#router ospf 1
- R3(config-router)#area 1 virtual-link 13.13.13.1
此时一定要在R1 上确认和R3 建立了虚链路邻接关系,并且R1 学习了R4的路由;
- R1#show ip ospf neighbor
-
- Neighbor ID Pri State Dead Time Address Interface
- 10.3.3.3 0 FULL/ - - 13.13.13.3 OSPF_VL3
- 10.3.3.3 1 FULL/BDR 00:00:33 13.13.13.3 Ethernet0/1
-
- Routing Table: r12
-
-
- Gateway of last resort is not set
-
- 10.0.0.0/32 is subnetted, 2 subnets
- O 10.3.3.3 [110/11] via 13.13.13.3, 04:28:28, Ethernet0/1
- O 10.4.4.4 [110/21] via 13.13.13.3, 00:01:31, Ethernet0/1
- 34.0.0.0/24 is subnetted, 1 subnets
- O 34.34.34.0 [110/20] via 13.13.13.3, 00:01:31, Ethernet0/1
- //如上现象表明R1 与R3的虚链路邻接关系已经建立,且R1正常学习了R4路由。
在R5上确认通过P-NETWORK 共享了R3 R4路由。
- R5#show ip route ospf
-
-
- Gateway of last resort is not set
-
- 10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
- O IA 10.3.3.3/32 [110/21] via 25.25.25.2, 00:00:18, Ethernet0/0
- //区域间路由被共享,路由类型维持不变。
- O IA 10.4.4.4/32 [110/31] via 25.25.25.2, 00:00:18, Ethernet0/0
- //相同区域路由被P-NETWORK 共享变成了区域间路由。
- 13.0.0.0/24 is subnetted, 1 subnets
- O IA 13.13.13.0 [110/11] via 25.25.25.2, 00:00:18, Ethernet0/0
- 34.0.0.0/24 is subnetted, 1 subnets
- O IA 34.34.34.0 [110/30] via 25.25.25.2, 00:00:18, Ethernet0/0
R4 R5 间backdoor 链路激活,启用OSPF,查看路由表。
- R4(config)#router os 1
- R4(config-router)#network 45.45.45.0 0.0.0.255 area 0
-
- R5(config)#router ospf 1
- R5(config-router)#network 45.45.45.0 0.0.0.255 area 0
- R5#show ip route ospf
-
- Gateway of last resort is not set
-
- 10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
- O IA 10.3.3.3/32 [110/21] via 45.45.45.4, 00:00:03, Ethernet0/1
- [110/21] via 25.25.25.2, 00:00:03, Ethernet0/0
- //如上现象表明后门链路启用后,导致抵达10.3.3.0/24出现了负载均衡。
- O IA 10.4.4.4/32 [110/31] via 25.25.25.2, 00:02:20, Ethernet0/0
- 13.0.0.0/24 is subnetted, 1 subnets
- //如上现象表明后门链路启用后,R5 抵达R4 10.4.4.0/24网络不走P-NETWORK,走BACKDOOR。
- O IA 13.13.13.0 [110/11] via 25.25.25.2, 00:02:20, Ethernet0/0
- 34.0.0.0/24 is subnetted, 1 subnets
- O IA 34.34.34.0 [110/30] via 25.25.25.2, 00:02:20, Ethernet0/0
R4 R1 的隧道创建。
- R4(config)#interface tunnel 14
- R4(config-if)#ip unnumbered ethernet 0/0
- R4(config-if)#tunnel source 34.34.34.4
- R4(config-if)#tunnel destination 13.13.13.1
- R4(config-if)#tunnel mode gre ip
- R4(config-if)#ip ospf 1 area 0
-
- R1(config)#interface tunnel 14
- R1(config-if)#ip vrf forwarding r12
- R1(config-if)#ip unnumbered ethernet 0/1
- R1(config-if)#tunnel source 13.13.13.1
- R1(config-if)#tunnel destination 34.34.34.4
- R1(config-if)#tunnel source 13.13.13.1
- R1(config-if)#tunnel mode gre ip
- R1(config-if)#ip ospf 1 area 0
- R1(config-if)#tunnel vrf r12
- //告诉隧道目的地是需要在VRF R12下查询
确认R1 R4 建立了基于隧道的OSPF 邻接关系。
- R1#show ip ospf neighbor
-
- Neighbor ID Pri State Dead Time Address Interface
- 10.4.4.4 0 FULL/ - 00:00:38 34.34.34.4 Tunnel14
- 10.3.3.3 0 FULL/ - - 13.13.13.3 OSPF_VL3
- 10.3.3.3 1 FULL/BDR 00:00:34 13.13.13.3 Ethernet0/1
R1 R2 上完成伪链路配置。
- R1(config)#interface loopback 12
- R1(config-if)#ip vrf forwarding r12
- R1(config-if)#ip address 100.100.100.1 255.255.255.255
- R1(config-if)#router bgp 12
- R1(config-router)#address-family ipv4 vrf r12
- R1(config-router-af)#network 100.100.100.1 mask 255.255.255.255
- R1(config-router-af)#router ospf 1 vrf r12
- R1(config-router)#area 0 sham-link 100.100.100.1 100.100.100.2
-
- R2(config)#interface loopback 12
- R2(config-if)#ip vrf forwarding r12
- R2(config-if)#ip address 100.100.100.2 255.255.255.255
- R2(config-if)#router bgp 12
- R2(config-router)#address-family ipv4 vrf r12
- R2(config-router-af)#network 100.100.100.2 mask 255.255.255.255
- R2(config-router-af)#router ospf 1 vrf r12
- R2(config-router)#area 0 sham-link 100.100.100.2 100.100.100.1
在R4 R5 上对后门链路OSPF 的开销做修改。
- R4(config)#interface e0/1
- R4(config-if)#ip ospf cost 10000
-
- R5(config)#interface e0/1
- R5(config-if)#ip ospf cost 10000
R5 和R4 确认抵达对端是否首选P-NETWORK。
- R4#show ip route ospf
-
-
- Gateway of last resort is not set
-
- 10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
- O IA 10.3.3.3/32 [110/11] via 34.34.34.3, 05:20:54, Ethernet0/0
- O 10.5.5.5/32 [110/32] via 34.34.34.3, 00:04:49, Ethernet0/0
- //如上现象表明伪链路已经成功还原路由,且通过开销的比对选择优选P-NETWORK
- 13.0.0.0/24 is subnetted, 1 subnets
- O IA 13.13.13.0 [110/20] via 34.34.34.3, 05:20:54, Ethernet0/0
- 25.0.0.0/24 is subnetted, 1 subnets
- O 25.25.25.0 [110/31] via 34.34.34.3, 00:04:49, Ethernet0/0
- 100.0.0.0/32 is subnetted, 2 subnets
- O E2 100.100.100.1 [110/1] via 34.34.34.3, 00:08:52, Ethernet0/0
- O E2 100.100.100.2 [110/1] via 34.34.34.3, 00:06:00, Ethernet0/0
-
- R5#show ip route ospf
-
-
- Gateway of last resort is not set
-
- 10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
- O IA 10.3.3.3/32 [110/22] via 25.25.25.2, 00:03:05, Ethernet0/0
- O 10.4.4.4/32 [110/32] via 25.25.25.2, 00:03:05, Ethernet0/0
- //如上现象表明伪链路已经成功还原路由,且通过开销的比对选择优选P-NETWORK
- 13.0.0.0/24 is subnetted, 1 subnets
- O IA 13.13.13.0 [110/21] via 25.25.25.2, 00:06:35, Ethernet0/0
- 34.0.0.0/24 is subnetted, 1 subnets
- O 34.34.34.0 [110/31] via 25.25.25.2, 00:03:05, Ethernet0/0
- 100.0.0.0/32 is subnetted, 2 subnets
- O E2 100.100.100.1 [110/1] via 25.25.25.2, 00:07:18, Ethernet0/0
- O E2 100.100.100.2 [110/1] via 25.25.25.2, 00:07:02, Ethernet0/0
R5上利用traceroute 命令验证路径。
- R5#traceroute 10.4.4.4 source 10.5.5.5
- Type escape sequence to abort.
- Tracing the route to 10.4.4.4
- VRF info: (vrf in name/id, vrf out name/id)
- 1 25.25.25.2 1 msec 0 msec 0 msec
- 2 13.13.13.1 [MPLS: Label 102 Exp 0] 1 msec 1 msec 1 msec
- 3 13.13.13.3 0 msec 0 msec 1 msec
- 4 34.34.34.4 0 msec 0 msec *
- //如上现象表明路径符合需求