Computer Network-----ARP Protocol

1. Basic concepts:

        The ARP protocol is called Address Resolution Protocol, and its function is to obtain the MAC address through the IP address.

2. ARP packet format:

 

Hradware Type: Hardware type, Ethernet

Protocol Type: Indicates the type of three-layer protocol, usually IP

Hradware Length: hardware length

Protocol Length: Protocol length

Operation Code: Type of ARP message, Request/Reply

Source Hardware Address( Sender MAC address ): Source MAC address

Source Protocol Address( Sender IP address ): Source IP address

Destination Hardware Address( Target MAC address ): Destination MAC address

Destination Protocol Address( Target IP address ): Destination IP address

ARP messages cannot pass through routers and cannot be forwarded to other broadcast domains.

3. ARP working principle

        We know the IP address of the target host and want to communicate with it. We send an ARP request message and broadcast it to all hosts in this network segment. If a host IP is the same as the target IP (Target IP address), then the target host It will reply an ARP reply message, telling the host that wants to communicate with it its own MAC address. Then the IP address and MAC address of the target host will be written into the local ARP cache table. If you need to communicate with the target host later, you don't need to go to ARP resolution. Of course, the entries in the ARP cache table have an aging time, generally 5 to 20 minutes. After the aging time, it is necessary to resend the arp request to obtain the mac address.

        There are static entries and dynamic entries in the ARP cache table, as shown in the following figure:

        Among them, "dynamic" in the type column indicates that the entries are obtained dynamically using ARP request broadcast, and "static" indicates that the ARP table is manually configured and maintained. Static entries have no aging time and will always exist. If you want to add static entries, you can use the command arp -s IP address MAC address to add them.

4. Working layer of ARP protocol

        At which layer does the ARP protocol work? In "TCP/IP Detailed Explanation", the ARP protocol is classified into the network layer. After reading some articles, most of the Internet puts the ARP protocol on the network layer. Some people say that the ARP protocol belongs to the data link layer in the OSI seven-layer model; others say that this does not need to be pursued too closely, and it can be classified into any layer (referring to the network layer or data link layer).

        I will reserve my opinion for now, and I will wait until I study the working principles and processes of each layer before I express my opinion!

        

Guess you like

Origin blog.csdn.net/qq_54381110/article/details/125219033