命令
arp
描述
manipulate the system ARP cache
显示ARP缓存,MAC地址表
用法
1 2 3 4 5
| arp [-vn] [<HW>] [-i <if>] [-a] [<hostname>] <-Display ARP cache arp [-v] [-i <if>] -d <host> [pub] <-Delete ARP entry arp [-vnD] [<HW>] [-i <if>] -f [<filename>] <-Add entry from file arp [-v] [<HW>] [-i <if>] -s <host> <hwaddr> [temp] <-Add entry arp [-v] [<HW>] [-i <if>] -Ds <host> <if> [netmask <nm>] pub <-''-
|
选项
1 2 3 4 5 6 7 8 9 10 11 12
| Options: -a display (all) hosts in alternative (BSD) style -e display (all) hosts in default (Linux) style,默认选项 -s, --set 添加一条arp记录 -d, --delete 删除一条arp记录 -v, --verbose be verbose -n, --numeric 不解析主机名 -i, --device 指定网卡接口,如eth0 -D, --use-device 读取指定设备接口的mac地址 -A, -p, --protocol specify protocol family -f, --file 读取并添加指定文件中的记录,默认文件为/etc/ethers <HW>=Use '-H <hw>' to specify hardware address type. Default: ether
|
注意
无
示例
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| $ arp -V net-tools 2.10-alpha
$ arp -a gateway (192.168.80.2) at 00:50:56:eb:3a:16 [ether] on eth0 ? (192.168.80.81) at 00:50:56:3f:16:9b [ether] on eth0 $ arp -e Address HWtype HWaddress Flags Mask Iface gateway ether 00:50:56:eb:3a:16 C eth0 192.168.80.81 ether 00:50:56:3f:16:9b C eth0
$ arp -i eth0 -s 192.168.80.20 00:50:56:11:22:33 $ arp Address HWtype HWaddress Flags Mask Iface gateway ether 00:50:56:eb:3a:16 C eth0 192.168.80.81 ether 00:50:56:3f:16:9b C eth0 192.168.80.20 ether 00:50:56:11:22:33 CM eth0
$ arp -i eth0 -d 192.168.80.20 $ arp Address HWtype HWaddress Flags Mask Iface gateway ether 00:50:56:eb:3a:16 C eth0 192.168.80.81 ether 00:50:56:3f:16:9b C eth0
$ more file 192.168.10.10 00:50:56:10:10:10 192.168.10.11 00:50:56:10:10:11 192.168.10.12 00:50:56:10:10:12 $ arp -i eth0 -f file $ arp Address HWtype HWaddress Flags Mask Iface gateway ether 00:50:56:eb:3a:16 C eth0 192.168.80.81 ether 00:50:56:3f:16:9b C eth0 192.168.10.10 ether 00:50:56:10:10:10 CM eth0 192.168.10.11 ether 00:50:56:10:10:11 CM eth0 192.168.10.12 ether 00:50:56:10:10:12 CM eth0
|