What is OSPF sham link?
It is similar to virtual link, it is a multi-hop unicast adjacency which is used for traffic engineering purposes.
Why is it needed?
It is needed when there is MPLS L3-VPN using OSPF between PE-CE in two customers’ sites and there is also a backbone link between these two sites.
By default, OSPF prefers Intra routes over Inter over External over NSSA routes regardless of metrics.
So when a CE router, receives OSPF route from a PE, this route is considered as Inter area route because of the behavior of OSPF superbackbone of MPLS cloud, as long as the OSPF domain-id are same for both sites in BGP VPNVv4 route. If domain-id doesn’t match, the route will be external route.
So in both cases the backbone link will be preferred as the route will be intra route. In order to have the ability to prefer the MPLS cloud, we must first convert the routes coming from the MPLS cloud to be intra routes as same as the backbone link. This is what the sham link does, it extends area 0 so that PE routers will be acting as internal routers not ABR or ASBR.
Then we can increase the cost of the backbone link to prefer the MPLS cloud.
Let us check the routing table of R1 before configuring sham link.
R1#sh ip route ospf
Gateway of last resort is not set
7.0.0.0/32 is subnetted, 1 subnets
O 7.7.7.7 [110/2] via 10.1.7.7, 00:43:25, FastEthernet0/0
10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
O 10.1.67.0/24 [110/2] via 10.1.7.7, 00:43:25, FastEthernet0/0
———————————————————
Site 2 routes are received as intra route from R7 through the backbone link.
Let us first shut down the backbone link and check the routes coming from the MPLS cloud. They should be Inter route LSA-type 3.
R1(config)#int fa0/0
R1(config-if)#shut
R1#sh ip route ospf
Gateway of last resort is not set
7.0.0.0/32 is subnetted, 1 subnets
O IA 7.7.7.7 [110/3] via 10.1.2.2, 00:00:20, FastEthernet0/1
10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
O IA 10.1.7.0/24 [110/1002] via 10.1.2.2, 00:00:20, FastEthernet0/1
O IA 10.1.67.0/24 [110/2] via 10.1.2.2, 00:00:21, FastEthernet0/1
————————————————————————————
It is received from R2-PE-1 as Inter route, because the domain-ids are same for both sites in BGP VPNv4 routes.
R2_PE-1#sh bgp vpnv4 uni all 7.7.7.7/32
BGP routing table entry for 17:17:7.7.7.7/32, version 37
Paths: (1 available, best #1, table Cust_A, RIB-failure(17) – next-hop mismatch)
Not advertised to any peer
Local
6.6.6.6 (metric 5) from 6.6.6.6 (6.6.6.6)
Origin incomplete, metric 2, localpref 100, valid, internal, best
Extended Community: RT:17:17 OSPF DOMAIN ID:0x0005:0x000000110200
OSPF RT:0.0.0.0:2:0 OSPF ROUTER ID:10.1.67.6:0
mpls labels in/out 30/24
—————————-
R6_PE-2#sh bgp vpnv4 uni all 7.7.7.7/32
BGP routing table entry for 17:17:7.7.7.7/32, version 12
Paths: (1 available, best #1, table Cust_A)
Advertised to update-groups:
2
Local
10.1.67.7 from 0.0.0.0 (6.6.6.6)
Origin incomplete, metric 2, localpref 100, weight 32768, valid, sourced, best
Extended Community: RT:17:17 OSPF DOMAIN ID:0x0005:0x000000110200
OSPF RT:0.0.0.0:2:0 OSPF ROUTER ID:10.1.67.6:0
mpls labels in/out 24/nolabel
———————————————————————————-
Then configure Sham link between R2-PE-1 and R6-PE-2:
To do so, we need a /32 IP (loopback) to be advertised through BGP address family vrf.
On R2-PE-1:
interface Loopback1
vrf forwarding Cust_A
ip address 22.22.22.22 255.255.255.255
router bgp 100
address-family ipv4 vrf Cust_A
net 22.22.22.22 mask 255.255.255.255
router ospf 17 vrf Cust_A
area 0 sham-link 22.22.22.22 66.66.66.66
————————————————————
On R6-PE-2:
interface Loopback1
vrf forwarding Cust_A
ip address 66.66.66.66 255.255.255.255
router bgp 100
address-family ipv4 vrf Cust_A
net 66.66.66.66 mask 255.255.255.255
router ospf 17 vrf Cust_A
area 0 sham-link 66.66.66.66 22.22.22.22
————————————————————
R2_PE-1#sh ip ospf nei
Neighbor ID Pri State Dead Time Address Interface
3.3.3.3 1 FULL/BDR 00:00:35 4.4.23.3 GigabitEthernet1/0
10.1.67.6 0 FULL/ – 00:00:06 66.66.66.66 OSPF_SL0
1.1.1.1 1 FULL/DR 00:00:30 10.1.2.1 FastEthernet0/0
R2_PE-1#
———————————————————–
There is a direct neighbor between the PE routers, this extends area 0 and make PE routers appears as if they are internal routers inside area 0 and not ABR or ASBR.
Does this mean that we should receive intra routes from MPLS cloud now? Let’s check the routing table of R1.
Remember backbone link is still down.
R1#sh ip route ospf
Gateway of last resort is not set
7.0.0.0/32 is subnetted, 1 subnets
O 7.7.7.7 [110/4] via 10.1.2.2, 00:03:39, FastEthernet0/1
10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
O 10.1.7.0/24 [110/1003] via 10.1.2.2, 00:03:39, FastEthernet0/1
O 10.1.67.0/24 [110/3] via 10.1.2.2, 00:03:39, FastEthernet0/1
22.0.0.0/32 is subnetted, 1 subnets
O E2 22.22.22.22 [110/1] via 10.1.2.2, 00:07:03, FastEthernet0/1
66.0.0.0/32 is subnetted, 1 subnets
O E2 66.66.66.66 [110/1] via 10.1.2.2, 00:03:47, FastEthernet0/1
R1#
—————————————————-
R1 is receiving Site 2 routes as intra routes coming from MPLS cloud.
Let us open the backbone link and increase the cost to make sure that MPLS cloud will be always preferred.
On R1:
int fa0/0
no shut
ip ospf cost 1000
———————–
Also on R7:
interface FastEthernet1/0
ip ospf cost 1000
————————-
Check R1 routing table after opening the backbone and increasing its cost.
R1#sh ip route ospf
Gateway of last resort is not set
7.0.0.0/32 is subnetted, 1 subnets
O 7.7.7.7 [110/4] via 10.1.2.2, 00:01:21, FastEthernet0/1
10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
O 10.1.67.0/24 [110/3] via 10.1.2.2, 00:01:21, FastEthernet0/1
22.0.0.0/32 is subnetted, 1 subnets
O E2 22.22.22.22 [110/1] via 10.1.2.2, 00:11:50, FastEthernet0/1
66.0.0.0/32 is subnetted, 1 subnets
O E2 66.66.66.66 [110/1] via 10.1.2.2, 00:01:27, FastEthernet0/1
——————–
R1 still prefers MPLS cloud and backbone link will be backup.