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

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

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




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




Comments

Web design by yours truely - me, myself, and I   |   jeremy.canfield@freekb.net   |