Finding dynamic IP addresses

Slashdot it! Delicious Share on Facebook Tweet! Digg!

Ping and Fping

The Ping utility is also frequently used to track down computers situated on the network. However, this utility only works when the network permits transport of ICMP packets. The same restriction applies to the other tools presented here because they are based on the same protocol.

Listing 6 shows a Bash one-liner that searches for assigned IP addresses in the range between 192.168.55.11 and 192.168.55.22. The command delivers a small list of responses from the queried hosts as its output.

Listing 6

Pinging Several IPs

$ for i in $(seq 11 22); do ping -c 1 "192.168.55.$i" | grep "bytes from"; done
64 bytes from 192.168.55.11: icmp_seq=1 ttl=64 time=0.623 ms
64 bytes from 192.168.55.14: icmp_seq=1 ttl=64 time=3.64 ms
64 bytes from 192.168.55.16: icmp_seq=1 ttl=64 time=7.11 ms
64 bytes from 192.168.55.22: icmp_seq=1 ttl=64 time=0.839 ms

Those wanting to get by typing fewer entries can turn to Fping for IPv4 and Fping6 for IPv6 [8]. Listing 7 shows a call similar to Listing 6. The parameters -a and -q help restrict output to live IP addresses. The -g option generates a target list from the supplied starting and ending IP addresses. Alternatively it accepts a netmask.

Listing 7

Fping

$ fping -aqg 192.168.55.11 192.168.55.22
192.168.55.11
192.168.55.14
192.168.55.16
192.168.55.22

The Versatile Nmap Scanner

If the output from Ping and Fping is not sufficient, it is time to take a look at Nmap [9] and its graphical front end, Zenmap. Specifying the -sP conditions and the network help to fish out the IP addresses for all accessible hosts (Listing 8). If it can, Nmap also delivers the names of the hosts (Figure 1).

Listing 8

Nmap

$ nmap -sP 192.168.69.*
Starting Nmap 6.47 ( http://nmap.org ) at 2016-04-25 09:54 CET
Nmap scan report for 192.168.69.1
Host is up (0.00098s latency).
[...]
Nmap scan report for fritz.box (192.168.69.67)
Host is up (0.00052s latency).
Nmap done: 256 IP addresses (5 hosts up) scanned in 2.32 seconds
Figure 1: The graphical front end Zenmap creates a summary of the scan results from Nmap and offers additional information about each host.

Buy this article as PDF

Express-Checkout as PDF

Pages: 5

Price $0.99
(incl. VAT)

Buy Ubuntu User

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content