The ARP command can view the ARP cache or manually add and remove entries from the cache.
Command format
ARP [-EVN] [-H type] [-I. If]-a [hostname]
ARP [-v] [-i if]-d hostname [PUB]
ARP [-v] [-H type] [-i if]-s hostname hw_addr [temp]
ARP [-v] [-H type] [-i if]-s hostname hw_addr [netmask NM] Pub
ARP [-v] [-H type] [-i if]-ds hostname IFA [netmask NM] Pub
ARP [-VND] [-H type] [-I. If]-f [filename]
Command parameters
-V,--verbose
Output detailed information.
-N,--numeric
Displays the address in digital form.
-H type,--hw-type type,-t type
Specifies what type of ARP entry to check, the default type is ether, the other values are Arcnet (arcnet), Pronet (pronet), ax25ax.25, Netrom (Net/rom), and so on.
-A [hostname],--all [hostname]
Displays the ARP entries for a specific host and displays all entries if no host is specified. The entries will be displayed in BSD style.
-d hostname,--delete hostname
Deletes the ARP entry corresponding to the specified host.
-E
Displays the ARP entry in the default style.
-I if,--device if
Specifies a network interface, such as eth0.
-S hostname hw_addr,--set hostname
Set the ARP entry manually.
-f filename,--file filename
Similar to the-s option, only the address information is taken from the specified file, and if no file is specified,/etc/ethers as the specified file. The contents of each line of the file are physical addresses and host names separated by spaces.
Instance
A) View the ARP cache.
[Email protected] ~]$ arpaddress hwtype hwaddress Flags Mask Iface10.1.241.254 ether C0 : 67:af:45:9d:3f C eth010.1.241.145 ether fa:1a:3e:b3:17:62 c eth010.1.241.253 Ether 00:1c:54:ff:08:13 C eth0
b) only display the ARP cache for eth0.
[Email protected] ~]$ arp-i eth0address hwtype hwaddress Flags Mask Iface10.1.241.254 ether c0:67:af:45:9d:3f C eth010.1.241.145 ether fa:1a:3e:b3:17:62 c eth0
c) Manual ARP entry, bind 10.1.241.253 with 00:1c:54:ff:08:13.
[Email protected] ~]$ arp-s 10.1.241.253 00:1c:54:ff:08:13
d) Delete the ARP entry corresponding to the 10.1.241.253 host.
[Email protected] ~]$ arp-d 10.1.241.253
Linux command-ARP: ARP cache for the operating system