ARP Datagram delivery format

Source: Internet
Author: User

I. ARP

ARP protocol is run in network System Data Link layer protocol, used in LAN, when know to send destination host IP address and port number but do not know MAC address, need to use ARP is also called Address Resolution Protocol; Because the data link layer transmits the data format is the frame, The receiver is received by the physical layer and the data link layer before reaching the network layer, therefore, in the data transmission is required to know the host's MAC address is the hardware address to send and receive data, if the received packet's MAC address does not match the native, then directly discarded; After parsing the error is delivered to the previous layer of processing.

-------------------------------------------------------------------------------------------


Two. ARP workflow

    1. When you need to know the destination host's MAC address, before sending a data frame, you need to send an ARP request datagram, and this datagram is sent to all hosts in the LAN, that is, in the form of broadcasting to tell the host in the LAN to look for the IP address of the host computer is xxx MAC address;

    2. When the host receives this ARP datagram, if the destination IP address in the request does not match its own IP, it is discarded directly, and when the IP address is the host that the source host is looking for, the ARP request is processed, and then the source host sending the ARP request is given an ARP reply datagram. and fills in the MAC address of its own;

    3. And finally the source host receives the ARP reply datagram, then processing obtains the MAC address, can send the data directly to transmit passes;

-------------------------------------------------------------------------------------------


Three. ARP datagram format

The datagram that sends the ARP request, whether it is an ARP reply datagram, has the following format:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/80/04/wKioL1c0kd2QuxIOAAAfGWRg1HQ995.png "title=" ARP datagram. png "alt=" Wkiol1c0kd2quxioaaafgwrg1hq995.png "/> Where:

    • Ethernet Destination address is the destination host's MAC address, a total of 6 bytes, when ARP as a request is not known, so it is all F; When ARP is answered, the Ethernet destination address is the source host MAC address of the request;

    • The Ethernet source address is the MAC address of the sending ARP host, is also 6 bytes, as the request is the source host MAC address, as the answer is the destination host MAC address;

    • The frame type is arp,2 bytes to store;

    • The hardware type is the link layer network type that handles the current network, currently Ethernet is 1 and occupies 2 bytes;

    • The protocol type is the type of address to be converted, the IP address is currently being converted, and still occupies 2 bytes;

    • The length of the hardware address, which is the length of the MAC address, is 6 bytes, so the number "6" can be stored in a single byte;

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

    • OP is 1, and 2 means answer;

    • The send-side Ethernet address is the Ethernet network address that sends the ARP datagram, which is the previous Ethernet source address, which is also a 6-byte space;

    • The sending IP address is the host IP address that sends the ARP datagram, 4 bytes;

    • Destination Ethernet address When the request is full F, the answer is the source host MAC address, 6 bytes;

    • The destination IP address is the IP address of the destination host when requested, and the IP address of the source host when it is answered, 4 bytes;


The first three parts 14 bytes is the Ethernet header information, and the subsequent 28 bytes are the request/Response payload information of the ARP datagram;


-------------------------------------------------------------------------------------------

Chestnut Time:

The following is a specific chestnut to analyze the above ARP datagram information;

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/80/09/wKioL1c1dL_h_cAXAAAxLFK_M_s250.png "title=" ARP request. png "alt=" Wkiol1c1dl_h_caxaaaxlfk_m_s250.png "/>

Because the minimum number of bytes in the datagram in the Ethernet is 46 and the maximum is 1500, there is not enough 46 bits in the ARP datagram to fill, and the content of the padding is not defined, and it is related to the concrete implementation;

The above data reported as ARP request datagram, that is, the source host request destination host MAC address, from the above can be seen, the source host IP address is C0 A8 00 37 is 192.168.0.55, and the destination host IP address is C0 A8 00 02 is 192.168.0.2;


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

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/80/09/wKioL1c1elfiA2goAACOvGi7sTk976.png "title=" ARP reply. png "alt=" Wkiol1c1elfia2goaacovgi7stk976.png "/>

In the ARP Request datagram, the send-side IP is 192.168.0.55, the receiving end is the destination IP 192.168.0.2;

In the ARP reply datagram, the sender IP is 192.168.0.2 and the receiver is 192.168.0.55;


From the above to the ARP Request datagram and ARP Reply datagram analysis can be seen, two hosts as the destination host and the source host, when a source host to send data to the destination host but do not know its MAC address, you can use the ARP request datagram in the local area network to request the main clause of the MAC address, When the destination host receives the ARP request datagram to find the IP address of its request, it will make an ARP reply and populate it with its MAC address, so that the source host receives the ARP reply datagram and extracts the destination host's MAC address to realize the sending data.



Finish

This article is from the "Knock Code good Sleep zzz" blog, please be sure to keep this source http://2627lounuo.blog.51cto.com/10696599/1773034

ARP Datagram delivery format

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.