I have to secure interfaces on Linux servers by setting bonding interfaces. The cabling information is not accurate. Is there a simple way to know if two interfaces are connected to the same LAN?Some interfaces have no IP, if possible I would prefer to not set dummies IPs.I finally did it using arping, it was already installed on the servers:ifconfig eth2 up ifconfig ethO up tcpdump -i eth2 -c 3 arp net 10.10.10.10and in another terminal :arping -D -I eth0 10.10.10.10tcpdump should displays lines like that:16:15:43.032103 arp who-has 10.10.10.10 (Broadcast) tell 0.0.0.016:15:44.032277 arp who-has 10.10.10.10 (Broadcast) tell 0.0.0.016:15:45.032441 arp who-has 10.10.10.10 (Broadcast) tell 0.0.0.0*-D is optional but it gives a nice 0.0.0.0 source address.
How to tell if two ethernet interfaces are on the same lan?
linux;networking;ethernet
Some ideas, assuming interfaces are eth0 and eth1:Sniff on both interfaces at the same time for non unicast traffic. You should see all packets twice( tcpdump -nni eth0 -c 10 broadcast or multicast & tcpdump -nni eth1 -c 10 broadcast or multicast & ) | sortProbe with an IP-less protocol.For example with this tool to generate DHCP requests:http://www.latinsud.com/pub/dhd/dhd.c( sleep 1; ./dhd eth1 > /dev/null ) & tcpdump -nni eth0 udp and port 68You should see something like this:14:46:16.449738 IP 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from 00:50:56:99:76:cb, length 30014:46:16.650330 IP 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from 00:50:56:99:76:cb, length 300