ARP, Address Resolution Protocol. In an Ethernet LAN, when a data frame is exchanged between hosts, it is done through a MAC address. Therefore, when one of the Ethernet hosts sends a packet to the host of another IP address, it needs to know the MAC address of the destination IP address in order to send the IP packet past.
Working process:
Host A (192.168.0.10) sends an IP packet to Host B (192.168.0.20), and host a needs to encapsulate the IP packet in an Ethernet data frame to be sent, at which point the MAC address of Host B needs to be known. If host A does not know the MAC address of Host B, it sends a broadcast data frame on the network with the destination MAC address "FF." Ff. Ff. Ff. Ff. FF ". Equivalent to asking on the local area network: "What is the MAC address of the 192.168.0.20". All hosts under the same subnet receive a data frame, but only B receives the data frame and replies to the data frame, which is equivalent to the following: "192.168.0.20 's MAC address is 12-22-3e-34-4r-6d".
ARP cache:
Usually, each host will have its own ARP cache, which holds the corresponding MAC address of each IP address, when sending packets, first check whether the ARP cache has an IP address and the corresponding record of the MAC address, if not, the ARP parsing.
ARP cache entries are divided into static and dynamic, static entries are specified by the administrator, and they are fixed. Dynamic entries, which are automatically deleted if an entry in the cache table is not used for a certain amount of time. On the other hand, when the corresponding relationship between IP address and MAC address changes, it can be updated in time.
ARP command:
-N does not perform domain name resolution
-S addr hw Add a static ARP entry
-A addr view specified IP address ARP entry
-D addr Delete the specified address ARP entry
-F File Imports the ARP entries specified in file files into the ARP cache (default is/etc/ethers)
[[Email protected] ~]# arp-naddress hwtype hwaddress Flags Mask Iface192.168. 0.1 ether c8:3a:2f: F0 C
[Email protected] ~]#Ping 192.168.0.106PING192.168.0.106(192.168.0.106) About( -) bytes of data. -Bytes from192.168.0.106: icmp_seq=1Ttl= - Time=2.04Ms -Bytes from192.168.0.106: icmp_seq=2Ttl= - Time=0.326Ms -Bytes from192.168.0.106: icmp_seq=3Ttl= - Time=0.482Ms
[[Email protected] ~]# arp-naddress hwtype hwaddress Flags Mask Iface192.168. 0.1 ether c8:3a:2f:f0 C eth0192.168. 0.106 ether : ea:a7: A4 C eth0
Linux Service Erection--arp command