The role of the ARP protocol
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/80/07/wKiom1c0mVqydAgmAAATOj3fTuQ973.png "title=" see. png " alt= "Wkiom1c0mvqydagmaaatoj3ftuq973.png"/>
What to do
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/80/04/wKioL1c0mEKhznOKAAAhBW9yaSc287.png "title=" Untitled _ Look at the picture king. png "alt=" Wkiol1c0mekhznokaaahbw9yasc287.png "/>
3. Each host maintains an ARP cache table that can be viewed with the arp-a command.
4. Format of ARP datagrams
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/80/11/wKiom1c117ricnD6AAD4yzuwW8s281.png "title=" capture. PNG "alt=" Wkiom1c117ricnd6aad4yzuww8s281.png "/> First 14 bytes for Ethernet header, Ethernet destination address and Ethernet source address for MAC address, source address known, Destination address unknown, FF FF FF FF FF Padding, type refers to the upper-level protocol type, there are 3 kinds of--IP (0800), ARP request/reply (0806), Rarp request/reply (8035)
After 28 bytes, take ARP request/reply as an example
A. Hardware type refers to the link layer network type, 1 is Ethernet
B. Protocol type refers to the type of address to be converted, 0x0800 is an IP address,
C. The last two address lengths for Ethernet addresses and IP addresses are 6 and 4 (bytes), respectively,
D. The OP field is 1 for the ARP request, and 2 for the ARP reply.
5. Example
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/80/0F/wKioL1c16xiTrnHJAAEU8CniHys725.png "title=" capture. PNG "alt=" Wkiol1c16xitrnhjaaeu8cnihys725.png "/>
Analysis
1. The request frame is as follows
Ethernet Header (14 bytes)
0000:FF FF FF FF FF 5d A8 08 06
Arp Frame (28 bytes)
0000:00 01
0010:08 (5d) A8 C0 A8 00 37
0020:00 XX C0 A8 00 02
Fill bit (18 bytes)
0020:00 D2 50 10
0030:FD D3 00 00 00 00 00 00 00 00
Ethernet Header: The destination host uses broadcast address, the MAC address of the source host is 00:05:5d:61:58:a8, and the upper protocol type 0x0806 represents ARP.
ARP frame: Hardware type 0X0001 represents Ethernet, protocol type 0x0800 represents IP protocol, hardware address (MAC address) length is 6, protocol address (IP address) length is 4,op for 0x0001 to request destination host MAC address (ARP), source host MAC address 00:0 5:5d:61:58:a8, the source host IP address is C0 A8 00 37 (192.168.0.55), the destination host MAC address full 0 to fill, the destination host IP address is c0 A8 00 02 (192.168.0.2).
Since Ethernet specifies a minimum data length of 46 bytes, the arp frame length is only 28 bytes, so there are 18 byte padding bits, the content of the fill bit is not defined and is related to the specific implementation.
2. The answer frame is as follows:
Ethernet Header (14 bytes)
0000:00 5d A8 5d A1 B8 40 08 06
Arp Frame (28 bytes)
0000:00 01
0010:08 5d A1 B8 C0 A8 00 02
0020:00 5d A8 C0 A8 00 37
Fill bit (18 bytes)
0020:00 D2 50 10
0030:FD D3 00 00 00 00 00 00 00 00
Ethernet Header: The MAC address of the destination host is 00:05:5D:61:58:A8, the MAC address of the source host is 00:05:5d:a1:b8:40,
The upper-level protocol type 0x0806 represents ARP.
ARP frame: Hardware type 0X0001 represents Ethernet, protocol type 0x0800 represents IP protocol, hardware address (MAC address) length is 6, protocol address (IP address) length is 4,op for 0x0002 answer, source host MAC address is 00:05:5d:a1:b8:40, SOURCE Master
Machine IP Address is c0 A8 00 02 (192.168.0.2), the destination host MAC address is 00:05:5D:61:58:A8, the destination host IP address is
C0 A8 00 37 (192.168.0.55).
This article is from the "sunshine225" blog, make sure to keep this source http://10707460.blog.51cto.com/10697460/1773200
ARP datagram format