Created
April 5, 2018 13:45
-
-
Save zhanglongqi/9b0d11e9499e0c47ccbae3d37468dd08 to your computer and use it in GitHub Desktop.
ping the ip in a network segment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
ip=1 | |
while [ $ip != "254]; do | |
ping 192.168.0.$ip -c 2 | grep -q "ttl=" && echo "192.168.0.$ip yes" || echo "192.168.0.$ip no" | |
ip=`expr "$ip" "+" "1"` | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
ip="10.10.152." | |
for i in `seq 1 254`; do | |
sudo ping -i 0.01 -c 1 $ip$i | grep -q 'ttl=' && echo "$ip$i online"|| echo "$ip$i offline" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment