Score:0

21.04: Failure to resolve .local hostname from within VM (VMware Workstation)

in flag

TL;DR: What do I need to configure so I can resolve a .local hostname on my VM guest as if I was resolving it on my VM host.

Long version: I'm running a VM with Ubuntu 21.04 on my Windows 10 using VMware Workstation (16.1.1 build-17801498). Ubuntu itself is almost vanilla, I've changed next to nothing about the OS/env itself (actually nothing comes to mind right now). Maybe it's noteworthy I upgraded from a previous version of Ubuntu, I believe it was 20.04.

On the host, I can resolve foo.bar.local just fine using nslookup:

> nslookup foo.bar.local
Server:  <...>
Address:  10.73.1.9

Name:    <...>
Address:  10.132.0.30
Aliases:  foo.bar.local

On the guest, the same attempt to resolve fails by default

> host foo.bar.local
Host foo.bar.local not found: 2(SERVFAIL)

but I can resolve the name if I tell host to use the same DNS server which responded earlier on the (VM) host:

> host ordermanagement-migration.comventure.local 10.73.1.9
Using domain server:
Name: 10.73.1.9
Address: 10.73.1.9#53
Aliases: 

foo.bar.local is an alias for hello.world.local.
hello.world.local has address 10.132.0.30

So I was thinking "why not just use that server always?" and tried to configure it via the network manager GUI: open network settings, go to IPv4 tab, disable "automatic" and enter the IP in the field. Since my VM has two interfaces configured (host-only network & normal NAT for public inet access) and just to be safe, I did this for both interfaces. To my surprise no amount of waiting time after confirming those changes actually led to an observable change in the output of systemd-resolve --status: For both interfaces, it just kept the respective a.b.c.1 address as DNS server. Instead, I had to first dis- then enable the interfaces, after which the server IP is showing up:

Global
       Protocols: -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
resolv.conf mode: stub

Link 2 (ens33)
    Current Scopes: DNS
         Protocols: +DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
Current DNS Server: 10.73.1.9
       DNS Servers: 10.73.1.9

Link 3 (ens38)
Current Scopes: none
     Protocols: -DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported

Link 4 (docker0)
Current Scopes: none
     Protocols: -DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported

I didn't understand why for ens38 (public inet access), no DNS server was shown anymore at all. At this point things got even more confusing because enabling an interface (in network manager) on which I had previously disabled "automatic" for DNS suddenly showed "automatic" as enabled but also listed the manual DNS IP and systemd-resolve --status yet I still could not resolve foo.bar.local.

I've also tried to set 10.73.1.9 as the primary DNS server directly in the NAT/DNS settings of VMware workstation but to no avail.

So how can I get foo.bar.local to be resolvable on my (VM) guest by default, in other words without having to specify 10.73.1.9 as nameserver to use - which I cannot do in the application context where I need foo.bar.local resolvable.

addendum: There is a VPN involved on my VM host in case that might be relevant. I keep it enabled & connected at all times when using the (VM) host.

ru flag
Adding a VPN setup will override the DNS servers if the remote VPN server says "Use these DNS servers instead". That's likely interfering with your DNS resolution.
Amnu avatar
in flag
You mean the VPN setup instructs VMware to override its own DNS settings ? Is there a way to disable this ?
ru flag
It instructs *Ubuntu* to change the DNS settings, this is usually the case when you have a 'corporate' environment and want to use split DNS and such. Disabing can only be done on the remote VPN side of things where they change settings or such on the server (so not an option for you). The only otherw way to override this is, post activation of the VPN, run a separate script to set the DNS yourself. Alternatively, alter `/etc/systemd/resolved.conf` and set `DNS=` to your primary DNS server you want - uncommenting the line of course - then restarting your computer.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.