ARP, the Address resolution Protocol, has the job to resolve an IP address
to a MAC (Media Access Control) address. Let's have a look why this is
necessary and how ARP works!
If a node wants to send an IP datagram, the adapter adds a MAC layer
header (e.g. Ethernet) with a MAC address. In order to find a corresponding
MAC address, each node owns an ARP table which contains mappings of IP
to MAC addresses. If there is no entry in the table, the sender node
broadcasts an ARP request on the subnet, in which it
asks for the MAC address to a given IP address. The node, which owns
the requested IP address, sends in an ARP response its MAC address back.
The mapping is added to the ARP table of the requesting node.
Please notice, that ARP resolves IP addresses only for nodes on the same
subnet. If a packet has to travel over one or more routers in order to
reach the destination, each node uses in a first step its routing table
to find the IP address of the next hop. In a next step it looks in the
ARP table for the MAC address corresponding to this IP address.
Please have a look at the following scenario and see how MAC addresses
are determined by ARP. You are able to select different scenarios, have
a look at the routing and ARP tables of selected nodes and delete entries
of the ARP tables.