• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# arp
2
3
4## Command Function
5
6Hosts on an Ethernet communicate with each other using MAC addresses. IP addresses must be converted into MAC addresses to enable communication between hosts on a LAN (Ethernet). To achieve this purpose, the host stores a table containing the mapping between IP addresses and MAC addresses. This table is called an Address Resolution Protocol (ARP) cache table. Before sending an IP packet to a LAN, the host looks up the destination MAC address in the ARP cache table. The ARP cache table is maintained by the TCP/IP stack. You can run the **arp** command to view and modify the ARP cache table.
7
8
9## Syntax
10
11arp
12
13arp [_-i IF_] -s *IPADDR HWADDR*
14
15arp [_-i IF_] -d *IPADDR*
16
17
18## Parameters
19
20**Table 1** Parameter description
21
22| Parameter| Description| Value Range|
23| -------- | -------- | -------- |
24| No parameter| Prints the content of the ARP cache table.| N/A |
25| -i IF | Specifies the network port. This parameter is optional.| N/A |
26| -s&nbsp;IPADDR<br>HWADDR | Adds an ARP entry. The second parameter is the IP address and MAC address of the other host on the LAN.| N/A |
27| -d&nbsp;IPADDR | Deletes an ARP entry.| N/A |
28
29
30## Usage Guidelines
31
32- The **arp** command is used to query and modify the ARP cache table of the TCP/IP stack. If ARP entries for IP addresses on different subnets are added, the protocol stack returns a failure message.
33
34- This command can be used only after the TCP/IP protocol stack is enabled.
35
36
37## Example
38
39Run **arp**.
40
41ARP cache table information:
42
43```
44OHOS # arp
45Address                 HWaddress               Iface       Type
46192.168.1.10            E6:2B:99:2C:4B:20       eth0        static
47```
48
49**Table 2** Parameter description
50
51| Parameter| Description|
52| -------- | -------- |
53| Address | IPv4 address of the network device.|
54| HWaddress | MAC address of the network device.|
55| Iface | Name of the port used by the ARP entry.|
56| Type | Whether the ARP entry is dynamic or static. A dynamic ARP entry is automatically created by the protocol stack, and a static ARP entry is added by the user. |
57