Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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 10.10.10.10

and in another one that:

arping -D -I eth0 10.10.10.10

tcpdump should displays lines like that:

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

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

share|improve this question
3  
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 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 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 at 1:36

1 Answer 1

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 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from 00:50:56:99:76:cb, length 300
    14: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
    
share|improve this answer

Your Answer

 
discard

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.