One request and reply of ARP

Source: Internet
Author: User

Arp:

we know that the network layer and the network layer above the use of the IP address, but the actual network on the link to the transmission of data frames, the packet is first accepted by the network card to deal with the upper layer protocol, so ultimately the network must use the hardware address. However, there is no simple mapping between the IP address and the hardware address of the following network (for example, the IP address has 32 bits and the local area network hardware address is 48 bits) because of the different format. In addition, a new host may often be added to a network, or some hosts will be withdrawn. Replacing the network adapter also causes the host's hardware address to change. The Address Resolution Protocol (ARP) solves this problem by storing a mapping table from the IP address to the hardware address in the host ARP cache, and the mapping table is also updated dynamically (new or time-out deletions).

Each host has an ARP cache , which has the IP address of each host and router on the local area network to the hardware address of the mapping table, these are the host now know some of the address.


Ethernet frame (RFC 894) format:


650) this.width=650; "src=" http://s1.51cto.com/wyfs02/M01/80/03/wKioL1c0c0vguaw6AABvAqYa8F0196.jpg "title=" L2. JPG "alt=" Wkiol1c0c0vguaw6aabvaqya8f0196.jpg "/>

The source address and destination address refers to the network card's hardware address (also called MAC address), the length is 48 bits, is in the network card Factory curing. Take a look at the Ifcong command, the "HWaddr 00:0c:28:0f:35:e3" section is the hardware address. Frame Protocol Class

The Type field has three values, corresponding to IP, ARP, RARP, respectively. The end of the frame is the CRC check code.

The length of the data in the Ethernet frame specifies a minimum of 46 bytes, a maximum of 1500 bytes, and the length of the ARP and RARP packets is not 46 bytes, to be padded at a later bit. The maximum value of 1500 is called the Maximum Transmission Unit (MTU) of the Ethernet, and different network types have different MTU, and if a packet is routed from Ethernet to a dial-up link, the packet length is greater than the MTU of the dial link, then the packet needs to be fragmented (fragmentation). The output of the Ifcong command also has "mtu:1500", the concept of MTU, which is the maximum length of the payload in the frame, excluding the length of the frame header.

the format of the ARP datagram is as follows: 650) this.width=650; "src=" http://s2.51cto.com/wyfs02/M01/80/04/wKiom1c0SEaQpNjkAABfdab1dAU380.jpg "title=" L1 . JPG "alt=" wkiom1c0seaqpnjkaabfdab1dau380.jpg "/>


The source MAC address and the destination MAC address appear once in the Ethernet header and ARP requests, which is redundant for link layer Ethernet, but may be necessary if the link layer is a different type of network.


The hardware type refers to the link layer network type, 1 is Ethernet, the protocol type is the address type to be converted, 0x0800 is the IP address, the last two address lengths are 6 and 4 (bytes) for the Ethernet address and IP address, the OP field is 1 for the ARP request, and the OP field is 2 for the ARP reply.


Example: The request frame is as follows (in order to clearly add a byte count to the front of each line, 16 bytes per line):

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: Destination host with broadcast address, source host MAC address is 00:05:5D:61:58:A8, upper layer protocol class

Type 0x0806 represents ARP.

ARP frame: The hardware type 0x0001 represents the Ethernet, the protocol type 0x0800 represents the IP protocol, the hardware address (MAC address) length is 6, the Protocol address (IP address) length is 4,op for the 0x0001 to indicate the MAC address (ARP) of the destination host for the request, the source host MAC address 00:05: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).

Example: If the current link layer network type is Ethernet, the Network layer protocol is the IP protocol,

The Ethernet source address is MAC1 and the source IP address is IP1,

The Ethernet destination address is MAC2 and the destination IP address is IP2.

the ARP Request frame should be: ARP Reply frame:

Ethernet Destination Address: FF FF FF FF FF Ethernet Destination Address: MAC1

Ethernet Source Address: MAC1 Ethernet Source Address: MAC2

Frame type: 0806 frame type: 0806

Hardware type: Ethernet (0001) hardware type: Ethernet (0001)

Protocol type: IP Protocol (0800) protocol type: IP protocol (0800)

Hardware address Length: 6 bytes Hardware address length: 6 bytes

Protocol address Length: 4 bytes Protocol address length: 4 bytes

Op:1 Op:2

Send-side Ethernet address: MAC1 send-side Ethernet address: MAC2

Sender IP Address: IP1 send-side IP address: IP2

Destination Ethernet Address: 00 00 00 00 00 00 Destination Ethernet Address: MAC1

Destination IP Address: IP2 Destination IP Address: IP1




This article is from the "fringe" blog, so be sure to keep this source http://ab6107.blog.51cto.com/10538332/1772825

One request and reply of ARP

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.