What happens if router ID is duplicated?

In OSPF, each router is identified by router ID. Router IDs must not be duplicated. If the router ID is derived from the IPv4 address determined by default, there is little worry about duplicate router IDs. When configuring the router ID manually, be careful not to duplicate it.

In this section, we will explain what would happen if router IDs were duplicated. If you know the situation of duplicate router IDs, you will be able to quickly deal with the situation if you accidentally configure a duplicate router ID. Let’s try to duplicate router IDs on Cisco routers for the following cases.

  • Duplicate router IDs on the same network
  • Router ID duplicated in the same area
  • Router ID duplicated in another area

OSPF cannot be processed without being assigned a router ID in the first place.

Before considering the case of duplicate router IDs, it is also important to know that OSPF cannot be processed without a router ID being assigned in the first place. If you try to enable the OSPF process when there is no active interface, you will get the following error message

*Mar  1 00:01:05.715: %OSPF-4-NORTRID: OSPF process 1 failed to allocate unique router-id and cannot start

Network diagram

Duplicate the OSPF router ID in the following simple network diagram.

Configure for proper OSPF

The following is an excerpt of the configuration regarding OSPF for R1 to R4.

R1

interface FastEthernet0/0
 ip address 192.168.12.1 255.255.255.0
!
interface FastEthernet0/1
 ip address 192.168.1.1 255.255.255.0
!
router ospf 1
 router-id 1.1.1.1
 log-adjacency-changes
 network 192.168.0.0 0.0.255.255 area 0

R2

interface FastEthernet0/0
 ip address 192.168.12.2 255.255.255.0
!
interface FastEthernet0/1
 ip address 192.168.23.2 255.255.255.0
!
router ospf 1
 router-id 2.2.2.2
 log-adjacency-changes
 network 192.168.0.0 0.0.255.255 area 0

R3

interface FastEthernet0/0
 ip address 192.168.23.3 255.255.255.0
!
interface FastEthernet0/1
 ip address 192.168.34.3 255.255.255.0
!
router ospf 1
 router-id 3.3.3.3
 log-adjacency-changes
 network 192.168.23.0 0.0.0.255 area 0
 network 192.168.34.0 0.0.0.255 area 1

R4

interface FastEthernet0/0
 ip address 192.168.34.4 255.255.255.0
!
interface FastEthernet0/1
 ip address 192.168.4.4 255.255.255.0
!
router ospf 1
 router-id 4.4.4.4
 log-adjacency-changes
 network 192.168.0.0 0.0.255.255 area 1

Duplicate router IDs on the same network

cChange the router ID of R2, which is connected to the same network as R1, from 2.2.2.2 to 1.1.1.1.

R2

router ospf 1
 router-id 1.1.1.1

Restart the OSPF process with the clear ip ospf process command once to reflect the router ID configuration.

If the router IDs of R1 and R2 are duplicated, the following error message will be displayed immediately.

*Mar  1 00:40:33.911: %OSPF-4-DUP_RTRID_NBR: OSPF detected duplicate router-id 1.1.1.1 from 192.168.12.2 on interface FastEthernet0/0

Hello packets are exchanged with OSPF routers on the same network. Therefore, it is easy to find out if the router ID has been duplicated.

Change the router ID of R2 back to the original 2.2.2.2.

R2

router ospf 1
 router-id 2.2.2.2

Router ID duplicated in the same area

Next, let’s look at the case of duplicate router IDs in the same area: change the router ID of R3 in area 0 from 3.3.3.3 to 1.1.1.1, the same as R1.

R3

router ospf 1
 router-id 1.1.1.1

Restart the OSPF process with the clear ip ospf process command once to reflect the router ID configuration.

If Hello packets are not exchanged directly, it will take some time to detect that the router IDs have been duplicated. If a router ID is duplicated in the same area, the LSA Type1 of that router ID will be flapped. When LSA Type 1 flapping occurs, the Sequence number will increase rapidly. If the flapping is repeated several times, it will detect that the router ID has been duplicated.

When you look at the show ip ospf database command on R1, each time you look at it, the LSA Type1 Age of the duplicate router ID is refreshed and the Seq# is increased.

R1

R1#show ip ospf database

            OSPF Router with ID (1.1.1.1) (Process ID 1)

                Router Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum Link count
1.1.1.1         1.1.1.1         2           0x8000005B 0x00A8AD 2
2.2.2.2         2.2.2.2         370         0x80000003 0x006BA0 2

                Net Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum
192.168.12.1    1.1.1.1         7           0x80000057 0x001B42
192.168.23.2    2.2.2.2         370         0x80000001 0x00168D

                Summary Net Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum
192.168.34.0    1.1.1.1         3601        0x8000004E 0x00A7B8
R1#show ip ospf database

            OSPF Router with ID (1.1.1.1) (Process ID 1)

                Router Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum Link count
1.1.1.1         1.1.1.1         1           0x8000005F 0x00A0B1 2
2.2.2.2         2.2.2.2         388         0x80000003 0x006BA0 2

                Net Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum
192.168.12.1    1.1.1.1         6           0x8000005B 0x001346
192.168.23.2    2.2.2.2         388         0x80000001 0x00168D

                Summary Net Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum
192.168.34.0    1.1.1.1         3600        0x80000052 0x009FBC

Then, after a while, you will get an error message that there is a router with a duplicate router ID in the area, as shown below.

*Mar  1 00:49:10.435: %OSPF-4-DUP_RTRID_AREA: Detected router with duplicate router ID 1.1.1.1 in area 0

Change the router ID of R3 back to the original 3.3.3.3.

R3

router ospf 1
 router-id 3.3.3.3

Router ID duplicated in another area

The last case is when the router ID has been duplicated in another area. On R4 in area 1, change the router ID to 1.1.1.1, the same as R1.

R4

router ospf 1
 router-id 1.1.1.1

Restart the OSPF process with the clear ip ospf process command once to reflect the router ID configuration.

Even if the router ID is duplicated in other areas, it will not cause any problems. This is because it is not necessary to know the detailed network diagram outside the area. Therefore, even if there are routers with duplicate router IDs in other areas, they cannot be detected. And even if there are routers with duplicate router IDs in other areas, it will not affect the SPF calculation.

If you look at the show ip ospf database command or the routing table on R1, there is no problem, just as there is no duplicate router ID.

R1

R1#show ip ospf database

            OSPF Router with ID (1.1.1.1) (Process ID 1)

                Router Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum Link count
1.1.1.1         1.1.1.1         227         0x800000F9 0x006B4C 2
2.2.2.2         2.2.2.2         1349        0x80000003 0x006BA0 2
3.3.3.3         3.3.3.3         188         0x80000002 0x009F6A 1

                Net Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum
192.168.12.1    1.1.1.1         232         0x800000F5 0x00DDE0
192.168.23.2    2.2.2.2         187         0x80000002 0x007822

                Summary Net Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum
192.168.4.0     3.3.3.3         29          0x80000001 0x001A95
192.168.34.0    3.3.3.3         29          0x80000001 0x006A31
R1#show ip route ospf
O IA 192.168.4.0/24 [110/40] via 192.168.12.2, 00:00:31, FastEthernet0/0
O    192.168.23.0/24 [110/20] via 192.168.12.2, 00:22:28, FastEthernet0/0
O IA 192.168.34.0/24 [110/30] via 192.168.12.2, 00:00:31, FastEthernet0/0

It doesn’t matter if there is a router with a duplicate router ID in another area. But even if the area is different, be careful not to duplicate OSPF router IDs. The purpose of the router ID is to identify the OSPF router. Configuring duplicate router IDs is undesirable, even if it does not cause any problems.

Change the router ID of R4 back to the original 4.4.4.4.

R4

router ospf 1
 router-id 4.4.4.4

Summary

Point

  • The router ID identifies the OSPF router. Therefore, be careful not to duplicate, especially when configuring manually.
  • If router IDs are duplicated…
    • Same Network: Can be detected immediately.
    • In the same area: LSA Type 1 with duplicate router IDs is flapping.
    • Other areas: No problem, but duplicate router IDs should be avoided.

How the OSPF works