Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 mping, which was already available on the servers. Installing new commands without going through the change process was considered non ethical by the change managment.

Type this into one terminal:

ifconfig eth2 up 
ifconfig ethO up 
tcpdump -i eth2 -c 3 arp net

and in another one that:

arping -D -I eth0

tcpdump should displays lines like that:

16:15:43.032103 arp who-has (Broadcast) tell
16:15:44.032277 arp who-has (Broadcast) tell
16:15:45.032441 arp who-has (Broadcast) tell

-D is optional but it give a nice source address, which I prefered as I was broadcasting and seemed unlikely to trigger any reply.

share|improve this question
Try to send an arp broadcast message on one interface and see if you can see it on the other one – Ulrich Dangel Jul 4 '14 at 12:46
@UlrichDagel I didn't managed to specifically generate ethernet datagrams on one interface. Do you know a standard command to do that ? – Emmanuel Jul 4 '14 at 13:49
you can either write your own tool or use somthing like scapy, arpscan etc and check in parallel with tcpdump on the other deice – Ulrich Dangel Jul 5 '14 at 1:36
up vote 6 down vote accepted

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 & ) | sort
  • Probe 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 68

    You should see something like this:

    14:46:16.449738 IP > BOOTP/DHCP, Request from 00:50:56:99:76:cb, length 300
    14:46:16.650330 IP > BOOTP/DHCP, Request from 00:50:56:99:76:cb, length 300
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.