Suppose you just connect a Raspberry Pi to your home network using ethernet interface, and the Pi is not connected to a display device. How would you find an IP of that Raspberry Pi?
Well, you’re right…whatever you say. There are a few ways to do this - looking at DHCP log, router log, …etc. But here is an even easier way to achieve this - using a command line tool called nmap
.
The following is an example of using nmap
to scan all IPs within the a network range:
❯ nmap -sn 192.168.10.0/24
Starting Nmap 7.80 ( https://nmap.org ) at 2021-07-02 19:23 AEST
Nmap scan report for foreman.home.lan (192.168.10.11)
Host is up (0.00045s latency).
Nmap scan report for 192.168.10.109
Host is up (0.00057s latency).
Nmap scan report for 192.168.10.134
Host is up (0.00036s latency).
Nmap scan report for 192.168.10.135
Host is up (0.00086s latency).
Nmap done: 256 IP addresses (5 hosts up) scanned in 3.17 seconds
You can learn more about nmap
by, you guess it, running man nmap
!