check if two IP addresses belong to the same router

0

I have several hosts from which I traceroute to the same destination.

Is there a way to determine whether two IP addresses belong to different interfaces of the same router?

Is it enough to check if the hostname is the same (dig +short -x $IPADDRESS)?

Are there other methods?

Ricky Robinson

Posted 2014-08-27T13:51:30.247

Reputation: 160

1Why do you need to do that? What is the actual problem that you are seeking to resolve by asking this question? – a CVn – 2014-08-27T14:11:01.257

I am not sure how reliable hostname is - what is there to prevent another device on the network claiming the same hostname? AD? - an alternative would be to check against all the MAC addresses that the interfaces have (and while MAC addresses can also be spoofed, that is likely to cause errors on the network) – user2813274 – 2014-08-27T14:11:11.153

@MichaelKjörling: My actual goal is to check to which extent paths from different hosts overlap. – Ricky Robinson – 2014-08-27T14:17:00.347

1@user2813274 MAC addresses are not routed. IP runs on top of Ethernet, not the other way around which would be required for routing of MAC addresses. – a CVn – 2014-08-27T14:19:54.863

Answers

2

Just based on an IP address it is not possible to check if they belong to the same device. If you were to be in the same network(subnet), you could compare the MAC addresses and see if they are consecutive, which would give you some guarantee.

If the remote router has some sort of service running which allows it to be identified (SNMP/Webservice with unique hostname/Telnet banner etc.) you could use that of course.

You could try running nmap against both routers and see if the results are the same, which could mean it's the same device, or that the remote party has configured 2 routers with exactly the same settings.

mtak

Posted 2014-08-27T13:51:30.247

Reputation: 11 805