IP Address of the systems in the Network In Linux

1

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..

user1167385

Posted 2012-12-14T09:30:23.883

Reputation:

This is not a programming question. – unwind – 2012-12-14T10:56:16.287

and indeed, would belong in SuperUser. – CustomX – 2012-12-14T11:15:20.097

Check if rup or ruptime show something. – ott-- – 2012-12-14T15:02:36.003

Answers

1

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.

Tom Anderson

Posted 2012-12-14T09:30:23.883

Reputation: 1 341

1

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.

seumasmac

Posted 2012-12-14T09:30:23.883

Reputation: 336

0

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.

CustomX

Posted 2012-12-14T09:30:23.883

Reputation: 716

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 – 2012-12-15T22:24:09.343

ooh thanks! :) not that avid Linux user, but will definately try this in the future – CustomX – 2012-12-17T07:39:25.193

0

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}'

ruff

Posted 2012-12-14T09:30:23.883

Reputation: 31