How to tell what service is resolving a name on Windows?

2

1

Is there an equivalent to the unix host command on Windows? I'm not looking for nslookup; I know what the DNS resolution of the name is. I want a simple way to tell if my local hosts file or NetBIOS is resolving the name and taking precedence. I'm also aware that I could accomplish this with ping, but it seems like there should be a specific tool.

A. Ford

Posted 2015-12-21T19:34:12.413

Reputation: 33

I am not sure I understand your question... host performs DNS lookup – Eddie Dunn – 2015-12-21T19:38:11.370

Not sure about the tool you want but this will tell you everything you need to know about windows name resolution. https://support.microsoft.com/en-us/kb/172218

– Eddie Dunn – 2015-12-21T19:41:56.940

can't you check if your hosts file is taking precedence by making it translate to something incorrect? – barlop – 2015-12-21T19:44:18.227

What does host give you that nslookup does not? – heavyd – 2015-12-21T20:16:01.480

@heavyd host resolves via all possible methods defined in /etc/nsswitch.conf (including the /etc/hosts file if included there). nslookup only uses DNS. – roaima – 2015-12-21T20:55:58.523

Answers

3

Is there an equivalent to the unix host command on Windows?

No.

I mean it. I know that many times people are reluctant to say "No" to a question like this, but if you're looking for software built into Windows, then the answer is "No". Windows is a finite set of code, which comes with a certain number of commands. Using NSLookup or ping, as you already described, are the fastest available ways using the tools that do come bundled with Windows. Unix systems often have another option, called "host", which seems to be less commonly known. Windows has not provided that same option, nor an equivalent.

By the way, the "host" command is often bundled with BIND (which now also comes with dig), and BIND does have a Windows port. So if you really do want the "host" command, you can probably download it as part of the BIND package. But, it's not built in.

Since you mentioned NetBIOS, I can also point out nbtstat (e.g., "nbtstat -n" may show some names).

If you want to know where the name is coming from, that would be an issue that is getting handled by the "resolver". (The term "resolver" is where the main part of Unix's /etc/resolv.conf filename comes from.) The resolver doesn't really have its own command to interact. In newer versions of Microsoft Windows (including Windows XP, not including Windows 98 as I recall), minimal interaction with the resolver was added to some other commands that are not resolver-specific. IPConfig/displaydns and IPConfig/flushdns may be the closest thing; "netsh dnsclient /?" (and related, like "netsh dnsclient show /?") also seems related to the resolver, but doesn't get you closer to the type of info you seem to be seeking.

I found that when I placed a name in my hosts file, IPConfig/displaydns showed a Time To Live value of zero (unlike an actual DNS entry that I looked up). So there is a built-in tool that may get you some details that you're looking for, but you probably won't be finding the details as straightforward and convenient as the "host" command, because the information won't be condensed. (You'll probably be needing to scroll back, or redirect the output.) What you're asking for just simply isn't part of what actually does come with Windows.

TOOGAM

Posted 2015-12-21T19:34:12.413

Reputation: 12 651