Home > Common Problem > What is the function of ARP protocol

What is the function of ARP protocol

coldplay.xixi
Release: 2023-02-16 16:15:35
Original
69797 people have browsed it

The function of the ARP protocol is to query the MAC address of the target device through the IP address of the target device to ensure smooth communication and convert the computer's network address [IP address 32 bits] into a physical address [MAC address] 48 bits]. The ARP address resolution protocol is used to convert a computer's network address (IP address 32 bits) into a physical address (MAC address 48 bits).

What is the function of ARP protocol

#The operating environment of this article: Windows 7 system, Dell G3 computer.

ARP protocol is the abbreviation of "Address Resolution Protocol". In a local area network, what is actually transmitted in the network is "frame", and the frame contains the MAC address of the target host. In Ethernet, if a host wants to communicate directly with another host, it must know the MAC address of the target host. But how is this target MAC address obtained? It is obtained through the Address Resolution Protocol. The so-called "address resolution" is the process in which the host converts the target IP address into the target MAC address before sending the frame. The basic function of the ARP protocol is to query the MAC address of the target device through the IP address of the target device to ensure smooth communication.

ARP (AddressResolutionProtocol) Address Resolution Protocol is used to convert the computer's network address (IP address 32 bits) into a physical address (MAC address 48 bits) [RFC826]. The ARP protocol is a link layer protocol. In Ethernet, the data frame from one host to another host in the network determines the interface based on the 48-bit Ethernet address (hardware address), rather than based on the 32-bit Ethernet address. IP address. The kernel (such as a driver) must know the hardware address of the destination in order to send data. Of course, point-to-point connections do not require the ARP protocol.

ARP protocol example

In order to explain the role of the ARP protocol, it is necessary to understand the data transmission process on the network. Here is a simple PING example.

Assume that our computer IP address is 192.168.1.1, and we need to execute this command: ping192.168.1.2. This command will send ICMP packets through the ICMP protocol.

This process requires the following steps:

1. The application constructs a data packet. This example generates an ICMP packet and submits it to the kernel (network driver);

2. The kernel checks whether it can convert the IP address to a MAC address, that is, check the IP-MAC correspondence table in the local ARP cache;

3. If the IP-MAC correspondence exists, then jump to Step 9; If the IP-MAC correspondence does not exist, then continue with the following steps;

 4. The kernel performs ARP broadcast, and the destination MAC address is FF-FF-FF-FF-FF-FF. The ARP command type is REQUEST (1), which contains its own MAC address;

5. When the 192.168.1.2 host receives the ARP request, it sends an ARP REPLY (2) command, which contains Own MAC address;

6. Obtain the IP-MAC address correspondence of the 192.168.1.2 host locally and save it to the ARP cache;

7. The kernel will convert the IP into a MAC address , then encapsulate it in the Ethernet header structure, and then send the data out;

Use the arp-a command to view the contents of the local ARP cache. Therefore, after executing a local PING command, the ARP cache will There is a record of the destination IP. Of course, if your data packet is sent to a destination on a different network segment, then there must be a record corresponding to the IP-MAC address of the gateway.

Knowing the role of the ARP protocol, you can clearly know that the outward transmission of data packets relies heavily on the ARP protocol, and of course, relies on the ARP cache. You should know that all operations of the ARP protocol are automatically completed by the kernel and have nothing to do with other applications. At the same time, it should be noted that the ARP protocol is only used on this network.

If you want to learn more about programming, please pay attention to the php training column!

The above is the detailed content of What is the function of ARP protocol. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template