The data link, such as Ethernet, has its own addressing mechanism (MAC) address, and the IP layer uses an IP address.
When a host sends Ethernet data to another host on the same LAN, the destination interface is determined based on the MAC address. The device driver never checks the destination IP address in the IP datagram.
Address resolution provides mappings for both of these different address forms.
An example
When we type the following command in this form:
will take the following steps:
(1) Application FTP client call function gethostbyname (3) Convert hostname (BSDI) to 32bit IP address
(2) FTP client requests TCP to establish a connection with the resulting IP address
(3) TCP sends a connection request to a remote host, that is, send an IP datagram with the above IP address
(4) If the destination host is on the local network, then the IP datagram can be sent directly to the destination host. If the destination host is on a remote network, use the IP routing function to identify the router address and let it forward the IP datagram
(5) If it is Ethernet, then the sending host must transform the IP address of 32bit into a network address of 48bit.
(6) ARP sends an Ethernet data frame called an ARP request (which contains the IP address of the destination host) to each host on the Ethernet. This process is called broadcasting (shown on the dotted line on the graph)
(7) The ARP layer of the destination host receives this broadcast message and sends an ARP response. This ARP response contains the IP address and the corresponding hardware address
(8) After receiving an ARP response, make ARP request--The IP datagram limit of the answer interchange can be transferred
(9) Sending IP data to the host for reporting purposes
ARP cache
There is an ARP cache on each host. This cache holds a mapping record between the closest Internet address to the hardware address.
The lifetime of each entry in the cache is typically 20 minutes, starting from the time it was created.
You can use the ARP (8) command to check the ARP cache
Grouping formats for ARP
When resolving IP addresses over Ethernet, the format of the ARP request and answer groupings is as shown
The special address where the Ethernet destination address is all 1 is the broadcast address.
RARP: Reverse Address Resolution Protocol
The RARP protocol is used by many diskless systems to obtain IP addresses at boot time.
The RARP grouping format is basically consistent with the ARP grouping. A RARP request is broadcast on the network, which indicates the hardware address of the sending side in the packet to request the corresponding IP address. The response is usually unicast-routed.
TCP/IP Detailed Volume one (fourth to fifth ARP, RARP)