Skip to content

Instantly share code, notes, and snippets.

@benfairless
Last active August 29, 2015 14:14
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 benfairless/b1b47f41709e6a95fe14 to your computer and use it in GitHub Desktop.
Save benfairless/b1b47f41709e6a95fe14 to your computer and use it in GitHub Desktop.
Test for free IP addresses
#!/bin/bash
echo "Test of free IP addresses in 192.168.4.0/24 - Generated $(date +%d/%m/%Y\ %H:%M)"
for i in {1..254}; do
ADDR=192.168.4.$i
ping -c 1 $ADDR 2>&1 >/dev/null
if [ $? != 0 ]; then
echo "FREE - $ADDR"
else
echo "USED - $ADDR"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment