0

I've already fought many battles with WSL 2 and made progress here and there. My newest problem is this:

❯ nslookup localhost
Server:         10.10.30.132
Address:        10.10.30.132#53

Name:   localhost
Address: 127.0.0.1
Name:   localhost
Address: ::1

Why is our company DNS server involved in this? Shouldn't it say something like this without talking to anybody?

Server: 127.0.0.53
Address: 127.0.0.53#53

Non-authoritative answer:
Name: localhost.localdomain
Address: 127.0.0.1
Name: localhost.localdomain
Address: ::1

My Windows is build 19041.630 and my Ubuntu is Linux CL003356 4.19.128-microsoft-standard #1 SMP Tue Jun 23 12:58:10 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux.

My resolv.conf is not autogenerated and its contents are:

nameserver 10.10.30.132
nameserver 10.10.1.11

Also, fast start-up is already disabled.

1 Answer 1

3

It is true that many operating systems can resolve localhost without using DNS – e.g. by looking in /etc/hosts (as Linux does) or by using a hardcoded result (as Windows does).

However, when you run nslookup, you are explicitly asking it to use DNS. The nslookup program is not just a generic name lookup tool – it is a DNS client, or a name server lookup tool in other words. So it will never use the operating system's "general" name resolution functions; its results will always be obtained from whatever server is in your /etc/resolv.conf.

(As for your second example with 127.0.0.53 – that is still exactly the same thing; nslookup is talking to a DNS server running on the local machine, but only because that machine's /etc/resolv.conf has told it to. Not all systems run a local DNS server (in fact most don't), so this is not something that nslookup could automatically switch to when it detects a specific name.)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .