OSPF Router ID

Each OSPF router selects a router ID (RID) that has to be unique on your network. OSPF stores the topology of the network in its LSDB (Link State Database) and each router is identified with its unique router ID , if you have duplicate router IDs then you will run into reachability issues.

Because of this, two OSPF routers with the same router ID will not become neighbors but you could still have duplicated router IDs in the network with routers that are not directly connected to each other.

OSPF uses the following criteria to select the router ID:

  1. Manual configuration of the router ID.
  2. Highest IP address on a loopback interface.
  3. Highest IP address on a non-loopback interface.

Let’s see this in action. I will use the following router for this demonstration:

Cisco Router OSPF 4 interfaces

There are two physical interfaces and two loopback interfaces. All interfaces are active:

R1#show ip interface brief
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0       YES manual up                    up
FastEthernet0/1      YES manual up                    up
Loopback0                 YES manual up                    up
Loopback1             YES manual up                    up

Let’s start an OSPF process:

R1(config)#router ospf 1

Now we can check what router ID it selected:

R1#show ip protocols | include Router ID
  Router ID

It selected which is the highest IP address on our loopback interfaces. Let’s get rid of the loopbacks now:

R1(config)#no interface loopback 0
R1(config)#no interface loopback 1

Take a look again at the router ID:

R1#show ip protocols | include Router ID
  Router ID

It’s still the same, this is because the router ID selection is only done once. You have to reset the OSPF process before it will select another one:

R1#clear ip ospf process
Reset ALL OSPF processes? [no]: yes

Let’s see if this makes any difference:

R1#show ip protocols | include Router ID
  Router ID

There we go, the router ID is now the highest IP address of our physical interfaces. If you want we can manually set the router ID. This will overrule everything:

We're Sorry, Full Content Access is for Members Only...

If you like to keep on reading, Become a Member Now! Here is why:

  • Learn any CCNA, CCNP and CCIE R&S Topic. Explained As Simple As Possible.
  • Try for Just $1. The Best Dollar You’ve Ever Spent on Your Cisco Career!
  • Full Access to our 791 Lessons. More Lessons Added Every Week!
  • Content created by Rene Molenaar (CCIE #41726)

1671 Sign Ups in the last 30 days

100% Satisfaction Guaranteed!
You may cancel your monthly membership at any time.
No Questions Asked!

Forum Replies

  1. Good Stuff.

  2. Thanks for streamline it.

  3. Renee

    Hope you are well - can you tell me please if I configure a router ID on my router in OSPF which i just did on one of the GNS3 Vault Labs … do I also have to specify that router ID or configure it also as a Loopback interface ? Anyway I just configured the router ID and it was preferred to the existing L0 address which I expected but not sure if it also needs to have its own address space on the router elsewhere ?



  4. Sorry forgot to tick the ‘please email me of notification’

  5. Renee

    Just wondering if you saw my post please as stuck on this issue ?



25 more replies! Ask a question or join the discussion by visiting our Community Forum