linux中使用 arp -a命令可查看ARP缓存表
也可以使用ip neigh命令。
ip neigh或ip neighbour输出当前内核里的neighbour table,即查看arp表信息。
·看具体接口下的arp缓存条目
ip neighbor show dev ens33
·看具体某个网段的arp缓存条目
ip neighbor show 192.168.0.0/24
·若发现缓存被污染或不正确了,需要arp刷新
ip neighbor flush dev ens33
注记:mac地址就没有了,需要重新学习。
·添加或删除静态ARP项
使用net-tools:
$ sudo arp -s 192.168.1.100 00:0c:29:c0:5a:ef
$ sudo arp -d 192.168.1.100
使用iproute2:
$ sudo ip neigh add 192.168.1.100 lladdr 00:0c:29:c0:5a:ef dev eth0
$ sudo ip neigh del 192.168.1.100 dev eth0
添加arp代理
ip neighbor add proxy 192.168.0.1 dev ens37