arp
Command Function
On an Ethernet, hosts communicate with each other using MAC addresses (non-IP addresses). Therefore, IP addresses must be converted into MAC addresses so that hosts can communicate with each other on a LAN (Ethernet). To resolve this issue, the host stores a table containing the mapping between IP addresses and MAC addresses, that is, the ARP cache table. When the host needs to send an IP packet to the destination IP address on a LAN, the host can query the destination MAC address from the ARP cache table. The ARP cache table is maintained by the TCP/IP protocol stack. You can run the arp command to view and modify the ARP cache table.
Syntax
arp
arp [-i IF] -s IPADDR HWADDR
arp [-i IF] -d IPADDR
Parameters
Table 1 Parameter description
Adds an ARP entry. The second parameter is the IP address and MAC address of the other host on the LAN. |
||
Usage
- The arp command is used to query and modify the ARP cache table of the TCP/IP protocol stack. If ARP entries for IP addresses on different subnets are added, the protocol stack returns a failure message.
- This command can be used only after the TCP/IP protocol stack is enabled.
Example
Example: