判断局域网内是否有冲突的IP
- 作者: 从一数到八
- 来源: 51数据库
- 2022-09-21
#!/bin/bash # yum -y install arp-scan #check whether the ip is conflict conflict_ip=`arp-scan -I eth0 -l | grep "^[172.16|192.168|10]" | sort | uniq -c | sort -nr|sed 's/^[ \t]*//g'|grep "^2"` count=`arp-scan -I eth0 -l | grep "^[172.16|192.168|10]" | sort | uniq -c | sort -nr|sed 's/^[ \t]*//g'|grep "^2"|wc -l` if [ $count -gt 0 ];then echo -e "\033[31m conflict \033[0m" echo -e "conflict ip is \n $conflict_ip " else echo "not conflict." fi
推荐阅读
