Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.


timmmay

20858 posts

Uber Geek
+1 received by user: 5350

Trusted
Lifetime subscriber

#312113 18-Mar-2024 20:22
Send private message

I've just run into and solved a problem based on this difference. Basically I had an old line in my hosts file that meant I couldn't resolve two domains, so when I changed hosting for PiHole / Home Assistant from a server on one IP to a server on another IP it took me two days to work out what was going wrong.

 

I had my server on 192.168.1.42, but I turned that server off and moved it to 192.168.1.12. For some reason I had this entry in my hosts file

 

192.168.1.42 homeassistant.local

 

When I issued an nslookup it returned what I expected to see

 

nslookup homeassistant.local

 

> 192.168.1.12

 

Whereas when I issued a ping command I saw the truth

 

ping homeassistant.local

 

> 192.168.1.42

 

Ping returns the actual IP that Windows is going to send the request to, whereas nslookup looks up the domain from your DNS server. Therefore if you have defined anything in your hosts file nslookup can't see it, but ping can.

 

Two days it took me to work this out. Well, about 3 hours over two days, but still frustrating!


Create new topic

This is a filtered page: currently showing replies marked as answers. Click here to see full discussion.

snj

snj
305 posts

Ultimate Geek
+1 received by user: 221


  #3207785 18-Mar-2024 23:16
Send private message

muppet:

 

Seems like a bug with ping - why doesn't it follow the same name resolution path?

 

 

Not a bug actually, just a confusing thing with Windows, especially due to people that say nslookup is the equivalent of *nix 'host'.

 

nslookup is specifically a tool to query a DNS server, (basically the Windows equivalent to bind's dig and so on), so doesn't rely on the host's resolution configuration, except to retrieve the default DNS server addresses.

 

ping refers to the OS's resolution functions which includes the hosts file and so forth.

 

From what I can tell there isn't a Windows equivalent of the *nix host command. 


Create new topic








Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.



Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.