How to find a duplicate router-id ospf in the network

ospf

Hi I've got a problem in the network with a duplicate OSPF router-id. We tipically use the loopback ip address as the router-id, but I'm afraid that someone in the network don't care about that.
I wanted to know if there is a simple way to get this information. By now I'm writting a perl script to get the information via snmp to list all the router-id in the network.

Best Answer

If you have access to config repositories, the best way to do this is to search through them all to find duplicate entries. Assuming you're on a *NIX host, you could do something like:

$ cat * | grep 'router-id' | awk {'print $2'} | sort | uniq -c

You want to look for anything that has a '2' in the first column. You can then find the offender and grep for the IP to find the routers that it's configured on. This would likely be the simplest way. You're already on the right track with a Perl script to poll the devices via SNMP to get at the router-id IP addresses, but I will say that SNMP code can be a little "hairier" than just simply using Net::SSH::Expect or Net::Appliance::Session to just log into the devices and dump the running configs to filehandles (at which point you can use the technique above).

Assuming you're running Cisco, there's also a fairly comprehensive troubleshooting guide that covers this topic if you're interested.