Skip to content

Instantly share code, notes, and snippets.

@fapestniegd
Created August 1, 2011 14:38
Show Gist options
  • Select an option

  • Save fapestniegd/1118251 to your computer and use it in GitHub Desktop.

Select an option

Save fapestniegd/1118251 to your computer and use it in GitHub Desktop.
#!/bin/bash
NETWORK=$1
if [ -z ${NETWORK} ]; then
echo "Usage: $0 10.20.30 (for 10.20.30.x)"
exit 1;
fi
for h in `seq 1 254`; do
NAME='';
ping -i c3 -w3 ${NETWORK}.${h} >/dev/null 2>&1 || \
NAME=$(dig +short -x ${NETWORK}.${h}) ;
if [ -z "${NAME}" ]; then
echo ${NETWORK}.${h};
fi;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment