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            192.168.1.1     YES manual up                    up
FastEthernet0/1            192.168.11.1    YES manual up                    up
Loopback0                  1.1.1.1         YES manual up                    up
Loopback1                  11.11.11.11     YES manual up                    up

Let’s start an OSPF process:

R1(config)#router ospf 1
R1(config-router)#exit

Now we can check what router ID it selected:

R1#show ip protocols | include Router ID
  Router ID 11.11.11.11

It selected 11.11.11.11 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 11.11.11.11

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 192.168.11.1

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 662 Lessons. More Lessons Added Every Week!
  • Content created by Rene Molenaar (CCIE #41726)

519 Sign Ups in the last 30 days

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

Forum Replies

  1. Renee

    Hoe gaat het in Nederland meneer

    I have a question please on the use of the router ID - the question is this … when I DO NOT configure a router ID on my OSPF routers in my lab network BUT I AM using Loopback interfaces (and as expected given OSPF rules) my single Loopback interface(s) (with Loopback 0 only configured per router) … will be used as the router ID … so no problem there … however when I configure a unique and different router ID, i.e. NOT my loopback interface 0 … as my router ID this will become my dominant ‘neigbor ID’ presumably when formin

    ... Continue reading in our forum

  2. William,
    It is considered best practice always to set the OSPF router-id manually, whether you happen to have a loopback or not. The reason for this is because there are certain OSPF functions that will break should the Router-ID ever change (an OSPF virtual link is a great example of this). If you rely on OSPF automatically choosing its Router-ID based on a loopback you have configured, this is no guarantee that the Router-ID wouldn’t change later (for example, you later needed another loopback for some other purpose, and this new loopback had a higher IP ad

    ... Continue reading in our forum

  3. Hi willam,
    Same thing I am getting in my lab devices when I am trying to change the RID based on automatically thumbrule of RID selection which Rene mentioned in lesson,

    Highest IP address on a non-loopback interface.
    Non loopback means physical interface

    Why it’s not effecting in OSPF database?
    I tried with ip OSPF process and ip OSPF process id process but same result,it’s effecting when I am trying to do follow below mention 3 steps,
    1.when I rebooting the Router .
    Or
    2.when i remove the ip address from the interface (which is stored in OSPF database) then

    ... Continue reading in our forum

  4. Hi willam,
    Same thing I am getting in my lab devices when I am trying to change the RID based on automatically thumbrule of RID selection which Rene mentioned in lesson,

    Highest IP address on a non-loopback interface.
    Non loopback means physical interface

    Why it’s not effecting in OSPF database?
    I tried with ip OSPF process and ip OSPF process id process but same result,it’s effecting when I am trying to do follow below mention 3 steps,
    1.when I rebooting the Router .
    Or
    2.when i remove the ip address from the interface (which is stored in OSPF database) then t

    ... Continue reading in our forum

  5. Hi Andrew,
    sorry wrongly i typed “Hi William,”:grinning: So Andrew Same thing I am getting in my lab devices when I am trying to change the RID based on automatically thumbrule of RID selection which Rene mentioned in lesson,

    Highest IP address on a non-loopback interface.
    Non loopback means physical interface

    Why it’s not effecting in OSPF database?
    I tried with ip OSPF process and ip OSPF process id process but same result,it’s effecting when I am trying to do follow below mention 3 steps,
    1.when I rebooting the Router .
    Or
    2. when I removing the OSPF configuration (n

    ... Continue reading in our forum

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