Thursday, August 18, 2011
Find all the used ip address in LAN (single network)
You can use following command to find all the used ip address in LAN (single network
) from windows machine
FOR /L %i IN (1,1,254) DO ping -n 1 192.168.0.%i | FIND /i "Reply">> c:\ipaddresses.txt
The "-n 1" is for only 1 ping packet to be sent to each computer.
Change 192.168.0 to match you own Network ID.
This will ping all IP addresses on the 192.168.0.0 network segment and create a text file called IPADDRESSES.TXT in C:\, where it will list only the IP addresses that gave a reply.
You can use following script to find all the used ip address in LAN (single network
) from Linux/Unix machine
a=0
COUNT=4
IPRANGE="192.168.0"
while [ $a -le 254 ]
do
myHost=$IPRANGE""$a
count=$(ping -c $COUNT $myHost | grep 'received' | awk -F',' '{ print $2 }' | awk '{ print $1 }')
if [ $count -ne 0 ]; then
echo $myHost >> ipaddress
fi
a=`expr $a + 1`
done
Change 192.168.0(IPRANGE) to match you own Network ID.
This will ping all IP addresses on the 192.168.0.0 network segment and create a text file called ipaddress in current location, where it will list only the IP addresses that gave a reply.
No Response to "Find all the used ip address in LAN (single network)"
Leave A Reply