Centos – ARP table not updated until response is sent

arpcentoscentos7mac address

I'm executing the arp -a command on CentOS 7 in order to translate an IP address to a MAC address (since I can't access the source MAC of the layer 2 frame in Java).

I see a lot of cases where the ARP table doesn't include an entry for the IP address when the request is received (for example and HTTP request or a DNS request). However, it looks like the entry is added before the response is sent, probably because the host needs to determine the destination MAC address to send the frame.

I'm looking for a way to let CentOS create these entries when a frame is received, using the source MAC address.

Best Answer

The arp command when run as the root user has the facility to delete and add entries into the mapping table locally.

However, I'd advise against this unless you have some type of special need. An application like Java is well down into the higher levels are the networking architecture and thus would generally not be needed. So I'd be a little puzzled about needing the MAC address at the application level (generally level 7) to do anything that would be network meaningful.