ARP – Can ARP Broadcast Find Both MAC Address and IP?

arpmac address

I have a peripheral device, connected via Ethernet to my Ubuntu. I would like to find out its IP, and untofetunately no it is not cached in my ARP table.

ARP broadcasts the messages to every reachable MAC-Address, right? So without a brute-force style scanning, I expect ARP protocol to be able to broadcast a request from my laptop, and I expect the peripheral to answer and show its IP.

Is there such a functionality, and if not, is there a good reason?

Best Answer

ARP broadcasts the messages to every reachable MAC-Address, right?

ARP requests are broadcast, ARP replies are normally unicast.

So without a brute-force style scanning, I expect ARP protocol to be able to broadcast a request from my laptop, and I expect the peripheral to answer and show its IP.

That's not how ARP works. ARP resolves the MAC address for a given IP address.

For the other way around RARP was defined which resolved a given MAC address to one or more IP addresses. In contrast to ARP, RARP didn't work via broadcast but required a server. Its adoption was low and it was obsoleted when BOOTP and DHCP became popular - you can use a reservation on those to assign the desired IP address to a given MAC address.

There's also Inverse ARP, but I don't think it's ever been used.

In a nutshell: if there's no DHCP server you can ask you have to do a brute-force scan or alternatively use a higher-layer discovery method. For instance, you could craft a UDP packet addressed to 255.255.255.255 (or directed broadcast) in a unicast Ethernet frame.

As Ron Maupin has pointed out in his comment, the best practice and future-proof (IPv6) way to discover another machine is to use IP multicast. With according network configuration multicast may even work across routers.