You'll note that the ARP request only happens the first time you run ping
. If you run it a second time (shortly after the first run), you'll see that the ping
start immediately with an ICMP request. This is because when a system discovers the IP address/MAC address association via ARP, it stores the result in a local arp cache. Entries in the cache do expire after some amount of time.
You can manually populate the ARP cache using the arp
command:
arp -s <ipaddr> <macaddr>
E.g.:
arp -s 192.168.1.1 192.168.1.1
You can see the contents of your ARP cache like this:
arp -an
So if you were to manually update the ARP cache with the MAC address of your target host, you would be able to ping it with an ARP request going over the network.