Tuesday, December 22, 2015

OSPF SHAM Link

OSPF SHAM link Config



In MPLS if the OSPF domain-ids are same the route will be seen as interarea route.


After changing the domain-id on the provider PE routers the route will be shown as E2






After enabling the ospf configuration on the interface connected between the two customer routers, all the route started learning from the link in between them, earlier which were learned over the MPLS network.




So for this to work as it was earlier we need to create a Sham-Link between the Provider edge routers. We have to create another loopback interface and introduce it on the vrf of the customer. *Loopback should be of any other subnet.
Second we need to advertise this IP on the correct address-family in the vrf.

R2(config-router)#int lo1
R2(config-if)#ip vrf forwarding CUST1
R2(config-if)#ip add 22.22.22.22 255.255.255.255
R2(config-if)#router bgp 234
R2(config-router)#address-family ipv4 vrf CUST1
R2(config-router-af)#network 22.22.22.22 mask 255.255.255.255



R4(config-router)#int lo1

R2(config-if)#ip vrf forwarding CUST1
R4(config-if)#ip add 44.44.44.44 255.255.255.255
R4(config-if)#router bgp 234
R4(config-router)#address-family ipv4 vrf CUST1
R4(config-router-af)#network 44.44.44.44 mask 255.255.255.255


Advertise the new loopback IP's into the vrf
R2(config-if)#router bgp 234
R2(config-router)#address-family ipv4 vrf CUST1
R2(config-router-af)#network 22.22.22.22 mask 255.255.255.255

R4(config-if)#router bgp 234
R4(config-router)#address-family ipv4 vrf CUST1
R4(config-router-af)#network 44.44.44.44 mask 255.255.255.255


Third we need to configure the Sham-Link, on the vrf
R4(config)#router ospf 12 vrf CUST1
R4(config-router)#area 0 sham-link 44.44.44.44 22.22.22.22 cost 1

R2(config-if)#router ospf 12 vrf CUST1
R2(config-router)#area 0 sham-link 22.22.22.22 44.44.44.44 cost 1

*Mar  1 01:26:16.015: %OSPF-5-ADJCHG: Process 12, Nbr 45.1.1.4 on OSPF_SL0 from LOADING to FULL, Loading Done

R2(config-if)#do show ip ospf nei
Neighbor ID     Pri   State           Dead Time   Address         Interface
3.3.3.3           1   FULL/BDR        00:00:37    23.1.1.3        FastEthernet0/1
45.1.1.4          0   FULL/  -           -        44.44.44.44     OSPF_SL0
12.1.1.1          1   FULL/BDR        00:00:36    12.1.1.1        FastEthernet0/0



Result as expected the route learned is now intra-area route. Sometime you have to increase the ospf cost on the link which is connected between the customer links back-to-back.




Config R2:

ip vrf CUST1
 rd 1:5
 route-target export 1:5
 route-target import 1:5
!
interface Loopback0
 ip address 2.2.2.2 255.255.255.0
 ip ospf network point-to-point
!
interface Loopback1
 ip vrf forwarding CUST1
 ip address 22.22.22.22 255.255.255.255
!
interface FastEthernet0/0
 ip vrf forwarding CUST1
 ip address 12.1.1.2 255.255.255.0
 duplex auto
 speed auto
!
interface FastEthernet0/1
 ip address 23.1.1.2 255.255.255.0
 duplex auto
 speed auto
 mpls ip
!
router ospf 12 vrf CUST1
 domain-id 0.0.0.2
 log-adjacency-changes
 area 0 sham-link 22.22.22.22 44.44.44.44
 redistribute bgp 234 subnets
 network 12.1.1.0 0.0.0.255 area 0
!
router ospf 10
 log-adjacency-changes
 network 2.2.2.0 0.0.0.255 area 0
 network 23.1.1.0 0.0.0.255 area 0
!
router bgp 234
 no bgp default ipv4-unicast
 bgp log-neighbor-changes
 neighbor 4.4.4.4 remote-as 234
 neighbor 4.4.4.4 update-source Loopback0
 !
 address-family vpnv4
  neighbor 4.4.4.4 activate
  neighbor 4.4.4.4 send-community both
 exit-address-family
 !
 address-family ipv4 vrf CUST1
  redistribute ospf 12 vrf CUST1
  no synchronization
  network 22.22.22.22 mask 255.255.255.255
 exit-address-family

Config R4:
ip vrf CUST1
 rd 1:5
 route-target export 1:5
 route-target import 1:5
!

interface Loopback0
 ip address 4.4.4.4 255.255.255.0
 ip ospf network point-to-point
!
interface Loopback1
 ip vrf forwarding CUST1
 ip address 44.44.44.44 255.255.255.255
!
interface FastEthernet0/0
 ip address 34.1.1.4 255.255.255.0
 duplex auto
 speed auto
 mpls ip
!
interface FastEthernet0/1
 ip vrf forwarding CUST1
 ip address 45.1.1.4 255.255.255.0
 duplex auto
 speed auto
!
router ospf 12 vrf CUST1
 domain-id 0.0.0.4
 log-adjacency-changes
 area 0 sham-link 44.44.44.44 22.22.22.22
 redistribute bgp 234 subnets
 network 45.1.1.0 0.0.0.255 area 0
!
router ospf 10
 log-adjacency-changes
 network 4.4.4.0 0.0.0.255 area 0
 network 34.1.1.0 0.0.0.255 area 0
!
router bgp 234
 no bgp default ipv4-unicast
 bgp log-neighbor-changes
 neighbor 2.2.2.2 remote-as 234
 neighbor 2.2.2.2 update-source Loopback0
 !
 address-family vpnv4
  neighbor 2.2.2.2 activate
  neighbor 2.2.2.2 send-community both
 exit-address-family
 !
 address-family ipv4 vrf CUST1
  redistribute ospf 12 vrf CUST1
  no synchronization
  network 44.44.44.44 mask 255.255.255.255
 exit-address-family
!
Config R3:

interface Loopback0
 ip address 3.3.3.3 255.255.255.0
 ip ospf network point-to-point
!
interface FastEthernet0/0
 ip address 23.1.1.3 255.255.255.0
 duplex auto
 speed auto
 mpls ip
!
interface FastEthernet0/1
 ip address 34.1.1.3 255.255.255.0
 duplex auto
 speed auto
 mpls ip
!
router ospf 10
 log-adjacency-changes
 network 0.0.0.0 255.255.255.255 area 0
!
Customer Site Config

Config R1:
interface Loopback0
 ip address 1.1.1.1 255.255.255.0
!
interface FastEthernet0/0
 ip address 12.1.1.1 255.255.255.0
 duplex auto
 speed auto
!
interface FastEthernet0/1
 ip address 15.1.1.1 255.255.255.0
 ip ospf cost 65535
 duplex auto
 speed auto
!
router ospf 12
 log-adjacency-changes
 network 0.0.0.0 255.255.255.255 area 0

Config R5:
interface Loopback0
 ip address 5.5.5.5 255.255.255.0
!
interface FastEthernet0/0
 ip address 45.1.1.5 255.255.255.0
 duplex auto
 speed auto
!
interface FastEthernet0/1
 ip address 15.1.1.5 255.255.255.0
 ip ospf cost 65535
 duplex auto
 speed auto
!
router ospf 12
 log-adjacency-changes
 network 0.0.0.0 255.255.255.255 area 0

No comments:

Post a Comment