This document describes how a router that runs Open Shortest Path First (OSPF) selects a router ID, in what packets this value is sent, and how to troubleshoot router log messages that report duplicate IDs.

The information in this document is based on the Cisco IOS® Software Release 12.2.

The information in this document was created from the devices in a specific lab environment. All of the devices used in this document started with a cleared (default) configuration. If your network is live, make sure that you understand the potential impact of any command.

By default, when the OSPF process initializes, it selects the highest IP address on a router as the router ID for the OSPF process. The router ID uniquely identifies a router within an OSPF domain.

As explained in Configuring OSPF, OSPF uses the largest IP address configured on the interfaces as its router ID. If the interface associated with this IP address is ever brought down, or if the address is removed, the OSPF process must recalculate a new router ID and resend all its routing information out its interfaces.

If a loopback interface is configured with an IP address, the Cisco IOS software uses this IP address as its router ID, even if other interfaces have larger IP addresses. Greater stability in the routing table is achieved, because loopback interfaces never go down.

OSPF automatically prefers a loopback interface over any other kind, and it chooses the highest IP address among all loopback interfaces. If there are no loopback interfaces present, the highest IP address in the router is chosen. The OSPF cannot be directed to use any particular interface. Once the router ID is elected, it does not change unless the OSPF process restarts or the router is reloaded.

Note: If there is not an interface with a valid IP address in an up/up state when it starts, OSPF reports can't allocate router-id error messages to the log.

The default behavior of the selection of the highest IP address on a router as the router ID can be changed with the use of the router-id OSPF command introduced in Cisco IOS Software Release 12.0(1)T. Refer to Cisco bug ID CSCdi38380 (registered customers only) for more information. With the OSPF router-id command, the router ID of the OSPF process is the one manually selected. In this example, the router ID for the OSPF process is 10.10.10.10.

Before the resolution of the duplicate router IDs with OSPF can be explained, you need to understand the five OSPF packet types. These are the packet types:

Hello

Database Description (DD)

Link State Request

Link State Update

Link State Acknowledgment

All OSPF packets begin with a standard 24-octet header. Note that the header includes a Router ID field, which indicates the unique ID of the route originating the OSPF packet.

Version | Type | Packet Length

Router ID

Area ID

Checksum | AuType

Authentication

Authentication

Packet Data

Typically, OSPF packets carry Link-State Advertisements (LSAs), which describe all of the links or interfaces of the router, and the state of the links. While all LSAs start with the same header, these three fields identifies a single LSA:

Type

Link State ID

Advertising Router

OSPF uses Link State Update packets to flood LSAs and send LSAs in response to Link State Requests. An OSPF neighbor is responsible for reencapsulating the appropriate LSAs in new Update packets for further flooding in order to propagate OSPF LSAs beyond the network on which they were originated. Thus, a duplicate router ID can be detected by, and propagated by multiple routers.

Complete these steps in order to determine if there is a duplicate router ID:

Execute the show ip ospf database router x.x.x.x command on the router that should have this ID. This command displays the contents of a router LSA (Type 1), which advertises a router and all of its directly connected interfaces. Understand the interface list of the router and the assigned IP addresses.

Execute the show ip ospf database router x.x.x.x command a few times on the router that reports the duplicate. The Shortest Path First (SPF) algorithm can run as frequently as once every 10 seconds.

If you capture these commands, you should be able to catch information that changes. This example is an output of the show ip ospf database router command.

When two routers use the same router ID in an OSPF domain, routing possibly does not work correctly. Cisco bug IDs CSCdr61598 (registered customers only) and CSCdu08678 (registered customers only) enhance the detection and reporting mechanisms of duplicate router IDs. Access the Bug Toolkit (registered customers only) in order to view additional information about these Cisco bug IDs. There are two duplicate router ID types:

If a router receives a Type 4 LSA and the Link State ID equals the router ID and the router is not an ABR, then a valid router ID duplication in the remote area occurs, and the error message should be logged.

If the router is not an ABR, it can receive a Type 4 LSA which tells it about itself from the other ABR. This condition does not represent a duplicate router ID problem, and the error message should not be logged.

A Type 4 LSA is also known as an ASBR Summary LSA. Issue the show ip ospf database asbr-summary command in order to observe these LSAs, as shown in this example.

The ABR creates (Type 4) ASBR Summary LSAs in order to advertise reachability of an ASBR into other areas.

The show ip ospf statistics command shows that recalculation of SPF is done every 10 seconds, as seen in the previous example. It is triggered by the router and network LSA. There is a problem in the same area as the current router.

The show ip ospf database command shows that one LSA is newer (age 16) and its sequence number is much higher then the other LSAs in the same OSPF database. You need to figure out which router sent this LSA. Since it is in the same area, the advertising router id is known (50.0.0.6). It is more probable that this router ID is duplicated. You need to find out which other router has the same router-id.

This example shows several instances of the show ip ospf database command.

If you know your network, you can find which router advertises those links. The first previous output shows that the LSAs are sent by a router with OSPF neighbors 50.0.0.7, whereas the second output shows neighbors 50.0.0.5 and 50.0.0.6. Issue the show ip ospf command in order to find those routers and access them in order to verify their OSPF router-id. In this example setup, they are R6 and R3.

In the previous example, the router-id command was removed and the OSPF process was not restarted. The same problem can also result from a loopback interface that is removed and configured somewhere else.

Issue the clear ip ospf 1 process command and the show ip ospf command in order to clear the process.

In order to correct the problem, make sure that either the highest loopback configured on the router is unique in your OSPF network, or configure statically the router-id with the router-id <ip address> command under the OSPF router configuration mode.

The symptoms of these problems are that the external route, which is learned through the redistribution from static into OSPF process by R6, ASBR router flaps from the routing table on all routers within OSPF Area 0. The external route is 120.0.0.0/16 and the problem is noticed on Router 5 in Area 0. Start to troubleshoot from there.

Issue the show ip route command a few times consecutively in order to see the symptom.

Take a look at the OSPF database in order to check whether the LSA is received. If you issue the show ip ospf database command several times in a row, you notice that the LSA is received by two routers, 50.0.0.6 and 50.0.0.7. If you look at the age of the second entry, if present, you notice that its value changes dramatically.

You also notice strange behavior if you look at the sequence number for the LSAs that are received from 50.0.07, which is the advertising router. Review what other LSAs are received from 50.0.0.7. If you issue the show ip ospf database adv-router 50.0.0.7 command several times in a row, the entries vary quickly, as shown in this example.

It is known that the problem is outside the current area. Turn your focus on the ABR. Telnet to the ABR Router 2 in order to have more visibility on other areas than OSPF area 0. Issue the show ip ospf border-routers and show ip ospf database network adv-router commands.

This error message states that the router originates or flushes LSA at a high rate. A typical scenario in a network may be where one router in the network originates LSA and the second router flushes that LSA. A detailed description of this error message is provided here:

Process 60500 - The OSPF process that reports the error. In this example, the process ID is 60500.

re-originates or flushes (keyword) - Indicates if the router originates LSA or flushes. In this error message, the router flushes LSA.

LSA ID 10.35.70.4 - Link state ID for which a flood war is detected. In this example, it is 10.35.70.4.

type -5 - LSA type. This example has a Type 5 LSA.

Note: A flood war has a different root cause for every LSA.

adv-rtr - Router which originates LSA (that is, 10.40.0.105).

Area - Area to which the LSA belongs. In this example, the LSA belongs to 10.40.0.0.

Solution

Note the Type specifics of this error; in this example, type-5. This designation means there are duplicate router IDs on two routers located in the different areas. As a result, it is necessary to change the router ID on one of the routers.