Professional Webmasters Community
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Finding the working IP in LAN in Linux

Go down

Finding the working IP in LAN in Linux Empty Finding the working IP in LAN in Linux

Post  andry Wed Aug 04, 2010 3:35 am

If you are on a LAN and wish to find out which computers in it currently have access to that certain LAN, you can use the following command:

for ip in $(seq 1 254); do ping -c 1 192.168.1.$ip>/dev/null; [ $? -eq 0 ] && echo “192.168.1.$ip UP” || : ; done

This will ping each computer on the 192.168.1.x subnet one time, with a one second interval between pings. The output should be something like

192.168.1.1 UP
192.168.1.17 UP
192.168.1.24 UP


Alternatively, you can use netdiscover:

sudo apt-get install netdiscover
netdiscover -r 192.168.1.0/24

This will scan all the computers in that particular address range and present the active ones in a table that also provides a MAC address and a MAC Vendor line.
andry
andry
Moderator
Moderator

Posts : 467
Join date : 2010-05-07

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum