When hosts need to send data to each other on the same network, they use ARP to find out the hardware address to send the packet to.
The Address Resolution Protocol is used to enable devices to match MAC addresses to IP addresses for other devices on the same LAN. When devices learn a new MAC / IP address pairing, they add it to their ARP Table / ARP Cache for use in the future.
A host (192.168.1.1) wants to send a packet to 192.168.1.2
It identifies that 192.168.1.2 is part of the same LAN.
It looks up 192.168.1.2 in its ARP table, but there isn’t an entry
It sends out an ARP Request as an Ethernet broadcast to ask ‘who has 192.168.1.2?’
The switch broadcasts the packet to other hosts on the LAN
The device which owns 192.168.1.2 replies ‘I am 192.168.1.2, my MAC address is xx:xx:xx:xx:xx:xx’
The host at 192.168.1.1 receives the reply and adds an entry to its ARP table. It can now send the data to 192.168.1.2.
Devices, including hosts and routers, build up the ARP table with the information which they have learnt.
Information in the table includes:
Physical / Hardware Address (i.e. MAC Address)
ARP is specified in IETF RFC 826.