OSPF router-id does not change when the interface IP address changes

The rules used to establish OSPF router ID on Cisco IOS are well known:

  • Take the highest IP address of all loopback interfaces configured on the router when the OSPF process is started.
  • If there is no loopback interface, take the highest IP address of an operating interface.
In the old days, when Cisco believed that the router ID had to match an interface address, this also implied that the router ID would have changed if the interface IP address changed (and we told the students that you have to use loopback interfaces to make your network stable, as the OSPF process would restart if the interface giving the router ID went down).

Most of these “wisdoms” are no longer true. For recent releases of Cisco IOS, OSPF router ID is a 32-bit value that has to be unique (that's all that the OSPF RFC ever asked for) and just happens to be taken from an interface address at the time the OSPF process is started. Even more, you can configure it to any value you like with the router-id A.B.C.D router configuration command.

The new behavior, while definitely making your network more stable, can also bring unexpected side effects: if you don't use the router-id command and misconfigure an interface IP address (resulting in duplicate router IDs), correcting the interface IP address will not fix the problem. You also have to reset the OSPF process with the clear ip ospf pid process command.

3 comments:

  1. I happened to be messing with an OSPF lab today, so I decided to experiment per your post. However, I noticed that the router ID doesn't change even after 'clear ip ospf [process_id] process'.

    Neighbors still report the original ID, as does 'show ip ospf'.

    This was observed on a 3725 running 12.2(15)T14 and a 3560G running 12.2(25r)SE1, so the change may only apply in more recent code.

    ReplyDelete
  2. I did test on 6500 with 12.2(18)SXF.
    If router id is derived from interface IP address, than change of interface ip address or interface shutdown and clear ip ospf process command does not change router id. If router id is derived from router-id command, than change of router-id command and clear ip ospf process will change router-id. Thank for hint!

    ReplyDelete
  3. >:o :) :'( 8-) :* :-D =-O =-X :-P :-E :-$ :-P :-E *DONT_KNOW* =-X *DONT_KNOW* *DONT_KNOW* :-E =-O =-O

    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.