First of all lets have a look at why we actually need ARP.
Computers on the same subnet communicate directly with each other using a layer 2 MAC address.
So if you try to contact a computers IP-address your computer calculates if the computer is on the same network.
If the computer is on the same network your computer checks if its arp table already contains the MAC address of the target host. If the table does not contain the MAC address your computer needs to obtain it.
This is done via ARP-requests (who has 192.168.2.2, send MAC address to 192.168.2.2 from your example output).
So how can you issue ARP-requests on your own?
By using what we know from above we can make your computer do so:
- delete your ARP table (sudo arp -ad on Mac OS X)
- contact other computers on your local network (eg ping 192.168.2.2).
The underlying network stack will check if it knows the MAC address (which it does not) and issue an ARP-request.
There is no need to have a complete arp table already before you actually need it when communicating with other hosts, but if you explicitly want to have it you could ping all hosts in your network:
for i in {1..254}; do ping -c 1 192.168.2.$i > /dev/null &; done
This command
- pings every host in your network (192.168.2.{1..254})
- once (-c 1)
- and outputs the results to /dev/null
You should have all active hosts on your network in your arp table afterwards.
Using tools
You could also use arping to issue ARP-requests for IP-addresses from your command line.