Tuesday, December 13, 2011

Using Arping To Scan An IP Range For Duplicate IP Addresses

This script will scan an IP range for duplicate IP addresses using the arping command (Linux). Firstly you will need to install arping – in Ubuntu this can be done using the command:

sudo apt-get install arping


Then we need to create the bash script below. Make sure you customise the IP range to suit the range you want to scan. In the below example the script just appends the last number in the IP address sequence so you can only do 254 addresses in a single hit.



for i in $(seq 1 254);
do
echo "Checking 192.168.196.${i}";
sudo arping -q -d -i eth0 -c 2 192.168.196.${i}; [ $? -ne 0 ] && echo "192.168.196.${i} duplicate";
done



Now run this script from the command line to scan the IP range.

No comments:

Post a Comment