8

Background

I have a device plugged into my Windows PC via Ethernet. The device is running an mDNS service and has its own hostname (gp800-49d1a).

From WSL, I can ping gp800-49d1a with success, and I can nslookup gp800-49d1a with the following result:

Server:         172.30.176.1
Address:        172.30.176.1#53

Non-authoritative answer: Name: gp800-49d1a.local Address: 169.254.93.130 Name: gp800-49d1a.local Address: fe80::e700:63f:1807:adf2

I can get the IP address 169.254.93.130. Connecting on this address works. Everything is correct up to this point.

Problem

When I run nslookup gp800-49d1a from Windows Command Prompt, I get the following result:

Server:  dns.google
Address:  8.8.8.8

*** dns.google can't find gp800-49d1a: Non-existent domain

When I run ping gp800-49d1a from Windows Command Prompt, it works fine.

So for some reason nslookup from WSL is OK, but nslookup from Windows is not.

Additional Info

I can access my device from Google Chrome just fine using the hostname. It seems both Chrome and WSL know how to find the mDNS entry, but nslookup from Windows Command Prompt does not.

Question

Since nslookup doesn't find my device from Windows Command Prompt, what else can I use to get the IP address of my device from Windows?

nullromo
  • 513

2 Answers2

19

As mentioned in u1686_grawity's answer, nslookup from Windows Command Prompt does not work with mDNS.

To get the IP address of a device you can use the PowerShell command Resolve-DnsName <hostname>.

> Resolve-DnsName gp800-49d1a

Name Type TTL Section IPAddress


gp800-49d1a.local AAAA 120 Answer fe80::e700:63f:1807:adf2 gp800-49d1a.local A 120 Answer 169.254.93.130

nullromo
  • 513
16

nslookup is exclusively a DNS client, not an mDNS client nor a generic hostname lookup tool. It completely ignores the whole "hostname lookup" system that the OS has, instead manually sending DNS packets to one server (the first server it finds in the OS-provided list).

The only reason it works in WSL is because you're talking to the DNS service ('Dnscache') running on the Windows host, which then proxies queries to all mechanisms it supports (including mDNS which is handled by 'Dnscache' on Windows).

Even in this case, however, the Linux nslookup still bypasses normal Linux hostname lookup, instead doing DNS manually, and it still thinks it is only talking unicast DNS to one specific server that it finds in /etc/resolv.conf – it only happens that that server performs this translation without nslookup's knowledge.

When you run it directly on Windows, however, that doesn't happen – nslookup talks to the DNS server at 8.8.8.8, and that server has no clue about your .local mDNS hostnames.

grawity
  • 501,077