MAC地址冲突 手动添加ARP

664 阅读1分钟

arp -a 192.168.0.88

发现MAC是一个未知地址

arp -d 192.168.0.88 删除此arp缓存

再次ping 192.168.0.88后,又发现arp自动添加了这个未知的MAC地址。

最终解决虚IP切换的思路:增加了两个脚本arp_start.bat arp_stop.bat

加载时,绑定自己的MAC到这个IP

释放时,绑定对方的MAC到这个IP。

arp -d 192.168.0.88
netsh  -c  "i  i" add neighbors  11  “192.168.0.88” “00-0c-29-d9-e7-1d“

当使用arp -s无法将ip和mac绑定的时候,可以使用一下命令来绑定。

netsh i i show in
然后找到网线或网卡对应的idx

netsh -c "i i" add neighbors 11 "网关IP" "Mac地址"
这里11是idx号。

例如:netsh -c "i i" add neighbors 11 192.168.0.1 00-01-02-03-04-05

同理,删除也不能用arp -d

netsh -c "i i" delete neighbors IDX

**解决方法,通过添加自动脚本解决:

arp_start.bat :
arp -d 192.168.9.63
netsh -C "i i" add neighbors 12 "192.168.9.63" "00-50-56-0A-0B-0C"

arp_stop.bat :
arp -d 192.168.9.63
netsh -C "i i" add neighbors 12 "192.168.9.63" "00-50-56-91-BF-53"

arp , netsh 后面的具体IP 地址、mac 地址等参数,可根据客户环境调整。**