I went through old threads on this forum and tried --resolve-all but it doesn't seem to work.

If I use nmap -sn <hostname> It throws an error Failed to resolve <hostname>

If I use nmap -sn --resolve-all <hostname> It still throws an error Failed to resolve <hostname>

How to resolve this hostname and then perform nmap scan? It's not resolving the IP.

  • I have to ask. Are you actually providing a hostname or are you literally using <hostname>? For examples (and for a test that will work) use example.com instead.
    – schroeder
    Jul 1 at 7:22
  • Can you ping or reach the IP or domain at all through other means? This could be simply a network issue.
    – schroeder
    Jul 1 at 7:23
  • Is your DNS server OK?
    – dan
    Jul 31 at 19:41

Hostname resolution is done using DNS. If the DNS server does not return an IP address to the given hostname then nmap cannot magically do better. All one can do is choose a different name server than the default using the --dns-servers option. One need to specify one which can resolve the hostname and which is reachable by nmap.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.