In a small network, say 20 nodes or less, my program, on a test instrument, needs to know "Who is out there?" by MAC not by IP. I will be plugging into random networks and need to be able to do this without having to know any addresses, MAC or otherwise in the network and knowing I can't rely on DHCP. It is completely reasonable that the DHCP server could be down and the nodes have no IP addresses and/or, I can't get one. Truthfully, I don't need IP, our test protocol is MAC layer, not IP.
So, how can I determine my instrument's neighbor's MAC addresses? This sounds a lot like LLDP but backwards, i.e., "who's out there", not "I'm here and I can do this...". I must assume there is no IP assigned to the endpoints, so no ARPing, no NMAP, etc.
Note I should add, this is a wired network.
On a Linux machineOpen a terminal window. Type ifconfig at the command prompt. Your MAC address will be displayed beside the label HWaddr.
The ip neigh command manipulates neighbour objects that establish bindings between protocol addresses and link layer addresses for hosts sharing the same link. Neighbour entries are organized into tables. The IPv4 neighbour table is also known by another name - the ARP table.
In the general case, there is no MAC level protocol that you can send and guarantee a response from every machine on your network (I am assuming you are using ethernet here as I believe things are different on WLAN). IE there is no broadcast (or even, IIRC unicast) at the MAC layer that a host is guaranteed to respond to. With IP on top, you can IP broadcast and check the ARP cache.
The best way to do this would (in my opinion) be to use the way switches / learning bridges work on ethernet, i.e. passively listen in promiscuous mode for packets and note their MAC addresses. You won't spot completely silent hosts, but neither will a switch until a packet is sent by it. By definition there is no way to spot a completely silent host anyway.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With