Keeping Track of Router IDs
When it comes to troubleshooting on your network, keeping track of the various Router IDs that show up in your raw network data can be confusing. Also, when an interface goes down, the Router's ID may change, further complicating matters.
You can assign a Router ID either by using the router-id command in Router Configuration mode or by assigning an address to a loopback interface that is higher than any other address on any other interface on your router. The loopback interface should never go down, so using it is a good choice and is the method that I will explain.
In the private address range, 192.168.255.0/24 represents the highest addresses you will likely ever use on your network. If you have fewer than 254 routers on your network, this range is ideal, but if you can, you should keep the 192.168.254.0/24 range available. By keeping the second range available, you will have another 254 addresses you will be able to assign as Router IDs. The following code enables a loopback interface numbered 0 and assigns an address to the interface.
Loopback Router2>enable Password: Router2#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router2(config)#interface loopback 0 Router2(config-if)#ip address 192.168.255.254 255.255.255.0 Router2(config-if)#exit Router2(config)#router ospf 100 Router2(config-router)#network 192.168.255.254 0.0.0.0 area 0 Router2(config-router)#exit Router2(config)#exit
The only item you might not know about in the preceding code snippet is advertising the network of your Router IDs in the Open Shortest Path First (OSPF) routing interface. The command network 192.168.255.254 0.0.0.0 area 0 tells OSPF that the 192.168.255.0/24 network is a routable network ID on the network. This item is not required.
By advertising the router to this network, you can use this address to connect to the router for remote administration. The drawback is that before advertising this network, you would have been able to also use this address block on your network.
Although OSPF routing protocol always prefers a loopback interface over any other type of interface. With that said, when you configure multiple loopback interfaces, 192.168.254.0/24 still represents a good address block for assigning addresses.
When there are multiple paths to a destination, OSPF automatically performs equal cost-load balancing. It supports up to 16 paths to the destination, but by default only operates with four paths. You can change this behavior by using the maximum-paths command as follows:
Router2>enable Password: Router2#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router2(config-router)#maximum-paths 10 Router2(config-router)#exit Router2(config)#exit
Another way to influence the route selection is to manually adjust the cost of a link. You may have been told that the cost of a link is based on the speed of the link, with FastEthernet being a 1 and faster or slower links being based off that link speed. To manually influence the cost, use Interface Configuration mode and the ip ospf cost command, as shown here (where the link cost is set to 5):
Router2>enable Password: Router2#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router2(config-if)ip ospf cost 5 Router2(config-if)#exit Router2(config)#exit