文章目录
- 今天遇到个奇葩的问题
今天遇到个奇葩的问题
今天遇到个奇葩的问题,我把我们192.168.1.116的盒子ip改成192.168.2.116后,再改回来,发现我们盒子的http服务始终无法访问,用Advanced IP Scanner扫描一下,发现就能访问了。
但是过了一会,发现又不能访问了。
在windows上用arp -a
命令查看,发现ip地址192.168.1.116对应的mac地址,与我们的盒子不符:
arp -a
猜测是局域网存在ip冲突了,用Advanced IP Scanner探测192.168.1.116的时候,获取到了我们盒子的mac,更新到了电脑的arp缓存里,但是过了一会,冲突的设备又把它的mac地址更新到我们的arp缓存里了,所以导致访问不了我们的服务。
我把我们盒子网线拔了,然后再用Advanced IP Scanner探测192.168.1.116,发现果然有一台冲突设备:
理论上来说,只要把这台设备ip改成其他的,就不会与我们盒子ip冲突了。
我本来想直接在路由器把这台设备的mac给禁用了,但是我们领导把路由器密码给忘了,我只能在办公室用排除法看是哪台设备,但是找了好久,还是没找出来,同事都在联网,也不好断网排查,ԾㅂԾ,
后面一台设备一台设备排查,终于找到了,是我们同事的一台手机,自动分配ip的时候分配到192.168.1.116了。
但是令人纳闷的是,为啥用Advanced IP Scanner工具查询的时候,同事的手机会显示为UBUNTU??估计是Advanced IP Scanner工具的bug吧,现在我同事的手机显示正常了:
局域网主机间通信的时候,是需要先通过arp广播请求获取到主机的mac地址的,拿到mac地址后才能通信,如果本机有arp缓存,就直接用缓存里的,不用广播。
正常不存在如上ip冲突的情况下, arp缓存不用去修改的,它会自动维护,但有时如果遇到问题,我们通过查看本机arp缓存,能更好地定位问题。
windows、linux通用查询本机arp缓存命令:
arp -a
ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ
ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ ᅟᅠ