Skip to content

Instantly share code, notes, and snippets.

@levmichael3
Created June 14, 2015 09:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save levmichael3/c9d90368048e992d53db to your computer and use it in GitHub Desktop.
Save levmichael3/c9d90368048e992d53db to your computer and use it in GitHub Desktop.
#!/bin/bash
debug=''
debug=''
is_dead_ping()
{
# echo "is_dead_ping $1 ?"
ping -c 1 $1 > /dev/null
if [ $? -ne 0 ]; then
# echo $1 is down
return 0
else
return 1
fi
}
for i in 192.118.70.{1..255}
#for i in 10.200.92.{21..41}
#for i in 192.168.50.{220..249}
do
is_dead_ping $i
if [ $? -eq 0 ]
then
j=`echo $i | sed 's/118/168/g'`
# echo " $i Free! Now $j"
is_dead_ping $j
if [ $? -eq 0 ]
then
echo " **** IP networks are free: $i and $j"
fi
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment