So I've set public IP on the hosts file for a certain public IP address, but it picks up private ip from nowhere or from DNS.

     Content of windows hosts file C:\Windows\System32\drivers\etc\Hosts

   nslookup my.domain.com

I want it to resolve to Public IP i assigned in the file, instead of the private IP it shows when I lookup my.publicdomain.com.

Anyway to fix this? Has anyone experienced such issue? ipconfig /flushdns does not help. Just saying.

1 Answer 1


nslookup does NOT use hosts file but DNS.

Try using ping instead and it will return the IP provided in your hosts file.

Setup the ip for this domain in a real DNS Server.

  • and then the Nslookup will work? I'm gonna try setting up a dns record for the IP and the host.
    – ajsdg
    Jun 10, 2015 at 18:58
  • This post says something confusing about the statement, as it says "The DNS server does not use its own local HOSTS file. It's only used by the local client side resolver that is trying to resolve the name you're pinging or using nslookup, etc, " Does this contradict the nslookup statement?
    – Efren
    Mar 1 at 2:22

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.