Home  >  Article  >  Operation and Maintenance  >  Detailed explanation of the workflow of ARP address resolution protocol

Detailed explanation of the workflow of ARP address resolution protocol

齐天大圣
齐天大圣Original
2020-12-11 19:30:503399browse

We know that if two hosts want to communicate with each other, they both need to have an IP address, and they also need to know the IP address of the other party. So can we communicate with an IP address? Not yet, you still need the other party's MAC address to communicate. The MAC address and IP address are indispensable. Let's look at how to find out the other party's MAC address once we know the IP address of the other party's host.

Each host has its own arp cache list, which stores the mapping relationship between the IP addresses and Mac addresses of other hosts in the LAN. You can enter `arp -a in the command window to view the arp cache of this host.

arp -a
接口: 192.168.110.145 --- 0x13
  Internet 地址         物理地址              类型
  192.168.110.1         30-0d-9e-61-27-3a     动态        
  192.168.110.255       ff-ff-ff-ff-ff-ff     静态        
……

When host A on the LAN (IP is 192.168.1.11) wants to communicate with host B on the same LAN, after knowing the IP address of host B (192.168.1.13), it will check its own arp cache , see if there is the MAC address of host B. If so, you can communicate with host B. If not, the ARP address resolution protocol must be used to obtain the MAC address of host B. Let's take a look at the workflow of arp:

(1) Host A sends a broadcast packet within the LAN. The message content is similar to: "I am 192.168.1.11, and the mac address is a0:a4:ce:42: 29:56, I want to know the MAC address of 192.168.1.13".

(2) All hosts running the arp program on this LAN can receive the broadcast message.

(3) The IP of host B matches, the request is accepted, and the mapping relationship between the IP and MAC address of host A is recorded in the remembered arp cache. Then send a unicast packet to host A with content similar to: "I am 192.168.1.13, and my MAC address is f1:21:fa:c2:d2:ad".

(4) Host A receives the unicast message from B and records the relationship between host B’s IP address and MAC address in its own arp cache.

Note that because the LAN host changes dynamically, the ARP cache has a survival time and will be automatically deleted when it expires.

You may have questions. What you are talking about is only the situation of hosts in the LAN. What if they are on different network segments? In fact, it is still obtained through ARP, but multiple ARP requests are required.

The above is the detailed content of Detailed explanation of the workflow of ARP address resolution protocol. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn