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 terminal
Enter configuration commands, one per line. End with CNTL/Z. Router5(config)#interface
Router5(config-if)#
Loopback0
ip address
Router5(config-if)#
172.25.25.6 255.255.255.255
exit
Router5(config)#end
Router5#
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 terminal
Enter configuration commands, one per line. End with CNTL/Z. Router5(config)#router ospf
Router5(config-router)#
87
router-id
Router5(config-if)#
172.25.1.7
exit
Router5(config)#end
Router5#
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 ...
Get Cisco IOS Cookbook, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.