Setting the OSPF RID
Problem
You want to set the OSPF Router ID (RID) of a particular router.
Solution
There are several ways to set the OSPF Router ID (RID). The easiest is to create and configure a Loopback interface:
Router5#configure terminalEnter configuration commands, one per line. End with CNTL/Z. Router5(config)#interfaceRouter5(config-if)#Loopback0ip addressRouter5(config-if)#172.25.25.6 255.255.255.255exitRouter5(config)#endRouter5#
If you don’t want to use a Loopback interface, you can still force the router ID to use a particular IP address with the router-id configuration command:
Router5#configure terminalEnter configuration commands, one per line. End with CNTL/Z. Router5(config)#router ospfRouter5(config-router)#87router-idRouter5(config-if)#172.25.1.7exitRouter5(config)#endRouter5#
Discussion
If you don’t use either of these methods, the router will select the highest IP address from its interfaces and use this as the OSPF RID. The trouble with doing this is that you might add a new IP address to the router at some point. If this new address is higher than the previous RID, the router will change its RID the next time OSPF restarts. This could have strange consequences because if the interface priorities are the same, OSPF uses the highest RID to select the DR. Please refer to Recipe 8.7 for more information on DR selection.
We recommend using the Loopback interface method. Loopback interfaces ensure there is a single unique IP address for every router in ...