cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1414
Views
10
Helpful
7
Replies
Highlighted

OSPF router-id selection


iosv-8(config-if)#do show ip int br
Interface IP-Address OK? Method Status Protocol
GigabitEthernet0/0 10.255.0.11 YES NVRAM up up
GigabitEthernet0/1 10.254.252.2 YES manual up up
GigabitEthernet0/2 unassigned YES unset up up
GigabitEthernet0/3 222.222.222.222 YES manual administratively down down
Loopback0 unassigned YES manual administratively down down
Loopback1 unassigned YES manual up up


iosv-8(config-if)#do clear ip ospf proc
Reset ALL OSPF processes? [no]: y
iosv-8(config-if)#
*Apr 9 18:28:49.497: %OSPF-5-ADJCHG: Process 1, Nbr 10.254.252.1 on GigabitEthernet0/1 from FULL to DOWN, Neighbor Down: Interface down or detached
*Apr 9 18:28:49.593: %OSPF-5-ADJCHG: Process 1, Nbr 10.254.252.1 on GigabitEthernet0/1 from LOADING to FULL, Loading Done


iosv-8(config-if)#do show ip pro
*** IP Routing is NSF aware ***

Routing Protocol is "ospf 1"
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Router ID 222.222.222.222

No I did not statically configure router-id.

iosv-8(config-if)#do show run | i router
router ospf 1

It looks like OSPF router-id is the highest available IP from a loopback interface, then non-loopback interface. The interface state does not matter. Many sources state that the interface can't be admin down for its IP to be used as router-id. But it does not look like the case in IOS 15.6(2)T

Where is this change documented? I can't find in IOS 15M&T documentation how OSPF router-id is selected.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Hall of Fame Cisco Employee

Hi,

Would you mind doing that test again? Simply shutting down an interface that was previously used for OSPF RID and restarting the OSPF process won't cause it to reselect its OSPF RID.

Do this:

  1. Keep your Gi0/3 shut down.
  2. Configure a static unique RID directly in your OSPF process using the router-id command, say, 22.22.22.22
  3. Restart the OSPF process.
  4. Remove the router-id command from your OSPF configuration
  5. Restart the OSPF process
  6. Check the resulting OSPF RID value - it should be 10.255.0.11

Best regards,
Peter

View solution in original post

7 REPLIES 7
Highlighted
Hall of Fame Cisco Employee

Hi,

Would you mind doing that test again? Simply shutting down an interface that was previously used for OSPF RID and restarting the OSPF process won't cause it to reselect its OSPF RID.

Do this:

  1. Keep your Gi0/3 shut down.
  2. Configure a static unique RID directly in your OSPF process using the router-id command, say, 22.22.22.22
  3. Restart the OSPF process.
  4. Remove the router-id command from your OSPF configuration
  5. Restart the OSPF process
  6. Check the resulting OSPF RID value - it should be 10.255.0.11

Best regards,
Peter

View solution in original post

Highlighted

setting/removing static router-id did make a difference, but the selection of non-highest IP as router-id surprised me

iosv-8(config-router)#router-id 22.22.22.22
% OSPF: Reload or use "clear ip ospf process" command, for this to take effect
*Apr 9 19:01:41.114: OSPF-1 EVENT: Config: router-id 22.22.22.22

iosv-8(config-router)#do clear ip ospf pro
Reset ALL OSPF processes? [no]: yes
*Apr 9 19:01:46.598: %OSPF-5-ADJCHG: Process 1, Nbr 10.254.252.1 on GigabitEthernet0/1 from FULL to DOWN, Neighbor Down: Interface down or detached


iosv-8(config-router)#no router-id 22.22.22.22
% OSPF: Reload or use "clear ip ospf process" command, for this to take effect
*Apr 9 19:01:59.540: OSPF-1 EVENT: Config: no router-id 22.22.22.22

iosv-8(config-router)#do clear ip ospf pro
Reset ALL OSPF processes? [no]: yes
*Apr 9 19:02:05.680: %OSPF-5-ADJCHG: Process 1, Nbr 10.254.252.1 on GigabitEthernet0/1 from 2WAY to DOWN, Neighbor Down: Interface down or detached
*Apr 9 19:02:05.749: %OSPF-4-NONEIGHBOR: Received database description from unknown neighbor 10.254.252.1

iosv-8(config-router)#do show ip prot
*** IP Routing is NSF aware ***

Routing Protocol is "application"
Sending updates every 0 seconds
Invalid after 0 seconds, hold down 0, flushed after 0
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Maximum path: 32
Routing for Networks:
Routing Information Sources:
Gateway Distance Last Update
Distance: (default is 4)

Routing Protocol is "ospf 1"
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Router ID 10.254.252.2

iosv-8(config-router)#do show ip int br
Interface IP-Address OK? Method Status Protocol
GigabitEthernet0/0 10.255.0.11 YES NVRAM up up
GigabitEthernet0/1 10.254.252.2 YES manual up up
GigabitEthernet0/2 unassigned YES unset up up
GigabitEthernet0/3 222.222.222.222 YES manual administratively down down
Loopback0 unassigned YES manual administratively down down
Loopback1 unassigned YES manual up up

The highest non admin-down IP 10.255.0.11 is not selected

g0/0 is in a different VRF. So OSPF router-id is selected only from interfaces from the same VRF?

Highlighted
Hall of Fame Cisco Employee

Hi,

g0/0 is in a different VRF. So OSPF router-id is selected only from interfaces from the same VRF?

Yes, absolutely. Another VRF is "another world" or "another router", so to speak. Selecting OSPF RID from interfaces in the same VRF as the OSPF process increases the chance (although does not guarantee) that the OSPF RIDs of both processes are unique.

Best regards,
Peter

Highlighted

But within the same VRF, the selection process guarantees unique RID (if possible) per process? It seems to be the case. But I am still confused about the selection logic on when RID election occurs.

iosv-8(config-router)#router ospf 2
iosv-8(config-router)#
*Apr 9 19:26:10.874: OSPF EVENT: Creating OSPF process 2
iosv-8(config-router)#do show ip pro
*** IP Routing is NSF aware ***

Routing Protocol is "application"
Sending updates every 0 seconds
Invalid after 0 seconds, hold down 0, flushed after 0
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Maximum path: 32
Routing for Networks:
Routing Information Sources:
Gateway Distance Last Update
Distance: (default is 4)

Routing Protocol is "ospf 1"
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Router ID 10.255.255.8
Number of areas in this router is 2. 2 normal 0 stub 0 nssa
Maximum path: 4
Routing for Networks:
Routing on Interfaces Configured Explicitly (Area 2):
GigabitEthernet0/1
Routing on Interfaces Configured Explicitly (Area 400):
GigabitEthernet0/3
Routing Information Sources:
Gateway Distance Last Update
Distance: (default is 110)

Routing Protocol is "ospf 2"
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Router ID 10.254.252.2

Highlighted

Something more strange...I have to set RID, clear ospf process, unset RID, clear ospf process for RID to change.

If I simply set RID, unset RID, then restart OSPF process, RID does not change... What's the selection logic here?

iosv-8(config-router)#do show ip int br
Interface IP-Address OK? Method Status Protocol
GigabitEthernet0/0 10.255.0.11 YES NVRAM up up
GigabitEthernet0/1 10.254.252.2 YES manual up up
GigabitEthernet0/2 unassigned YES unset up up
GigabitEthernet0/3 222.222.222.222 YES manual administratively down down
Loopback0 10.255.255.8 YES manual administratively down down
Loopback1 unassigned YES manual up up

iosv-8(config-router)#int lo0
iosv-8(config-if)#no sh

*Apr 9 19:14:23.810: %LINK-3-UPDOWN: Interface Loopback0, changed state to up
*Apr 9 19:14:24.810: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback0, changed state to up
*Apr 9 19:14:24.813: OSPF EVENT Lo0: Route adjust

iosv-8(config-if)#router ospf 1
iosv-8(config-router)#router-id 1.2.34.4
% OSPF: Reload or use "clear ip ospf process" command, for this to take effect
*Apr 9 19:14:33.566: OSPF-1 EVENT: Config: router-id 1.2.34.4
iosv-8(config-router)#no router-id 1.2.34.4
% OSPF: Reload or use "clear ip ospf process" command, for this to take effect
*Apr 9 19:14:39.909: OSPF-1 EVENT: Config: no router-id 1.2.34.4

iosv-8(config-router)#do clear ip ospf process
Reset ALL OSPF processes? [no]: yes
*Apr 9 19:14:45.490: %OSPF-5-ADJCHG: Process 1, Nbr 10.254.252.1 on GigabitEthernet0/1 from FULL to DOWN, Neighbor Down: Interface down or detached
*Apr 9 19:14:45.581: %OSPF-5-ADJCHG: Process 1, Nbr 10.254.252.1 on GigabitEthernet0/1 from LOADIno router-id 1.2.34.4
iosv-8(config-router)#do show ip pro | i ID
Router ID 10.254.252.2


iosv-8(config-router)#router-id 1.2.3.4
% OSPF: Reload or use "clear ip ospf process" command, for this to take effect
*Apr 9 19:15:07.376: OSPF-1 EVENT: Config: router-id 1.2.3.4
iosv-8(config-router)#do clear ip ospf pro
Reset ALL OSPF processes? [no]: yes
*Apr 9 19:15:12.477: %OSPF-5-ADJCHG: Process 1, Nbr 10.254.252.1 on GigabitEthernet0/1 from FULL to DOWN, Neighbor Down: Interface down or detached


iosv-8(config-router)#no router-id 1.2.3.4
% OSPF: Reload or use "clear ip ospf process" command, for this to take effect
*Apr 9 19:15:19.916: OSPF-1 EVENT: Config: no router-id 1.2.3.4
iosv-8(config-router)#do clear ip ospf pro
Reset ALL OSPF processes? [no]: yes
*Apr 9 19:15:26.907: %OSPF-5-ADJCHG: Process 1, Nbr 10.254.252.1 on GigabitEthernet0/1 from 2WAY to DOWN, Neighbor Down: Interface down or detached


iosv-8(config-router)#do show ip pro | i ID
Router ID 10.255.255.8

Note here. It seems RID election did happen when I set/unset RID without clearing OSPF in between, but it selected 10.254.252.2 when a higher IP exists on lo0

*Apr 9 19:14:45.581: %OSPF-5-ADJCHG: Process 1, Nbr 10.254.252.1 on GigabitEthernet0/1 from LOADIno router-id 1.2.34.4
iosv-8(config-router)#do show ip pro | i ID
Router ID 10.254.252.2

Highlighted
Hall of Fame Cisco Employee

Hi,

Something more strange...I have to set RID, clear ospf process, unset RID, clear ospf process for RID to change.

Yes, that has been my experience as well.

If I simply set RID, unset RID, then restart OSPF process, RID does not change... What's the selection logic here?

It seems to me to be an implementation issue rather than some "deep truth". Adding and removing the router-id before restarting an OSPF process is like restarting the process without doing any changes to its configuration - in both cases, the OSPF RID does not change.

It seems RID election did happen when I set/unset RID without clearing OSPF in between, but it selected 10.254.252.2 when a higher IP exists on lo0

I am sorry, I cannot confirm that based on the information you have posted - I did not see the RID immediately before and after this.

A suggestion - please try posting your outputs formatted with Formats -> Code Snippet style. You're currently using the quotation style that is much harder to read.

Best regards,
Peter

Highlighted

It seems to me to be an implementation issue rather than some "deep truth". Adding and removing therouter-id before restarting an OSPF process is like restarting the process without doing any changes to its configuration - in both cases, the OSPF RID does not change.

It would be nice if Cisco make it clear in the documentation the logic used during this process and when the logic was changed.

The quality of IOS documentation is not that great any more (usually I have to search in NX-OS documentation instead), probably because Cisco is moving to IOS-XE. Even some NX-OS and IOS-XE documentations are largely copy & paste from old IOS documentations. Cisco can definitely use some work on keeping the documentations updated. The majority of technotes are 10+ years old. 

Content for Community-Ad