arp

From RaySoft

arp manipulates the kernel's ARP cache in various ways. The primary options are clearing an address mapping entry and manually setting up one. For debugging purposes, the arp program also allows a complete dump of the ARP cache. [1]

NOTE:
This program is obsolete. For replacement check ip neighbor. [1]

Documentation

Parameters

-d HOST, --delete HOST
Remove any entry for the specified HOST. This can be used if the indicated host is brought down, for example.
-f FILE, --file FILE
Similar to the -s option, only this time the address info is taken from FILE set up.
-n, --numeric
Shows numerical addresses instead of trying to determine symbolic host, port or user names.
-s HOST HARDWARE-ADDRESS, --set HOST HARDWARE-ADDRESS
Manually create an ARP address mapping entry for HOST with HARDWARE-ADDRESS set to hardware address class, but for most classes one can assume that the usual presentation can be used.

Examples

Convert the ARP cache list to JSON with jc, remove some attributes and output it nicely with jq
arp -a | jc --arp | jq 'del(.[].name, .[].permanent)'

Output:

[
  {
    "address": "10.0.0.1",
    "hwtype": "ethernet",
    "hwaddress": "0:0:5e:0:1:1",
    "iface": "en9"
  },
  {
    "address": "10.0.0.6",
    "hwtype": "ethernet",
    "hwaddress": "b8:69:f4:1:70:b1",
    "iface": "en9"
  }
]

References

  1. 1.0 1.1 F. N. van Kempen. "arp(8)." die.net. https://linux.die.net/man/8/arp (accessed 06.05.2023)