Finding dynamic IP addresses
|
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
« Previous 1 2 3 4 Next »
Buy this article as PDF
Pages: 5
(incl. VAT)