[ function]
Manages the ARP cache for the system.
[ description]
The ARP cache used to manage the system, commonly used commands include:
ARP: Displays all the table entries.
arp-d address: Deletes an ARP table entry.
Arp-s Address hw_addr: Sets an ARP table entry.
1. View the ARP table:
1[Email protected]222- the- -- -:~# arp #查看arp表2 Address hwtype hwaddress Flags Mask Iface3U50 etherxx: -: 9e:9c: $: theC eth14u52 ether c8:0a:a9: $: -: B1 C eth15U54 etherxx: -: 9e:9c: $: ad C eth16 222.132.16.49EtherTen: -: the: at: -:d 9 C Br0
2. View the ARP table and display it with IP instead of host name:
1[Email protected]222- the- -- -: ~# arp-N2 Address hwtype hwaddress Flags Mask Iface3 10.0.0.50Etherxx: -: 9e:9c: $: theC eth14 10.0.0.52Ether c8:0a:a9: $: -: B1 C eth15 10.0.0.54Etherxx: -: 9e:9c: $: ad C eth16 222.132.16.49EtherTen: -: the: at: -:d 9 C Br0
3. View the ARP table and display the host name and IP:
1U50 (10.0.0.50) atxx: -: 9e:9c: $: the[ether] on eth12U52 (10.0.0.52) at C8:0A:A9: $: -: B1 [ether] on eth13U54 (10.0.0.54) atxx: -: 9e:9c: $: ad [ether] on eth14? (222.132.16.49) atTen: -: the: at: -:d 9 [ether] on br0//? Indicates that the IP is not hard-resolved on this computer
4 . Add a pair of IP and mac address bindings:
#arp-S 10.1.1.1 00:11:22:33:44:55:66 #如果网络无法达到, then an error is reported
PS: Under normal circumstances can not succeed, slightly chicken!!
5. Delete an ARP table entry:
# arp-d 10.0.0.54
#arp-I eht1 10.0.0.54 #指定网卡删除;
6. Specify the MAC address of the reply:
#/usr/sbin/arp-i Eth0-ds 10.0.0.2 eth1 Pub
When Eth0 receives a request with an IP address of 10.0.0.2, it will be answered with Eth1 's MAC address.
For example, a dual-NIC machine runs this command:
/usr/sbin/arp-i Eth0-ds 10.0.0.2 eth1 Pub
There will be one more item:
10.0.0.2 * <from_interface> MP eth0
ARP usage under Linux