Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In my work there is a lot of computer and I want make a joke. I can close computer over the network but finding IP addresses is hard to me.

How can I easily find all online IP adresses from 192.168.1.aa to 192.168.1.zz?

share|improve this question
3  
try angry ip scanner – Web-E Dec 2 '12 at 11:37
    
possible duplicate of How to find unused IP Address on a network? – Lekensteyn Dec 2 '12 at 11:50
up vote 47 down vote accepted

Generally, nmap is useful to quickly scan networks.

To install nmap, enter

sudo apt-get install nmap

Once it is installed, enter

nmap -sP 192.168.1.0/24

This will show you which hosts responded to ping requests on the network between 192.168.1.0 and 192.168.1.255.


For newer nmap, use -sn (as -sP is deprecated in favor of -sn):

nmap -sn 192.168.1.0/24
share|improve this answer
1  
Not all hosts respond to pings. ARP is the way to go, at least in IPv4. – Marcin Kaminski Dec 2 '12 at 15:28
    
thats enough for me and it works on internet – user84277 Dec 2 '12 at 19:35
    
is it just my computer, or does this command take forever to run? – JohnMerlino Apr 14 '14 at 0:18
1  
Note, to speed up nmap scan you should add -T4 (speed) and -n (numeric only) flags. – Serg Aug 7 '15 at 21:55
    
Remember that you need sudo for nmap command, otherwise zero results is returned. – machineaddict Mar 14 at 11:27

If all the computers in your network are Ubuntu or any other distribution that makes use of avahi-daemon (DNS-SD), you can get a detailed list of them (with hostname and IP address) by doing:

avahi-browse -rt _workstation._tcp

If you want to know all the IP addresses used in your network, you can use arp-scan:

sudo arp-scan 192.168.1.0/24

As it is not installed by default, you'll have to install it with sudo apt-get install arp-scan. arp-scan send ARP packets to the local network and displays the responses received, so it shows even firewalled hosts (that block traffic based on IP packets).

share|improve this answer
3  
This command is definitely better than the one above. Running nmap took ages, but this one replied instantly with the nodes in the specified network. – JohnMerlino Apr 14 '14 at 0:19
    
In my case, very often, arp-scan doesn't find all the devices associated to my wireless network. Now, for example, sudo arp-scan 192.168.2.0/24 shows 2 results (.1 and .1), while nmap -sn 192.168.2.0/24 shows 4 results (.1, .2, .3 and .4). So, it seems that nmap is more accurate (I know for sure that there is 4 devices attached to the network). Why is this? – tigerjack89 Mar 26 at 16:12
    
Maybe I found the answer in a comment to another question. "It should be noted that some devices might not show up unless they are turned on. My nexus 4 won't show up unless the screen is on." However, it's interesting that the same devices always respond to pings from nmap. – tigerjack89 Mar 26 at 16:22

Netdiscover can be your answer.

To install via terminal:

sudo apt-get install netdiscover

example usage :

sudo netdiscover -r 192.168.1.0/24 -i wlan0

An IP with MAC Addreses will show on your terminal. See the screenshot

enter image description here

hope help you

reference

share|improve this answer

nmap would be my #1 choice, but what if you don't have it ? The DIY way would be with a ping script that goes through each possible ip address on the network manually. What we have here is just while loop, where we set last number in the address, make silent single ping to the address, check if the command succeed or not (and if it did succeed,then host is obviously up ), and printf statement. Quick and dirty way, took me about 10 mins to write it, but runtime might be a bit slow,though.

#!/bin/sh
# set -x
NUM=1

while [ $NUM -lt 256  ];do 
    ping -q -c 1 192.168.0.$NUM > /dev/null 
    RESULT=$(echo $?)
    if [ $RESULT -eq 0 ]; then 
        printf 192.168.0.$NUM"\n"
    fi
    NUM=$(expr $NUM + 1)
done
share|improve this answer
    
I like this kind of solution – Szenis Aug 7 '15 at 21:50

fping is a great tool to scan multiple hosts on a network via ICMP. If not installed, you can install it by:

sudo apt-get install fping

fping sends ICMP ECHO_REQUEST packets and mark a host as Up if it gets ECHO_RESPONSE from the host.

For example, to scan the hosts of subnet 192.168.1.0/24, you can do:

fping -g 192.168.1.0/24

For a specific number of hosts e.g. from 192.168.1.15 to 192.168.1.140:

fping -g 192.168.1.15 192.168.1.140

fping is highly configurable e.g. how many packets will be sent, the time to wait for response, output format etc.

Check man fping to get more idea.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.