OSPF Router ID

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 (no router OSPF 1)
Or
3.when i remove the ip address from the interface (which is stored in OSPF database) then the valid RID is coming in OSPF database.

So I think you already replied previously but not getting clearly so can you plz explain me in detail?
I wiil wait for your reply… Yesterday I did spend 2 hrs in my lab to find out the cause but didn’t get…I tried with lab devices(Cisco 7201,MPC480,Cisco 3560) and GNS3 as well but same result.

Thanks & Regards,
Arindom
India

Hello Arindom.

I answered a similar question that you had in this thread. Please take a look :slight_smile:

I hope this has been helpful!

Laz

When configuring RID manually, do you have to do the clear ip ospf process for ospf take the changes ?

I don’t think that I saw it mentioned. The “ip ospf cost” value that you can place on the interface to help control the DR/BDR election.

Hi Juan,

That’s correct, you need to clear the ospf process before the new router ID works.

Rene

Hi Wes,

The DR/BDR election is based on the priority or router ID, in this order:

  1. Highest priority: default is 1, if you set it to 0 then the router won’t join the election.
  2. Highest router ID (if configured)
  3. Highest IP address on loopback interface (this becomes the router ID).
  4. Highest IP address on physical interface (this becomes the router ID).

Changing the cost of an interface only influences the metric, it won’t influence the DR/BDR election.

Rene

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.

I understand two ospf neighbors cannot have the same router-ID.But i dont understand how it would not create a prblem when they have same router-id but not directly connected , still existing in the same ospf domain. when the lsa’s are exchanged will that not create a problem ?

Hello Vijay

The router IDs of OSPF routers will be exchanged during the formation of OSPF neighbours. If during this exchange the router ID is the same between the two negotiating routers, the adjacency will not form and OSPF will not function correctly.

Now an OSPF adjacency will take place only between directly connected routers. Directly connected routers are those that have an interface within the same subnet. Routers that are connected to each other via a layer 2 switch are also considered directly connected because their interfaces are still on the same subnet.

So an adjacency will occur only between directly connected routers. If you have two routers that are not directly connected but in the same OSPF area (or even in different OSPF areas), you can indeed have two routers with the same router ID. Their router IDs will not be compared because they will never be neighbours.

As for the LSAs, these are exchanged only between neighbors. And since neighbours never have identical router IDs, there is no conflict. When a router receives an LSA, it does not relay it to other routers as is, but it creates its own to send out of its own interfaces with its own router ID.

In a nutshell, router IDs have only a limited scope, specifically, between neighbours themselves. The router IDs in each neigbour relationship do not extend beyond that to other OSPF routers.

I hope this has been helpful!

Laz

3 Likes

Got it. Thanks Laz.

That was clear

Hi everyone, I have a question on manually setting the RID. Is there a conflict if a RID Ip is being used somewhere else in the area? Or is it only locally significant to the neighbors?

Hello Mario

The Router ID of an OSPF router must be unique within an OSPF autonomous system, including all associated OSPF areas of that autonomous system (AS). This is described in RFC2328 as shown below:

Router ID
A 32-bit number assigned to each router running the OSPF
protocol. This number uniquely identifies the router within
an Autonomous System.

and

Router ID
A 32-bit number that uniquely identifies this router in the AS.
One possible implementation strategy would be to use the
smallest IP interface address belonging to the router. If a
router’s OSPF Router ID is changed, the router’s OSPF software
should be restarted before the new Router ID takes effect. In
this case the router should flush its self-originated LSAs from
the routing domain (see Section 14.1) before restarting, or they
will persist for up to MaxAge minutes.

Now, to your specific question. If you are manually configuring the RID, then that RID must be unique among the RIDs in the AS. You can actually configure an IP address of 192.168.1.5 on R1, and an OSPF RID on R2 of 192.168.1.5 as long as R1 doesn’t use that IP as an RID.

So RIDs must be unique among themselves, and IP addressing (obviously) must be unique among themselves. However, RIDs and IP addresses of interfaces do not have to be unique (unless you use those IP addresses as RIDs).

In any case, it’s always best practice to manually configure RIDs and use IP addresses that are completely different than those used for actual interfaces in order to avoid confusion, or misconfigurations.

I hope this has been helpful!

Laz

Hi Reene,

What happens when you a duplicate router id is detected in your OSPF network? let’s say one of my important DC router has router id - 1.1.1.1 & it has BGP running on the router? we setup a remote site in same area(area 0)? we saw an outage but I want to know whats the correct reason for outage?

Hello Sampath

The router ID in OSPF is used to identify routers in the OSPF database as well as to create OSPF neighbor adjacencies. If you have two routers with the same router ID in your OSPF domain, then this will result in unpredictable routing and almost certainly in intermittently unreachable networks.

Imagine you have a network where R1 and R2 are using the same router ID. When R3 receives OSPF packets from these two routers, it will interpret all the received information as coming from the same OSPF device. This can result in:

  1. R3 continually creating and tearing down neighbor adjacencies with R1 and R2 as it receives OSPF hello packets with the same router ID on two different interfaces.
  2. The routes learned by R3 from R1 and R2 are identified as routes coming from a single router, so the next hop IP will be incorrect for some of them.
  3. Router IDs are also used for virtual links, so having duplicate router IDs will cause this feature to fail.

I hope this has been helpful!

Laz

Hi…

You wrote the following

  • My question is where is the problem here because I didn’t get it?

  • I mean where is the problem of that the new highest Loopback IP address becoming the new Router-ID?

Thanks

Hello Ameen

The OSPF router ID is chosen based on the process described in this NetworkLessons note:
https://notes.networklessons.com/ospf-router-id

Now let’s say that you have configured your OSPF router with a loopback interface with an IPv4 address of 5.5.5.5, and that router has chosen the IP address of the loopback as the router ID.

Several months down the road, a new administrator was hired, and he decides to configure another feature on the router that requires the addition of a loopback interface. Let’s say he creates a new loopback with an IP address of 10.10.10.10. All of a sudden, OSPF will choose that as the new router ID. The OSPF topology will become unstable, and no one will know why. It’s not readily perceivable.

For this reason, it is best practice to use the router-id command in the OSPF router configuration mode to configure the router ID. That way, no changes to any loopback interfaces will cause disruptive changes.

I hope this has been helpful!

Laz

1 Like

Thank you so much for the explanation.

1 Like

What will happen if we configure the same Router IDs on an indirectly connected neighbor within an area? Do the link state ID and advertising Router IDs from LSAs not cause any issue? I tried this scenario by configuring R1 → R2 → R3 where the router IDs are same on R1 and R3. Initially, when the router IDs were different, I was able to ping the IP address of R3 from R1. From the debugs I could see the neighbors were in full adjacency. When the same router IDs were configured, R3 removed the route to R1. But after a while, the route randomly appeared again.

R3(config-router)#ri      
R3(config-router)#ro
R3(config-router)#router-id 1.1.1.1
R3(config-router)#netw
R3(config-router)#network 192.168.23.0 0.0.0.255 area 0
R3(config-router)#
*Aug 20 21:07:35.359: %OSPF-5-ADJCHG: Process 2, Nbr 192.168.23.2 on GigabitEthernet0/0 from LOADING to FULL, Loading Done

R3#sh ip route
Gateway of last resort is not set

      192.168.23.0/24 is variably subnetted, 2 subnets, 2 masks
C        192.168.23.0/24 is directly connected, GigabitEthernet0/0
L        192.168.23.3/32 is directly connected, GigabitEthernet0/0

R3#sh ip os
 Routing Process "ospf 1" with ID 1.1.1.1
 Start time: 00:00:08.960, Time elapsed: 00:15:08.932

R3#sh ip route
Gateway of last resort is not set

O     192.168.12.0/24 [110/2] via 192.168.23.2, 00:13:44, GigabitEthernet0/0
      192.168.23.0/24 is variably subnetted, 2 subnets, 2 masks
C        192.168.23.0/24 is directly connected, GigabitEthernet0/0
L        192.168.23.3/32 is directly connected, GigabitEthernet0/0
R3#ping 192.168.12.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.12.1, timeout is 2 seconds:
!!!!!

R1#ping 192.168.23.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.23.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 12/14/24 ms
R1#sh ip ospf
 Routing Process "ospf 1" with ID 1.1.1.1

I expected it get stuck in loading state when exchanging the LSAs as they might see same router IDs from different routers on the LSAs

Hello Gokul

If you have two routers with the same router ID that are directly connected, they will never become neighbors. However, as stated in the lesson, if you have two routers that are not directly connected in the same area, as in the example you described, then adjacencies will form. However, this situation is not ideal. You will see that the SPF algorithm will continually be run as OSPF will try to reconverge. This is because LSAs contain within their contents the router ID of the generating router. If that router ID appears in the OSPF database in multiple LSAs, this results in the SPF algorithm being run continuously which will in turn cause flapping OSPF routes.

Take a look at this Cisco documentation on troubleshooting duplicate OSPF router IDs in a topology for more information.

I hope this has been helpful!

Laz

Hello Guys,

I have an OSPF lab in PacketTracer. I first configured my neighbors without any Loopback. Then i configured a loopback and restarted the OSPF process but the RID is not changing. The only way to change the RID is to statically configure. Is that a normal behavior or a PacketTracer issue?

Thanks,

Hello David

That sounds interesting. I tried labbing this up in Packet Tracer and found the same issue. I’m using Packet Tracer Version 8.0.0.0212.

I also found that once the router chooses the router ID, it cannot be changed even if you do a clear ip ospf process. Even when I manually configured the router ID, and then removed it, the manually configured router ID remained.

From my experimentation, I found that in order for OSPF to change the router ID, you must either reload the router, or delete the OSPF configuration and reinstate it.

At first I believed this was a bug, but for completeness, I tried the same thing on Cisco CML. It had the same behavior! :open_mouth:

What I have found is this:

  1. When the router ID has been chosen as the IP address of a physical interface, even if you create a loopback interface and clear the OSPF process, the router ID will not change. You must either reboot the machine or delete and recreate the OSPF config.
  2. When the router ID has been chosen as the IP address of a loopback, even if you create a new loopback with a higher IP address, clearing the OSPF process will not change the router ID. The only way it will change is if you delete the loopback interface or change its IP address to something else.
  3. When creating, changing, or deleting a manually configured router ID, the router ID will change after clearing the OSPF process.

Notice that it is only when you create, change or delete the router ID that you get the following message from the console:

% OSPF: Reload or use "clear ip ospf process" command, for this to take effect

So it seems that packet tracer is recreating the behavior of OSPF router IDs correctly. This has been interesting, thanks for pointing this out!

I hope this has been helpful!

Laz

1 Like