Introduction
The provider’s MPLS cloud has three routers namely – R1 (P-router), R2 (PE-R2) and R3 (PE-R3). These routers formed OSPF adjacency with one another. R2 and R3 are iBGP neighbors peering with each other’s loopback address.
The TTL propagation within the MPLS cloud was suppressed with no mpls ip propagate-ttl
command. This is to “hide” the number of mpls routers that exist within the provider’s MPLS core.
Reason to use ospf sham link
It is possible that customer’s network has an OSPF backdoor link to each other despite subscribing MPLS service which links customer’s edge routers.
The OSPF link through the MPLS cloud would be an inter-area link despite both site-a and site-b links are in OSPF area 0, this poses a problem if customer wants traffic to traverse from site-a to site-b or vice versa through the MPLS core. OSPF will prefer the intra-area route, in this case is the backdoor link which resides in the same OSPF area, to reach the destination.
To solve this problem, OSPF sham link is used.
Steps to configure OSPF sham link
The OSPF sham link is only created at the PE-routers, the operation is transparent to customer.
1. Create a loopback address, assign a VRF instance and assign a /32 mask IP address.
! interface Loopback20 ip vrf forwarding site-a ip address 20.20.20.20 255.255.255.255 !
Step 2: Advertise the vrf loopback address into BGP vrf instance.
router bgp 65000 ...... ! address-family ipv4 vrf site-a redistribute ospf 2 vrf site-a no synchronization network 20.20.20.20 mask 255.255.255.255 exit-address-family ! ......
Step 3: Create another OSPF process, attached to a VRF instance and insert the area x sham-link
command.
! router ospf 2 vrf site-a log-adjacency-changes area 0 sham-link 20.20.20.20 30.30.30.30 redistribute bgp 65000 subnets network 192.168.0.13 0.0.0.0 area 0 !
Verify OSPF sham-link
If OSPF sham-link is successful you will see this syslog message:
*Mar 1 00:01:16.643: %OSPF-5-ADJCHG: Process 2, Nbr 30.30.30.30 on OSPF_SL0 from LOADING to FULL, Loading Done
You can see OSPF adjacency is formed between the OSPF sham-link by using show ip ospf neighbor
command.
R2#show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 3.3.3.3 0 FULL/ - 00:00:32 192.168.0.10 Serial0/1 1.1.1.1 0 FULL/ - 00:00:30 192.168.0.1 Serial0/0 192.168.0.21 1 FULL/DR 00:00:30 192.168.0.14 FastEthernet1/0 30.30.30.30 0 FULL/ - - 30.30.30.30 OSPF_SL0 R2#
You can verify sham-link status by using show ip ospf sham-links
command.
R2#show ip ospf sham-links Sham Link OSPF_SL0 to address 30.30.30.30 is up Area 0 source address 20.20.20.20 Run as demand circuit DoNotAge LSA allowed. Cost of using 1 State POINT_TO_POINT, Timer intervals configured, Hello 10, Dead 40, Wait 40, Hello due in 00:00:06 Adjacency State FULL (Hello suppressed) Index 2/2, retransmission queue length 0, number of retransmission 0 First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0) Last retransmission scan length is 0, maximum is 0 Last retransmission scan time is 0 msec, maximum is 0 msec R2#
the flow of the command is area area number sham-links source ip address destination ip address
The CE router will prefer the route towards the PE-router.
R4#sh ip route | beg Gate Gateway of last resort is not set 20.0.0.0/32 is subnetted, 1 subnets O E2 20.20.20.20 [110/1] via 192.168.0.13, 00:02:40, FastEthernet1/0 192.168.0.0/30 is subnetted, 3 subnets C 192.168.0.12 is directly connected, FastEthernet1/0 O 192.168.0.16 [110/3] via 192.168.0.13, 00:02:30, FastEthernet1/0 C 192.168.0.20 is directly connected, FastEthernet2/0 30.0.0.0/32 is subnetted, 1 subnets O E2 30.30.30.30 [110/1] via 192.168.0.13, 00:02:37, FastEthernet1/0 R4#
As seen from CE router’s routing table to reach site-b from site-a, CE site-a router prefers the route via the PE-router (192.168.0.13).
The E2 routes are vrf loopback interfaces of PE-routers use for sham-links, these routes are E2 because they are redistributed in OSPF vrf instance.
! router ospf 2 vrf site-b log-adjacency-changes area 0 sham-link 30.30.30.30 20.20.20.20 redistribute bgp 65000 subnets network 192.168.0.17 0.0.0.0 area 0 !
From CE site-a traceroute:
R4#traceroute 192.168.0.18 Type escape sequence to abort. Tracing the route to 192.168.0.18 1 192.168.0.13 116 msec 56 msec 20 msec 2 192.168.0.17 92 msec 48 msec 20 msec 3 192.168.0.18 104 msec * 132 msec R4#
192.168.0.13 is the PE-R2 router, 192.168.0.17 is the PE-R3 router and finally the 192.168.0.18 is the destination CE site-b router.
Entire lab configurations
################ R1 is P router # ################ ! ! version 12.4 service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption ! hostname R1 ! boot-start-marker boot-end-marker ! ! no aaa new-model memory-size iomem 5 ip cef ! ! ! ! no ip domain lookup ip auth-proxy max-nodata-conns 3 ip admission max-nodata-conns 3 ! multilink bundle-name authenticated ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! archive log config hidekeys ! ! ! ! ! ! ! ! interface Loopback0 ip address 11.11.11.11 255.255.255.255 ! interface FastEthernet0/0 no ip address shutdown duplex auto speed auto ! interface Serial0/0 bandwidth 2000 ip address 192.168.0.1 255.255.255.252 mpls ip clock rate 2000000 ! interface FastEthernet0/1 no ip address shutdown duplex auto speed auto ! interface Serial0/1 bandwidth 2000 ip address 192.168.0.5 255.255.255.252 mpls ip clock rate 2000000 ! interface Serial0/2 no ip address shutdown clock rate 2000000 ! router ospf 1 router-id 1.1.1.1 log-adjacency-changes passive-interface default no passive-interface Serial0/0 no passive-interface Serial0/1 network 11.11.11.11 0.0.0.0 area 0 network 192.168.0.1 0.0.0.0 area 0 network 192.168.0.5 0.0.0.0 area 0 ! ip forward-protocol nd ! ! no ip http server no ip http secure-server ! ! ! ! ! ! ! control-plane ! ! ! ! ! ! ! ! ! ! line con 0 exec-timeout 0 0 logging synchronous line aux 0 line vty 0 4 ! ! end ############ R2 is PE-R2# ############ ! ! version 12.4 service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption ! hostname R2 ! boot-start-marker boot-end-marker ! ! no aaa new-model memory-size iomem 5 ip cef ! ! ! ! ip vrf site-a rd 2.2.2.2:2 route-target export 2:2 route-target import 3:3 ! no ip domain lookup ip auth-proxy max-nodata-conns 3 ip admission max-nodata-conns 3 ! multilink bundle-name authenticated ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! archive log config hidekeys ! ! ! ! ! ! ! ! interface Loopback0 ip address 22.22.22.22 255.255.255.255 ! interface Loopback20 ip vrf forwarding site-a ip address 20.20.20.20 255.255.255.255 ! interface FastEthernet0/0 no ip address shutdown duplex auto speed auto ! interface Serial0/0 bandwidth 2000 ip address 192.168.0.2 255.255.255.252 mpls ip clock rate 2000000 ! interface FastEthernet0/1 no ip address shutdown duplex auto speed auto ! interface Serial0/1 bandwidth 2000 ip address 192.168.0.9 255.255.255.252 mpls ip clock rate 2000000 ! interface Serial0/2 no ip address shutdown clock rate 2000000 ! interface FastEthernet1/0 ip vrf forwarding site-a ip address 192.168.0.13 255.255.255.252 duplex auto speed auto ! interface FastEthernet2/0 no ip address shutdown duplex auto speed auto ! router ospf 2 vrf site-a log-adjacency-changes area 0 sham-link 20.20.20.20 30.30.30.30 redistribute bgp 65000 subnets network 192.168.0.13 0.0.0.0 area 0 ! router ospf 1 router-id 2.2.2.2 log-adjacency-changes passive-interface default no passive-interface Serial0/0 no passive-interface Serial0/1 no passive-interface Loopback0 network 22.22.22.22 0.0.0.0 area 0 network 192.168.0.2 0.0.0.0 area 0 network 192.168.0.9 0.0.0.0 area 0 ! router bgp 65000 no synchronization bgp log-neighbor-changes neighbor 33.33.33.33 remote-as 65000 neighbor 33.33.33.33 update-source Loopback0 no auto-summary ! address-family vpnv4 neighbor 33.33.33.33 activate neighbor 33.33.33.33 send-community extended exit-address-family ! address-family ipv4 vrf site-a redistribute ospf 2 vrf site-a no synchronization network 20.20.20.20 mask 255.255.255.255 exit-address-family ! ip forward-protocol nd ! ! no ip http server no ip http secure-server ! ! ! ! ! ! ! control-plane ! ! ! ! ! ! ! ! ! ! line con 0 exec-timeout 0 0 logging synchronous line aux 0 line vty 0 4 ! ! end ############ R3 is PE-R3# ############ ! ! version 12.4 service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption ! hostname R3 ! boot-start-marker boot-end-marker ! ! no aaa new-model memory-size iomem 5 ip cef ! ! ! ! ip vrf site-b rd 3.3.3.3:3 route-target export 3:3 route-target import 2:2 ! no ip domain lookup ip auth-proxy max-nodata-conns 3 ip admission max-nodata-conns 3 ! multilink bundle-name authenticated ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! archive log config hidekeys ! ! ! ! ! ! ! ! interface Loopback0 ip address 33.33.33.33 255.255.255.255 ! interface Loopback30 ip vrf forwarding site-b ip address 30.30.30.30 255.255.255.255 ! interface FastEthernet0/0 no ip address shutdown duplex auto speed auto ! interface Serial0/0 bandwidth 2000 ip address 192.168.0.6 255.255.255.252 mpls ip clock rate 2000000 ! interface FastEthernet0/1 no ip address shutdown duplex auto speed auto ! interface Serial0/1 bandwidth 2000 ip address 192.168.0.10 255.255.255.252 mpls ip clock rate 2000000 ! interface Serial0/2 no ip address shutdown clock rate 2000000 ! interface FastEthernet1/0 ip vrf forwarding site-b ip address 192.168.0.17 255.255.255.252 duplex auto speed auto ! interface FastEthernet2/0 no ip address shutdown duplex auto speed auto ! router ospf 2 vrf site-b log-adjacency-changes area 0 sham-link 30.30.30.30 20.20.20.20 redistribute bgp 65000 subnets network 192.168.0.17 0.0.0.0 area 0 ! router ospf 1 router-id 3.3.3.3 log-adjacency-changes network 33.33.33.33 0.0.0.0 area 0 network 192.168.0.6 0.0.0.0 area 0 network 192.168.0.10 0.0.0.0 area 0 ! router bgp 65000 no synchronization bgp log-neighbor-changes neighbor 22.22.22.22 remote-as 65000 neighbor 22.22.22.22 update-source Loopback0 no auto-summary ! address-family vpnv4 neighbor 22.22.22.22 activate neighbor 22.22.22.22 send-community extended exit-address-family ! address-family ipv4 vrf site-b redistribute ospf 2 vrf site-b no synchronization network 30.30.30.30 mask 255.255.255.255 exit-address-family ! ip forward-protocol nd ! ! no ip http server no ip http secure-server ! ! ! ! ! ! ! control-plane ! ! ! ! ! ! ! ! ! ! line con 0 exec-timeout 0 0 logging synchronous line aux 0 line vty 0 4 ! ! end ################# R4 is CE site-a # ################# ! ! version 12.4 service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption ! hostname R4 ! boot-start-marker boot-end-marker ! ! no aaa new-model memory-size iomem 5 ip cef ! ! ! ! no ip domain lookup ip auth-proxy max-nodata-conns 3 ip admission max-nodata-conns 3 ! multilink bundle-name authenticated ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! archive log config hidekeys ! ! ! ! ! ! ! ! interface FastEthernet0/0 no ip address shutdown duplex auto speed auto ! interface Serial0/0 no ip address shutdown clock rate 2000000 ! interface FastEthernet0/1 no ip address shutdown duplex auto speed auto ! interface Serial0/1 no ip address shutdown clock rate 2000000 ! interface Serial0/2 no ip address shutdown clock rate 2000000 ! interface FastEthernet1/0 ip address 192.168.0.14 255.255.255.252 duplex auto speed auto ! interface FastEthernet2/0 ip address 192.168.0.21 255.255.255.252 ip ospf cost 100 duplex auto speed auto ! router ospf 1 log-adjacency-changes network 192.168.0.14 0.0.0.0 area 0 network 192.168.0.21 0.0.0.0 area 0 ! ip forward-protocol nd ! ! no ip http server no ip http secure-server ! ! ! ! ! ! ! control-plane ! ! ! ! ! ! ! ! ! ! line con 0 exec-timeout 0 0 logging synchronous line aux 0 line vty 0 4 ! ! end ################ R5 is CE site-b# ################ ! ! version 12.4 service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption ! hostname R5 ! boot-start-marker boot-end-marker ! ! no aaa new-model memory-size iomem 5 ip cef ! ! ! ! no ip domain lookup ip auth-proxy max-nodata-conns 3 ip admission max-nodata-conns 3 ! multilink bundle-name authenticated ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! archive log config hidekeys ! ! ! ! ! ! ! ! interface FastEthernet0/0 no ip address shutdown duplex auto speed auto ! interface Serial0/0 no ip address shutdown clock rate 2000000 ! interface FastEthernet0/1 no ip address shutdown duplex auto speed auto ! interface Serial0/1 no ip address shutdown clock rate 2000000 ! interface Serial0/2 no ip address shutdown clock rate 2000000 ! interface FastEthernet1/0 ip address 192.168.0.18 255.255.255.252 duplex auto speed auto ! interface FastEthernet2/0 ip address 192.168.0.22 255.255.255.252 ip ospf cost 100 duplex auto speed auto ! router ospf 1 log-adjacency-changes network 192.168.0.18 0.0.0.0 area 0 network 192.168.0.22 0.0.0.0 area 0 ! ip forward-protocol nd ! ! no ip http server no ip http secure-server ! ! ! ! ! ! ! control-plane ! ! ! ! ! ! ! ! ! ! line con 0 exec-timeout 0 0 logging synchronous line aux 0 line vty 0 4 ! ! end