当前位置:网站首页>Ethernet ARP Protocol

Ethernet ARP Protocol

2022-06-24 23:34:00 qq_ forty-five million four hundred and five thousand six hundr

ARP Introduce

In Ethernet , One host communicates with another host , You must know the destination host MAC Address ( Physical address ), And purpose MAC The address is obtained by ARP The agreement is completed .

ARP(Address Resolution Protocol), Address resolution protocol , It's based on IP Address ( Logical address ) obtain MAC A kind of address TCP/IP agreement .

MAC The address in the network represents the address of the network card ID, Each network card requires and has only one MAC Address . In getting to the goal MAC After the address , Aim MAC Address updated to ARP Cache table There will be an expiration date , After the expiration, you need to re pass ARP Agreement to obtain .

ARP Mapping means that IP Address and MAC Address mapping , It is divided into static mapping and dynamic mapping .
         Static mapping refers to manually creating a ARP surface , hold IP Address and MAC Address Association . After manual binding , The source host before communicating , You can directly from ARP Find... Directly in the table IP Address corresponding MAC Address , But there are certain limitations to this , because MAC The address may change , To avoid these problems , It must be maintained and updated regularly ARP surface , This kind of is troublesome and will affect the network performance .

         Dynamic mapping refers to using the protocol to obtain the corresponding physical address , The word dynamic is used because the process is automatic , General application users or system administrators do not have to care about . There have been designed to implement dynamic mapping protocols ARP and RARP( Reverse Address Resolution Protocol ) Two kinds of ,ARP hold IP Address mapping to physical address ,RARP Map the physical address to IP Address .. among RARP There are few application scenarios , There is no expansion here . Here is a detailed introduction ARP

ARP Protocol is introduced

        ARP The agreement is divided into ARP Request and ARP The reply , The source host initiates the query for MAC The message of address is called ARP request , The destination host responds to the source host and sends a message containing the local message MAC The message of address is called ARP The reply .
When the host needs to find the physical address of another host in the network , It can send a ARP Request message , This message contains the sender's MAC Address and IP Address and recipient's address IP Address . Because the sender doesn't know the physical address of the receiver , So this query grouping will be carried out in the network layer radio broadcast , namely ARP The physical address of the receiver sent at the time of request is the broadcast address , use 48'hff_ff_ff_ff_ff_ff Express .

         Because of sending ARP The message sent by the requesting host in the network , Purpose MAC The address is the broadcast address , Therefore, all network devices will accept this message , And the purpose in the message IP With your own IP Contrast , If different, ignore , If it is the same, send a ARP Reply message .

        ARP Reply message Unicast form adopted , utilize ARP The requestor in the request IP Address and MAC Address , Send back ARP Request sender , tell ARP Requestor's own MAC Address .

        ARP The requestor received ARP After the answer , Analyze the information in the message MAC Address , Aim MAC Address and purpose IP Address updated to ARP The cache table . When again with the host A When communication , Can be directly from ARP Cache table , Instead of relaunching ARP Request message .ARP The entries in the cache table have expiration time ( It's usually 20 minute ), After expiration , Need to be re launched ARP Request for purpose MAC Address .

ARP Packet format  

Hardware type (Hardware type): Type of hardware address ,1 Represents the Ethernet address .
Protocol type (Protocol type): The type of protocol address to map ,ARP The upper layer of the agreement is IP agreement , Therefore, the protocol type is IP agreement , Its value is 0x0800.
Hardware address length (Hardware size): Hardware address (MAC Address ) The length of , In bytes . For Ethernet IP Address of the ARP To ask or answer , The value is 6.
Protocol address length (Protocol size):IP The length of the address , In bytes . For Ethernet IP Address of the ARP To ask or answer , The value is 4.
OP(Opcode): opcode , Used to indicate that the packet is ARP Request or ARP The reply .1 Express ARP request ,2 Express ARP The reply .
Source MAC Address : The hardware address of the sender .
Source IP Address : The protocol of the sender (IP) Address .

Purpose MAC Address : The hardware address of the receiving end , stay ARP The receiving end is unknown when requesting MAC Address , Therefore, this field is the broadcast address , namely 48’hff_ff_ff_ff_ff_ff.
Purpose IP Address : The protocol of the receiving end (IP) Address

Because the Ethernet frame data segment is the least 46 bytes , and ARP The total packet length is 28 byte , So in ARP The data segment needs to be filled with 18 Bytes of data , To meet the requirements of Ethernet transmission format . This filling process is called Padding( fill ), The filled data can be any value , But it's usually 0.

( notes : Reference punctual atom FPGA course , For learning records only )

原网站

版权声明
本文为[qq_ forty-five million four hundred and five thousand six hundr]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202211119283266.html