26 Jun

MPLS workshop #4 – CE-PE connection using OSPF

In previous example a CE-PE routing protocol was BGP, but it’s not only option. We can also use IGP protocols like OSPF. We use this protocol for customers in VRF_A. On PE router OSPF is redistributed to iBGP and vice versa, otherwise vpnv4 routes won’t be propagated through MPLS domain. MPLS VPN area is usually referred as super backbone and PE routers are ASR routers.

Because of redistribution in normal OSPF operation those routes would be treated as external routes (LSA Type 5) when redistributed back to OSPF. PE router is treated as ASBR. When redistributing from MP-BGP back to OSPF those routes are marked as inter-area routes (LSA Type 3), even if the area numbers on both ends does not match. However if customer network has more than one area PE routers must be in area 0 or virtual-link between PE router and nearest ABR must be configured.


On CE routers configuration is simple. We use different area numbers on each end.

R2

interface Loopback0
 ip address 10.0.0.2 255.255.255.255
 ip ospf 1 area 1
!
nterface Ethernet0/1
 ip address 10.0.23.2 255.255.255.0
 ip ospf 1 area 1
!
router ospf 1
 log-adjacency-changes

R7

interface Loopback0
 ip address 10.0.0.7 255.255.255.255
 ip ospf 1 area 0
!
interface Ethernet0/1
 ip address 10.0.78.7 255.255.255.0
 ip ospf 1 area 0
!
router ospf 1
 log-adjacency-changes

PE route can run one OSPF process per VRF. Also redistribution between BGP and OSPF needs to be configured. You can control which type of LSA are redistributed into BGP. PE router also uses OSPF metric to set BGP MED attribute. It’s used in BGP path selection when two or more BGP routers advertise same prefix. While redistributing back to OSPF the BGP MED is set back as OSPF metric. It can be overridden during redistribution using metric keyword or by default-metric under OSPF process. Other BGP extended attributes are used to carry OSPF characteristics.

R3

router ospf 1 vrf VRF_A
 router-id 10.0.0.3
 log-adjacency-changes
 redistribute bgp 65111 subnets
 network 10.0.23.0 0.0.0.255 area 1
!
router bgp 65111
!
 address-family ipv4 vrf VRF_A
  no synchronization
  redistribute ospf 1 vrf VRF_A match internal external 1 external 2
 exit-address-family

R8

router ospf 1 vrf VRF_A
 router-id 10.0.0.8
 log-adjacency-changes
 redistribute bgp 65111 subnets
!
router bgp 65111
!
 address-family ipv4 vrf VRF_A
  no synchronization
  redistribute ospf 1 vrf VRF_A match internal external 1 external 2
 exit-address-family

While redistributing from BGP we have to remember to use keyword subnets otherwise only classful networks will be redistributed. While redistributing from OSPF we have to match appropriate LSA types.

We can check if the routes are properly propagated on CE router. We can see them as an OSPF inter area links with different metrics for loopback interface and CE-PE router.

R7#show ip route ospf 
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, + - replicated route

Gateway of last resort is not set

      10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
O IA     10.0.0.2/32 [110/21] via 10.0.78.8, 00:04:29, Ethernet0/1
O IA     10.0.23.0/24 [110/11] via 10.0.78.8, 00:04:29, Ethernet0/1

On PE router we can see how OSPF metrics are propagated using BGP extended communities

R8#show ip bgp vpnv4 vrf VRF_A 10.0.0.7/32
BGP routing table entry for 65000:1:10.0.0.7/32, version 39
Paths: (1 available, best #1, table VRF_A)
  Advertised to update-groups:
     2         
  Local
    10.0.78.7 from 0.0.0.0 (10.0.0.8)
      Origin incomplete, metric 11, localpref 100, weight 32768, valid, sourced, best
      Extended Community: RT:65000:1 OSPF DOMAIN ID:0x0005:0x000000010200 
        OSPF RT:0.0.0.0:2:0 OSPF ROUTER ID:10.0.0.8:64949
      mpls labels in/out 27/nolabel

Leave a Reply

%d bloggers like this: