Bootstrap FreeKB - nmap - Resolve IP to hostname (-n and -R flags)
nmap - Resolve IP to hostname (-n and -R flags)

Updated:   |  nmap articles

By default, nmap is set to sometimes resolve an IP address to hostname and uses reverse DNS (meaning that an IP address is resolved to a hostname) lookup. Nmap uses a custom stub resolver, not your primary or secondary DNS servers.

In this example, the -sn option is used to determine if a host (e.g. a target system) is up may return something like this. In this example, IP 192.168.0.16 is resolved to hostname server1.example.com and 192.168.0.17 is not resolved to a hostname.

nmap -sn 192.168.0.0/24

Nmap scan report for server1.example.com (192.168.0.16)
Host is up (0.00063s latency).
Nmap scan report for 192.168.0.17
Host is up (0.00059s latency).

 

The -R flag can be used to always resolve an IP address to hostname.

nmap -sn 192.168.0.0/24

Nmap scan report for server1.example.com (192.168.0.16)
Host is up (0.00063s latency).
Nmap scan report for server2.example.com (192.168.0.17)
Host is up (0.00059s latency).

 

The -n flag can be used to never resolve an IP address to hostname.

nmap -sn -n 192.168.0.0/24

Nmap scan report for 192.168.0.16
Host is up (0.00063s latency).
Nmap scan report for 192.168.0.17
Host is up (0.00059s latency).

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter b1d70e in the box below so that we can be sure you are a human.