OSPF Sham Link Implementation to Advertise Intra-Area LSA
- What is OSPF sham link? ‹
- What is the difference between backdoor link and sham link? ‹
- How to configure an OSPF sham link? ‹
- OSPF sham link alternative configuration method ‹
- How to change the cost of an OSPF sham link? ‹
- Download section ‹
What is OSPF sham link?
An OSPF sham link solves a routing problem that occurs when two MPLS VPN sites use the same OSPF area and have dual connections with each other. One connection is through the MPLS L3VPN with PE-CE routing protocol OSPF. Another connection is a direct backdoor/backup link between the CE routers configured with OSPF in the same area. This creates the following scenario:
- CE router receives inter-area (Type-3) LSA from PE router.
- Simultaneously, CE router receives intra-area (Type-1, Type-2) LSA from backup link.
- Consequently, CE router prefers the backup link to reach the other site instead of using the MPLS L3VPN.
What is the difference between backdoor link and sham link?
The backdoor link between the CE routers can be a secondary connection used in case of a primary MPLS VPN link failure. The secondary connection may be a site-to-site IPSec VPN tunnel across the internet that provides resilience in case of an MPLS VPN connection failure.
On the other hand, the sham link is configured between two PE routers using a dedicated loopback interface address for source and destination. The sham link is established across the MPLS VPN network. The corresponding RFC 4577 provides the following important detail.
A sham link can be thought of as a relation between two VRFs. If two VRFs are to be connected by a sham link, each VRF must be associated with a "Sham Link Endpoint Address", a 32-bit IPv4 address that is treated as an address of the PE router containing that VRF.
RFC 4577, OSPF as the Provider/Customer Edge Protocol for BGP/MPLS IP Virtual Private Networks (VPNs)
How to configure an OSPF sham link?
In the following example topology two sites are connected through an MPLS Layer-3 VPN, but there is also a backup connection (backdoor link) between the CE router R2 and R8. So the CE routers can use either the MPLS L3VPN or the backdoor link to reach the other site. The backdoor link uses OSPF to share routes between the sites. This provides redundancy, but this also creates a network design situation because both sites use OSPF and the PE-CE routing protocol is also OSPF.
- Through the PE-CE link (MPLS L3VPN) each site learns inter-area LSA Type-3 routes from the other site.
- Through the backoor link each site learns intra-area LSA Type-1 routes from the other site.
This means, by default the backdoor link will be used if R1 (Site 1) wants to reach R9 (Site 2). Since this is not desirable, an OSPF sham link is configured between the PE R3 and PE R7. The sham link ensures that the PE-CE link (MPLS L3VPN) routes appear as intra-area LSA Type-1 routes, and not Type-3 routes. Now the OSPF link cost on the backdoor is set to a less preferred value, and as a result the CE routers prefer the OSPF routes received from the PEs, this means the MPLS L3VPN is used between the sites.
Configuration:
R3 (PE)
R3#show run all | sec ^mpls ip__ mpls ip R3#show run | sec ^mpls mpls label range 300 399 mpls ldp router-id Loopback10 force R3#show run | sec ^vrf vrf definition Gold rd 65100:1 ! address-family ipv4 route-target export 65100:1 route-target import 65100:2 exit-address-family R3#show run int Lo10 | sec int interface Loopback10 ip address 3.3.3.3 255.255.255.255 R3#show run int Lo100 | sec int interface Loopback100 description ** OSPF sham link source ** vrf forwarding Gold ip address 10.33.33.33 255.255.255.255 R3#show run int Gi0/0 | sec int interface GigabitEthernet0/0 description ** to CE R2 ** no ip address duplex auto speed auto media-type rj45 R3#show run int Gi0/0.10 | sec int interface GigabitEthernet0/0.10 description ** to CE R2 in VRF Gold ** encapsulation dot1Q 10 vrf forwarding Gold ip address 10.0.1.1 255.255.255.252 ip ospf network point-to-point R3#show run int Gi0/1 | sec int interface GigabitEthernet0/1 description ** to R4 ** ip address 10.1.0.1 255.255.255.252 ip router isis duplex auto speed auto media-type rj45 mpls ip isis circuit-type level-2-only isis network point-to-point R3#show run | sec ^router router ospf 10 vrf Gold router-id 3.3.3.3 area 0 sham-link 10.33.33.33 10.77.77.77 redistribute bgp 65100 subnets network 10.0.1.0 0.0.0.3 area 0 router isis net 49.0010.0000.0000.0003.00 is-type level-2-only advertise passive-only metric-style wide log-adjacency-changes passive-interface Loopback10 router bgp 65100 bgp router-id 3.3.3.3 bgp log-neighbor-changes neighbor 10.10.10.10 remote-as 65100 neighbor 10.10.10.10 update-source Loopback10 ! address-family vpnv4 neighbor 10.10.10.10 activate neighbor 10.10.10.10 send-community extended exit-address-family ! address-family ipv4 vrf Gold network 10.33.33.33 mask 255.255.255.255 redistribute ospf 10 exit-address-family
R7 (PE)
R7#show run all | sec ^mpls ip__ mpls ip R7#show run | sec ^mpls mpls label range 700 799 mpls ldp router-id Loopback10 force R7#show run | sec ^vrf vrf definition Gold rd 65100:2 ! address-family ipv4 route-target export 65100:2 route-target import 65100:1 exit-address-family R7#show run int Lo10 | sec int interface Loopback10 ip address 7.7.7.7 255.255.255.255 R7#show run int Lo100 | sec int interface Loopback100 description ** OSPF sham link source ** vrf forwarding Gold ip address 10.77.77.77 255.255.255.255 R7#show run int Gi0/0 | sec int interface GigabitEthernet0/0 description ** to CE R8 ** no ip address duplex auto speed auto media-type rj45 R7#show run int Gi0/0.10 | sec int interface GigabitEthernet0/0.10 description ** to CE R8 in VRF Gold ** encapsulation dot1Q 10 vrf forwarding Gold ip address 10.0.2.1 255.255.255.252 ip ospf network point-to-point R7#show run int Gi0/1 | sec int interface GigabitEthernet0/1 description ** to R6 ** ip address 10.4.0.1 255.255.255.252 ip router isis duplex auto speed auto media-type rj45 mpls ip isis circuit-type level-2-only isis network point-to-point R7#show run | sec ^router router ospf 10 vrf Gold router-id 7.7.7.7 area 0 sham-link 10.77.77.77 10.33.33.33 redistribute bgp 65100 subnets network 10.0.2.0 0.0.0.3 area 0 router isis net 49.0010.0000.0000.0007.00 is-type level-2-only advertise passive-only metric-style wide log-adjacency-changes passive-interface Loopback10 router bgp 65100 bgp router-id 7.7.7.7 bgp log-neighbor-changes neighbor 10.10.10.10 remote-as 65100 neighbor 10.10.10.10 update-source Loopback10 ! address-family vpnv4 neighbor 10.10.10.10 activate neighbor 10.10.10.10 send-community extended exit-address-family ! address-family ipv4 vrf Gold network 10.77.77.77 mask 255.255.255.255 redistribute ospf 10 exit-address-family
R2 (CE)
R2#show run | sec ^vrf vrf definition Gold rd 1:1 ! address-family ipv4 exit-address-family R2#show run int Gi0/0 | sec int interface GigabitEthernet0/0 description ** to R1 Site1 ** no ip address duplex auto speed auto media-type rj45 R2#show run int Gi0/0.10 | sec int interface GigabitEthernet0/0.10 description ** to R1 Site1 in VRF Gold ** encapsulation dot1Q 10 vrf forwarding Gold ip address 192.168.1.1 255.255.255.252 ip ospf network point-to-point R2#show run int Gi0/1 | sec int interface GigabitEthernet0/1 description ** to PE R3 ** no ip address duplex auto speed auto media-type rj45 R2#show run int Gi0/1.10 | sec int interface GigabitEthernet0/1.10 description ** to PE R3 in VRF Gold ** encapsulation dot1Q 10 vrf forwarding Gold ip address 10.0.1.2 255.255.255.252 ip ospf network point-to-point R2#show run int Gi0/2 | sec int interface GigabitEthernet0/2 description ** backdoor link to CE R8 ** no ip address duplex auto speed auto media-type rj45 R2#show run int Gi0/2.10 | sec int interface GigabitEthernet0/2.10 description ** backdoor link to CE R8 in VRF Gold ** encapsulation dot1Q 10 vrf forwarding Gold ip address 192.168.3.1 255.255.255.252 ip ospf network point-to-point ip ospf cost 10 R2#show run | sec ^router router ospf 10 vrf Gold router-id 2.2.2.2 capability vrf-lite network 10.0.1.0 0.0.0.3 area 0 network 192.168.1.0 0.0.0.3 area 0 network 192.168.3.0 0.0.0.3 area 0
R8 (CE)
R8#show run | sec ^vrf vrf definition Gold rd 1:1 ! address-family ipv4 exit-address-family R8#show run int Gi0/0 | sec int interface GigabitEthernet0/0 description ** to R9 Site2 ** no ip address duplex auto speed auto media-type rj45 R8#show run int Gi0/0.10 | sec int interface GigabitEthernet0/0.10 description ** to R9 Site2 in VRF Gold ** encapsulation dot1Q 10 vrf forwarding Gold ip address 192.168.2.1 255.255.255.252 ip ospf network point-to-point R8#show run int Gi0/1 | sec int interface GigabitEthernet0/1 description ** to PE R7 ** no ip address duplex auto speed auto media-type rj45 R8#show run int Gi0/1.10 | sec int interface GigabitEthernet0/1.10 description ** to PE R7 in VRF Gold ** encapsulation dot1Q 10 vrf forwarding Gold ip address 10.0.2.2 255.255.255.252 ip ospf network point-to-point R8#show run int Gi0/2 | sec int interface GigabitEthernet0/2 description ** backdoor link to CE R2 ** no ip address duplex auto speed auto media-type rj45 R8#show run int Gi0/2.10 | sec int interface GigabitEthernet0/2.10 description ** backdoor link to CE R2 in VRF Gold ** encapsulation dot1Q 10 vrf forwarding Gold ip address 192.168.3.2 255.255.255.252 ip ospf network point-to-point ip ospf cost 10 R8#show run | sec ^router router ospf 10 vrf Gold router-id 8.8.8.8 capability vrf-lite network 10.0.2.0 0.0.0.3 area 0 network 192.168.2.0 0.0.0.3 area 0 network 192.168.3.0 0.0.0.3 area 0
R10 (BGP RR)
R10#show run int Lo10 | sec int interface Loopback10 ip address 10.10.10.10 255.255.255.255 R10#show run int Gi0/0 | sec int interface GigabitEthernet0/0 description ** to R5 ** ip address 10.5.0.1 255.255.255.252 ip router isis duplex auto speed auto media-type rj45 isis circuit-type level-2-only isis network point-to-point R10#show run | sec ^router router isis net 49.0010.0000.0000.0010.00 is-type level-2-only advertise passive-only metric-style wide log-adjacency-changes passive-interface Loopback10 router bgp 65100 bgp router-id 10.10.10.10 bgp log-neighbor-changes neighbor 3.3.3.3 remote-as 65100 neighbor 3.3.3.3 update-source Loopback10 neighbor 7.7.7.7 remote-as 65100 neighbor 7.7.7.7 update-source Loopback10 ! address-family vpnv4 neighbor 3.3.3.3 activate neighbor 3.3.3.3 send-community extended neighbor 3.3.3.3 route-reflector-client neighbor 7.7.7.7 activate neighbor 7.7.7.7 send-community extended neighbor 7.7.7.7 route-reflector-client exit-address-family
R4
R4#show run all | sec ^mpls ip__ mpls ip R4#show run | sec ^mpls mpls label range 400 499 mpls ldp router-id Loopback10 force R4#show run int Lo10 | sec int interface Loopback10 ip address 4.4.4.4 255.255.255.255 R4#show run int Gi0/0 | sec int interface GigabitEthernet0/0 description ** to PE R3 ** ip address 10.1.0.2 255.255.255.252 ip router isis duplex auto speed auto media-type rj45 mpls ip isis circuit-type level-2-only isis network point-to-point R4#show run int Gi0/1 | sec int interface GigabitEthernet0/1 description ** to R5 ** ip address 10.2.0.1 255.255.255.252 ip router isis duplex auto speed auto media-type rj45 mpls ip isis circuit-type level-2-only isis network point-to-point R4#show run | sec ^router router isis net 49.0010.0000.0000.0004.00 is-type level-2-only advertise passive-only metric-style wide log-adjacency-changes passive-interface Loopback10
R5
R5#show run all | sec ^mpls ip__ mpls ip R5#show run | sec ^mpls mpls label range 500 599 mpls ldp router-id Loopback10 force R5#show run int Lo10 | sec int interface Loopback10 ip address 5.5.5.5 255.255.255.255 R5#show run int Gi0/0 | sec int interface GigabitEthernet0/0 description ** to R4 ** ip address 10.2.0.2 255.255.255.252 ip router isis duplex auto speed auto media-type rj45 mpls ip isis circuit-type level-2-only isis network point-to-point R5#show run int Gi0/1 | sec int interface GigabitEthernet0/1 description ** to R6 ** ip address 10.3.0.1 255.255.255.252 ip router isis duplex auto speed auto media-type rj45 mpls ip isis circuit-type level-2-only isis network point-to-point R5#show run int Gi0/2 | sec int interface GigabitEthernet0/2 description ** to BGP RR R10 ** ip address 10.5.0.2 255.255.255.252 ip router isis duplex auto speed auto media-type rj45 isis circuit-type level-2-only isis network point-to-point R5#show run | sec ^router router isis net 49.0010.0000.0000.0005.00 is-type level-2-only advertise passive-only metric-style wide log-adjacency-changes passive-interface Loopback10
R1
R1#show run | sec ^vrf vrf definition Gold rd 1:1 ! address-family ipv4 exit-address-family R1#show run int Gi0/0 | sec int interface GigabitEthernet0/0 description ** to CE R2 ** no ip address duplex auto speed auto media-type rj45 R1#show run int Gi0/0.10 | sec int interface GigabitEthernet0/0.10 description ** to CE R2 in VRF Gold ** encapsulation dot1Q 10 vrf forwarding Gold ip address 192.168.1.2 255.255.255.252 ip ospf network point-to-point R1#show run | sec ^router router ospf 10 vrf Gold router-id 1.1.1.1 network 192.168.1.0 0.0.0.3 area 0
R1#trace vrf Gold 192.168.2.2 probe 1 Type escape sequence to abort. Tracing the route to 192.168.2.2 VRF info: (vrf in name/id, vrf out name/id) 1 192.168.1.1 2 msec 2 10.0.1.1 23 msec 3 10.1.0.2 [MPLS: Labels 405/710 Exp 0] 48 msec « MPLS L3VPN used to reach Site 2 from Site 1 4 10.2.0.2 [MPLS: Labels 506/710 Exp 0] 48 msec 5 10.3.0.2 [MPLS: Labels 603/710 Exp 0] 52 msec 6 10.0.2.1 [MPLS: Label 710 Exp 0] 28 msec « VPN Service Label assigned by PE R7 7 10.0.2.2 50 msec 8 192.168.2.2 50 msec R9#trace vrf Gold 192.168.1.2 probe 1 Type escape sequence to abort. Tracing the route to 192.168.1.2 VRF info: (vrf in name/id, vrf out name/id) 1 192.168.2.1 1 msec 2 10.0.2.1 23 msec 3 10.4.0.2 [MPLS: Labels 605/309 Exp 0] 48 msec « MPLS L3VPN used to reach Site 1 from Site 2 4 10.3.0.1 [MPLS: Labels 504/309 Exp 0] 49 msec 5 10.2.0.1 [MPLS: Labels 402/309 Exp 0] 48 msec 6 10.0.1.1 [MPLS: Label 309 Exp 0] 26 msec 7 10.0.1.2 49 msec 8 192.168.1.2 48 msec R2#show ip route vrf Gold ospf | beg Ga Gateway of last resort is not set 10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks O 10.0.2.0/30 [110/3] via 10.0.1.1, 00:00:47, GigabitEthernet0/1.10 O E2 10.33.33.33/32 [110/1] via 10.0.1.1, 00:03:50, GigabitEthernet0/1.10 « Sham link source address received on CE router O E2 10.77.77.77/32 [110/1] via 10.0.1.1, 00:00:52, GigabitEthernet0/1.10 192.168.2.0/30 is subnetted, 1 subnets O 192.168.2.0 [110/4] via 10.0.1.1, 00:00:47, GigabitEthernet0/1.10 R3#show ip ospf sham-links Sham Link OSPF_SL0 to address 10.77.77.77 is up « Sham link between PE R3 and PE R7 is up Area 0 source address 10.33.33.33 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 1/2/2, retransmission queue length 0, number of retransmission 0 First 0x0(0)/0x0(0)/0x0(0) Next 0x0(0)/0x0(0)/0x0(0) Last retransmission scan length is 0, maximum is 0 Last retransmission scan time is 0 msec, maximum is 0 msec R3#show ip bgp vpnv4 rd 65100:2 192.168.2.0 BGP routing table entry for 65100:2:192.168.2.0/30, version 12 « BGP VPNv4 prefix for Site 2 Paths: (1 available, best #1, no table) Not advertised to any peer Refresh Epoch 1 Local 7.7.7.7 (metric 40) (via default) from 10.10.10.10 (10.10.10.10) Origin incomplete, metric 2, localpref 100, valid, internal, best Extended Community: RT:65100:2 OSPF DOMAIN ID:0x0005:0x0000000A0200 OSPF RT:0.0.0.0:2:0 OSPF ROUTER ID:7.7.7.7:0 Originator: 7.7.7.7, Cluster list: 10.10.10.10 « BGP VPNv4 prefix originated by PE R7 mpls labels in/out nolabel/710 « PE R7 assigns VPN Service Label 710 to Site 2 prefix rx pathid: 0, tx pathid: 0x0
In the above outputs it is visible that instead of the backdoor link, the two sites prefer to use the MPLS L3VPN to reach each other. This is because the cost of the backdoor link is increased so it is less preferred than the metric of routes received through the sham link (from the PE router). The following capture shows an OSPF LSA advertised through the MPLS network between the PE routers to establish the sham link.
OSPF sham link alternative configuration method
The solution provided by the OSPF sham link can also be configured by not redistributing BGP routes into the OSPF routing process on the PE routers R3 and R7. Compared to the above configurations, the following is the only change applied on both PE routers.
R3>enable
R3#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R3(config)#router ospf 10 vrf Gold
R3(config-router)#no redistribute bgp 65100 subnets
R3(config-router)#
R3(config-router)#exit
R3(config)#exit
R3#
This means that the CE routers still receive the intra-area prefixes from the PE routers (from the sham link), but now the CE routers no longer receive the sham link source and destination loopback IP addresses as external E2 routes. The following output shows the new status on CE R2.
R2#show ip route vrf Gold ospf | beg Ga
Gateway of last resort is not set
10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
O 10.0.2.0/30 [110/3] via 10.0.1.1, 00:10:32, GigabitEthernet0/1.10
192.168.2.0/30 is subnetted, 1 subnets
O 192.168.2.0 [110/4] via 10.0.1.1, 00:10:32, GigabitEthernet0/1.10
The solution works as before, the two sites still prefer to use the MPLS L3VPN to reach each other instead of using the directly connected backdoor link between the CE routers.
R1#trace vrf Gold 192.168.2.2 probe 1 Type escape sequence to abort. Tracing the route to 192.168.2.2 VRF info: (vrf in name/id, vrf out name/id) 1 192.168.1.1 2 msec 2 10.0.1.1 24 msec 3 10.1.0.2 [MPLS: Labels 405/710 Exp 0] 49 msec 4 10.2.0.2 [MPLS: Labels 506/710 Exp 0] 49 msec 5 10.3.0.2 [MPLS: Labels 603/710 Exp 0] 50 msec 6 10.0.2.1 [MPLS: Label 710 Exp 0] 27 msec 7 10.0.2.2 50 msec 8 192.168.2.2 49 msec R1#show ip route vrf Gold ospf | beg Ga Gateway of last resort is not set 10.0.0.0/30 is subnetted, 2 subnets O 10.0.1.0 [110/2] via 192.168.1.1, 01:56:49, GigabitEthernet0/0.10 O 10.0.2.0 [110/4] via 192.168.1.1, 00:16:46, GigabitEthernet0/0.10 192.168.2.0/30 is subnetted, 1 subnets O 192.168.2.0 [110/5] via 192.168.1.1, 00:16:46, GigabitEthernet0/0.10 192.168.3.0/30 is subnetted, 1 subnets O 192.168.3.0 [110/11] via 192.168.1.1, 00:47:05, GigabitEthernet0/0.10
How to change the cost of an OSPF sham link?
The cost of an OSPF sham link can be changed with the area 0 sham-link 10.33.33.33 10.77.77.77 cost 5 command issued on the PE router R3, under the OSPF routing process. This influences the cost of intra-area OSPF prefixes received on the CE router R2 (from the PE R3). The following output displays the updated cost on CE R2.
Note that as long as the cost of the sham link is more preferred (lower) than the cost of routes received through the backdoor link, it will make the MPLS L3VPN the primary path for site-to-site connectivity.
R2#show ip route vrf Gold ospf | beg Ga Gateway of last resort is not set 10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks O 10.0.2.0/30 [110/7] via 10.0.1.1, 00:01:33, GigabitEthernet0/1.10 192.168.2.0/30 is subnetted, 1 subnets O 192.168.2.0 [110/8] via 10.0.1.1, 00:01:33, GigabitEthernet0/1.10