OSPFRouter Config

router-id [ip]

The router-id command assigns a specific IP address as the OSPF router ID, overriding the default selection process, and is used to ensure a stable and predictable router identifier for OSPF operation.

Syntax·Router Config
router-id [ip]

When to Use This Command

  • Setting a loopback interface IP as the router ID to ensure stability and avoid changes when physical interfaces go down.
  • Configuring a specific router ID to match network documentation or to control DR/BDR elections in an OSPF network.
  • Overriding the default router ID selection when the highest loopback or physical interface IP is not desirable.
  • Ensuring router ID uniqueness in a multi-area OSPF design to prevent adjacency issues.

Command Examples

Basic router-id configuration

router ospf 1 router-id 1.1.1.1
R1(config-router)# router-id 1.1.1.1
R1(config-router)#
*Mar  1 00:01:23.456: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on GigabitEthernet0/0 from FULL to DOWN, Neighbor Down: Router ID changed
*Mar  1 00:01:23.456: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on GigabitEthernet0/0 from DOWN to FULL, Neighbor Down: Router ID changed

The command sets the OSPF router ID to 1.1.1.1. The syslog messages indicate that OSPF adjacencies are reset because the router ID changed, then re-established. This is normal behavior when modifying the router ID.

Verifying router ID after configuration

show ip ospf
Routing Process "ospf 1" with ID 1.1.1.1
Start time: 00:01:23.456, Time elapsed: 00:05:12.789
Supports only single TOS(TOS0) routes
Supports opaque LSA
Supports Link-local Signaling (LLS)
Supports area transit capability
Router is not originating router-LSAs with maximum metric
Initial SPF schedule delay 5000 msecs
Minimum hold time between two consecutive SPFs 10000 msecs
Maximum wait time between two consecutive SPFs 10000 msecs
Incremental-SPF disabled
Minimum LSA interval 5 secs
Minimum LSA arrival 1000 msecs
LSA group pacing timer 240 secs
Interface flood pacing timer 33 msecs
Retransmission pacing timer 66 msecs
Number of external LSA 0. Checksum Sum 0x000000
Number of opaque AS LSA 0. Checksum Sum 0x000000
Number of DCbitless external and opaque AS LSA 0
Number of DoNotAge external and opaque AS LSA 0
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
Number of areas transit capable is 0
External flood list length 0
IETF NSF helper support enabled
Cisco NSF helper support enabled
Reference bandwidth unit is 100 mbps
    Area BACKBONE(0)
        Number of interfaces in this area is 1
        Area has no authentication
        SPF algorithm last executed 00:03:45.678 ago
        SPF algorithm executed 3 times
        Area ranges are
        Number of LSA 3. Checksum Sum 0x00ABCD

The first line shows the OSPF process and its router ID (1.1.1.1). This confirms the configured router ID is active. Other fields show OSPF timers, LSA counts, and area information.

Understanding the Output

The primary output for the router-id command is seen in the running configuration or via show ip ospf. In show ip ospf, the first line displays 'Routing Process "ospf 1" with ID 1.1.1.1', confirming the router ID. A good value is a stable IP address (often a loopback) that is unique in the OSPF domain. A bad value would be an IP that is not reachable or duplicates another router's ID, causing adjacency problems. Watch for syslog messages indicating neighbor resets when the router ID changes. The router ID must be an IPv4 address; it does not need to be a configured interface IP, but it must be reachable if used as a source for OSPF packets.

CCNA Exam Tips

1.

CCNA exam tip: The router ID is selected in order: 1) manually configured router-id command, 2) highest IP on a loopback interface, 3) highest IP on a physical interface. The exam may ask which router ID will be chosen.

2.

CCNA exam tip: Changing the router ID on a live router will cause OSPF adjacencies to reset, so it should be done during maintenance windows.

3.

CCNA exam tip: The router ID does not have to be a configured interface IP; it can be any unique 32-bit value, but it must be reachable for OSPF to function properly.

4.

CCNA exam tip: In a multi-area OSPF design, the router ID is used to identify the router in LSAs. Duplicate router IDs can cause routing loops or black holes.

Common Mistakes

Mistake 1: Forgetting to clear the OSPF process or reload after changing the router ID — the change takes effect immediately but resets adjacencies, which may cause temporary outages.

Mistake 2: Using an IP address that is not unique in the OSPF domain, causing neighbor adjacency issues and routing problems.

Mistake 3: Configuring a router ID that is not reachable (e.g., a non-existent IP), which can cause OSPF to fail to establish adjacencies.

Related Commands

Practice for the CCNA 200-301

Test your knowledge with hundreds of CCNA practice questions covering all exam domains.

Practice CCNA Questions