ping B C类网

ping C类网 地址
 
#!/bin/bash
for I in $(seq 1 255) ; do
 if ping -c1 -W1 192.168.0.$I &> /dev/null;then
  echo "192.168.0.$I is online."
 else
  echo "192.168.0.$I is offline."
 fi
done
 
 
ping B类网 地址
 
#!/bin/bash
for M in $(seq 1 255);do
  for I in $(seq 1 255);do
   if ping -c1 -W1 192.168.$M.$I &>/dev/null;then
    echo "192.168.$M.$I is online."
   else
    echo "192.168.$M.$I is offline."
   fi
  done
done

作者: xyqcuijia   发布时间: 2010-12-17