ping returns IP from hosts file but not nslookup in windows 10 [duplicate]

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.


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.