Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

ARP Datagram transmission format

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

one。 ARP

ARP protocol is a protocol running at the data link layer in the network architecture, which is used in the local area network. When you know the IP address and port number of the destination host but do not know the MAC address, you need to use ARP, also known as the address resolution protocol. Because the format of the data transmitted in the data link layer is a frame, and the receiver receives it through the physical layer and the data link layer before arriving at the network layer, it is necessary to know the MAC address of the host, that is, its hardware address, to send and receive data. If the MAC address of the received packet does not match that of the local machine, it will be discarded directly. If it matches, the error is delivered to the upper layer for processing after parsing.

-

two。 ARP workflow

When you need to know the MAC address of the destination host, you need to send an ARP request Datagram before sending the data frame, and this Datagram is sent to all hosts in the LAN, that is, in the form of a broadcast to tell the hosts in the LAN that they are looking for the MAC address of the host whose IP address is XXX.

When hosts receive this ARP Datagram, if the destination IP address in the request does not match their own IP, it will be discarded and not processed directly; when the IP address is the host that the source host is looking for, the ARP request will be processed, and then an ARP reply Datagram will be given to the source host that sent the ARP request, and its own MAC address will be filled in it.

Finally, after the source host receives the ARP reply Datagram, it processes it to get the MAC address, and then the data to be sent can be sent directly.

-

three。 ARP Datagram format

Whether it is the Datagram that sends the ARP request or the ARP reply Datagram, the format is as follows:

Where:

The Ethernet destination address is the MAC address of the destination host, with a total of 6 bytes. When ARP is sent as a request, it is not known, so it is full F; when ARP is a reply, the Ethernet destination address is the MAC address of the source host of the request.

The Ethernet source address is the MAC address of the sending ARP host, which is also 6 bytes. It is the source host MAC address as the request and the destination host MAC address as the reply.

The frame type is ARP,2 bytes to store.

The hardware type is the link layer network type that handles the current network. The current Ethernet is 1, which takes up 2 bytes.

Protocol type refers to the type of address to be translated. Currently, the IP address is to be translated, which still takes up 2 bytes.

The length of the hardware address is the length of the MAC address, which is 6 bytes, so the number "6" can be stored in one byte.

Protocol address length refers to the current IP address length, which can be stored with one byte. IPv4 is 4 bytes and IPv6 is 16 bytes.

An op of 1 indicates a request, and 2 indicates a reply

The Ethernet address on the sending side is the Ethernet address that sends the ARP Datagram, that is, the previous Ethernet source address, which is also 6 bytes of space.

The sender IP address is the IP address of the host that sent the ARP Datagram, 4 bytes

The destination Ethernet address is full F when the request is made, and the source host MAC address is 6 bytes when answered.

The destination IP address is the IP address of the destination host when requested, and the source host IP address when replying, 4 bytes

The 14 bytes in the first three parts are the header information of Ethernet, while the next 28 bytes are the request / reply payload information of the ARP Datagram.

-

Chestnut time:

Let's take a specific chestnut to analyze the information of the ARP Datagram above.

Because the minimum number of bytes of valid information in the Datagram in Ethernet is 46 and the maximum is 1500, there are not enough 46 bits in the ARP Datagram that need to be filled, and the content of the padding bits is not defined, which is related to the specific implementation.

The above Datagram is the ARP request Datagram, that is, the MAC address of the destination host requested by the source host. As can be seen from the above, the IP address of the source host is c0a8 0037, that is, 192.168.0.55, while the IP address of the destination host is c0a8 0002, that is, 192.168.0.2.

The following is a reply ARP to the above ARP request:

In the ARP request Datagram, the sender's IP is 192.168.0.55, and the receiver's destination IP is 192.168.0.2.

In the ARP reply Datagram, the IP of the sender is 192.168.0.2 and the receiver is 192.168.0.55

From the above analysis of the ARP request Datagram and the ARP reply Datagram, we can see that both hosts are the destination host and the source host. When a source host wants to send data to the destination host but does not know its MAC address, it can use the ARP request Datagram to request the MAC address of the destination clause in the local area network. When the destination host receives the ARP request Datagram, it finds that its requested IP address matches itself. An ARP reply is made and its own MAC address is populated so that after the source host receives the ARP reply Datagram, it can extract the MAC address of the destination host to send data.

"finish"

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report