Brief introduction of APR between network layer and link layer

(1), APR Protocol
Address Resolution Protocol (ARP)->Address Resolution Protocol

Concept: The address resolution protocol is to find the Mac address through the ip address, (find the data link layer corresponding to the ip address, such as the mac address)
Content: In network communication, when the source host is about to communicate with another target host in the network, The mapping relationship between the host, ip address, and MAC address is established through the APR protocol.
Note: When the communication connection is established, the data packet is accepted by the network card and then the upper layer protocol is processed. If the hardware address of the received data packet does not match the machine, It will be discarded directly, so we need to obtain the hardware address of the destination host.
Workflow:
1. The source host sends an APR request packet (in the packet: target ip address, Mac address?)
2. The target host receives the APR request packet and sends an APR Response package (inside the package: own Mac address)
3. After the source host receives the response from the target host, it records the target host’s ip address and hardware address mapping in its APR cache.
Note: The target host generally broadcasts the APR request packet , Other hosts on the same network can receive it, but only the host with the target ip address will respond with
Brief introduction of APR between network layer and link layer
special attention: each host will maintain an APR cache table, which can be viewed with the arp-a command. The general time for the entries in the cache table is 1200 seconds (20 minutes). If an entry is no longer used within 20 minutes, the entry will be invalid. Next time, the APR packet must be sent to obtain the hardware address of the destination host.
The format of the
APR datagram. The APR packet exists on the Ethernet. In the frame:
Brief introduction of APR between network layer and link layer
APR package:
Brief introduction of APR between network layer and link layer
1. HYPE (HardwareType) hardware type
: get the hardware address type according to the current network data link layer protocol type, the HTPE of Ethernet is 1;
2. PTYPE (Protocol Type) protocol type
: upper network protocol , The network address type to be mapped is actually specified, the ipv4 type is 0x0800;
3. HLEN (Hardware length) hardware size
: Hardware address length
4, PLEN (Protocol length) protocol length
: PTYPE specifies the network address length of the upper layer protocol
5, OPER (Operation) operation
: request packet is 1, response packet is 2, used to distinguish
6, SHA (Sender Hardware address) Sender's hardware address
:
7. SPA (Sender Protocol Address) Sender's protocol address
: the network address of the sender's upper layer protocol
8. THA (Target Hardware Address) destination hardware address
: the receiver's hardware address, the request packet is THA= 0;
9, TPA (Target Protocol Address) destination protocol address
: the network address of the receiver's upper layer protocol.
Finally, there are still many deceptive connections that use the APR protocol in life. If you need it here, you can find out by yourself

Guess you like

Origin blog.51cto.com/14632688/2642775
Recommended