因为测试需要,需要查看检测子网的通信情况,因为未知原因,有点虚拟机能ping通,有的ping,故需要对已存在的虚拟都进行扫描
写了一个脚本来检测存在的主机

#!/bin/bash 
# 文件名: ping.sh
for ip in 192.168.$1.{1..255} ; 
do
(
    ping $ip -c2 &> /dev/null ;
    if [ $? -eq 0 ];
    then
    echo $ip is alive
    fi
    )&
done 
wait 

执行./ping.sh 1
检查子网内存活的主机

相关文章:

  • 2021-12-01
  • 2022-12-23
  • 2021-08-22
  • 2021-09-28
  • 2021-12-07
  • 2021-08-11
  • 2021-12-26
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-05-16
  • 2022-01-12
  • 2021-08-01
  • 2022-02-04
  • 2020-04-17
  • 2021-11-26
相关资源
相似解决方案