OSPF in a VRF requires a box-unique router ID

It's obvious why two routers in the same OSPF domain cannot have the same router ID. But requiring unique router IDs on OSPF processes running in different VRFs is probably too harsh, although it does prevent confusion if two VRFs ever get connected through a customer site. Anyhow, if you have overlapping IP addresses on loopback interfaces in different VRFs, OSPF process might not start.

Here's a short example: two VRFs have loopback interfaces with the same IP address. Perfectly legal setup from the MPLS/VPN perspective.

c7200#show ip vrf interfaces
Interface    IP-Address   VRF            Protocol
Lo1003       10.0.0.1     EIGRP_OSPF     up
Lo1001       10.0.0.1     OSPF_1         up

However, when you try to configure the second OSPF process, it fails to start as it cannot get a box-unique router ID. You have to enter a different router ID manually.

c7200#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
c7200(config)#router ospf 1 vrf OSPF_1
c7200(config-router)#network 0.0.0.0 255.255.255.255 area 0
c7200(config-router)#exit
c7200(config)#router ospf 3 vrf EIGRP_OSPF
%OSPF-4-NORTRID: OSPF process 3 cannot pick a router-id.
  Please configure manually or bring up an interface with an ip address.
c7200(config-router)#router-id 10.0.0.2

4 comments:

  1. I might be wrong, but you need to configure a loopback interface for each VRF. Is not it?

    If a loopback interface is not a part of VRF; Is it correct we can configure that interface for VRF ospf process.

    ReplyDelete
  2. You don't need a loopback interface for a VRF. The only reason why you'd want one is the stability of the router ID ... which, BTW, is a moot issue if you have a single site connected to the VRF :)

    If the interface is not part of a VRF, it will never be used as the OSPF router ID (only interfaces within the VRF are considered when selecting the router ID), but you can manually configure any IP address as the router ID.

    ReplyDelete
  3. Hi Ivan , to get accurate statement and correct me if iam wrong , OSPF RID is selected from VRF interfaces except for Loopback which must be box unique even if its VRF interface

    ReplyDelete
  4. Hi, inevitable. You've mixed two independent operations in the same sentence :)

    Step 1: The candidate interface for OSPF RID is selected from all the applicable interfaces. In the OSPF-in-VRF case, the applicable interfaces are the VRF interfaces. Loopbacks are preferred. Among interfaces with the same preference, the one with the highest IP address is used (I need to turn this into a post :).

    Step 2: the selected IP address is used as OSPF RID. The OSPF RID has to be unique among all OSPF RIDs running on the same box (even if they are in different VRFs) ... which might not be the case if two VRFs have a loopback interface with the same IP address.

    ReplyDelete

You don't have to log in to post a comment, but please do provide your real name/URL. Anonymous comments might get deleted.

Ivan Pepelnjak, CCIE#1354, is the chief technology advisor for NIL Data Communications. He has been designing and implementing large-scale data communications networks as well as teaching and writing books about advanced technologies since 1990. See his full profile, contact him or follow @ioshints on Twitter.