9

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
            210.210.210.10 my.domain.com

   nslookup my.domain.com
            10.10.10.10
            10.10.10.11
            10.10.10.12

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.

Greg Askew
  • 34,339
  • 3
  • 52
  • 81
ajsdg
  • 101
  • 1
  • 1
  • 5

1 Answers1

21

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.

krisFR
  • 12,830
  • 3
  • 31
  • 40
  • and then the Nslookup will work? I'm gonna try setting up a dns record for the IP and the host. – ajsdg Jun 10 '15 at 18:58
  • This [post](https://social.technet.microsoft.com/Forums/en-US/8f8b7ffb-1dfb-4cf7-be27-67cf76731a39/nslookup-unable-to-resolve-host) 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 01 '22 at 02:22