OSPF Router ID selection trivia

True or false: If you have an (enabled) loopback interface configured on the router, its IP address will always be used as the OSPF router ID.

Answer: False. Each OSPF process running on the router needs a unique Router ID. If you have a single loopback interface and two OSPF processes, the second OSPF process is forced to select another interface address as its router ID.

Here is a sample router printout:

Test#show running | inc ^interface|^ ip address
interface Loopback0
 ip address 10.0.0.1 255.255.255.255
interface FastEthernet0/0
 ip address 10.1.0.1 255.255.255.0
Test#show ip ospf | inc Routing Process
 Routing Process "ospf 2" with ID 10.1.0.1
 Routing Process "ospf 1" with ID 10.0.0.1

7 comments:

Arturo Servin said...

You also have a nice explanation here:

http://blog.ioshints.info/2007/10/ospf-router-id-does-not-change-when.html


-as

ktn-zoidberg said...

In case of single OSPF process when you configure Loopback after OSPF, OSPF will use IP from any "live" interface.

Inevitable said...

now i got ur point , thanks Ivan -:)

shivlu jain said...

thanks ivan for great input.

regards
shivlu jain

vhor said...

selection of router-id for single ospf process:
1) router-id command
2) ip address of loopback interface (higher address in case of more that one loopback)
3) ip address of interface wiht higher ip address

Jeff said...

Does the router ID have to be an IP that's assigned to an interface? If we used 1.1.1.1 does there have to be an interface with that IP assigned to it?

Ivan Pepelnjak said...

No, the OSPF router-ID is a 32-bit quantity that has to be unique throughout the OSPF domain. Cisco has long tied it to an active interface, but you can configure it manually with the "router-id" configuration command.

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.