Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am looking for a linux command that can be used to find the IP addresses of the different systems connected in the same network. All the systems are running Fedora 14.

Thanks in Advance..

share|improve this question

migrated from stackoverflow.com Dec 14 '12 at 12:39

This question came from our site for professional and enthusiast programmers.

    
This is not a programming question. –  unwind Dec 14 '12 at 10:56
    
and indeed, would belong in SuperUser. –  CustomX Dec 14 '12 at 11:15
    
Check if rup or ruptime show something. –  ott-- Dec 14 '12 at 15:02

4 Answers 4

I don't think there's a fully general way to do this. However, there are a couple of things you could try.

One is to run arp -a. This will print the current state of the ARP cache, which contains the IP addresses and MAC addresses of every local machine that your machine has communicated with recently. This is the information you need, but only for a subset of the hosts on the network.

Another is to use multicast. Are your machines running Avahi? If so, you can make mDNS queries on them; try running avahi-browse -at.

I originally thought that a side-effect of this would be that your machine communicates with the machines advertising mDNS resources, which would bring their details into the ARP cache, which you could then list as above. However, this seems not to be the case.

However, what you can do is ask for a resolution of the advertised services, which obtains the machines' IP addresses. You can then extract these from avahi-browse's output. Like so:

avahi-browse -atr | egrep -o '[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*' | sort -u

This will only find machines advertising services via mDNS, but there's a good chance that this is all your machines; modern Linux systems advertise a Workstation service, for some reason.

share|improve this answer

nmap is definitely the command you're looking for. You can do:

nmap -sn 192.168.10.0/24

to scan everything on a 192.168.10.0/24 network. To do a more in depth scan of a specific machine, you could try:

nmap -A -T4 192.168.10.12

for example. Note: you'll need 'sudo' or root to enable some of the scan functions, but not for a basic ping.

share|improve this answer

I wouldn't know of such a command, but you could use a piece of software. Angry IP scanner is the one I use in Windows and I found a Linux version too.

share|improve this answer
    
A more linux-ey program would be nmap, which is very commonly used for things like this. Try issuing "sudo nmap -sP xxx.xxx.xxx.xxx/24" , where the x's are your computer's IP address. –  Arkenklo Dec 15 '12 at 22:24
    
ooh thanks! :) not that avid Linux user, but will definately try this in the future –  CustomX Dec 17 '12 at 7:39

Combine nmap and arp for best results especially if there is iptables involved :

(this is for android, so change few things)


echo "running LIST scan..." 
su -c "/data/data/jackpal.androidterm/nmap/nmap -sL 10.0.7.240-254 >/dev/null 2>&1" 
echo "running PING scan..." 
su -c "/data/data/jackpal.androidterm/nmap/nmap -sP 10.0.7.240-254 >/dev/null 2>&1"
echo "------------------------------"
arp|grep ether|awk '{print $2,$4}'

share|improve this answer

Your Answer

 
discard

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