Vmware Workstation: DNS not working with NAT

1 minute read

Lately, I have been experiencing a funny network issue when using VMware Workstation VMs with NAT interface. Roughly, the IP network was working fine, but DNS resolution was not anymore. It happened intermittently, but I could see that this mainly happened when I was suspending my laptop, going to another location and resuming.

Forcing the VM to use a public DNS would solve the issue.

1. Background

Here is a bit of background. This happened on a Ubuntu Intrepid host, using VMware Workstation 6.5.2 build-156735, but I expect the same behaviour to happen with previous releases of Ubuntu, or even other Linux host as well as previous versions of Workstation and VMware Server. I can’t confirm it though as I don’t really want to spend time testing that ;).

At home, my host DNS is at, while at work, it is Let say that I am at home, my host /etc/resolv.conf looks like:


Now, when I resume my laptop at work, network manager would set the DNS servers to:


Meaning that the old DNS server entry was kept, and the new one was appended to the list.

2. Analysis

The host would still be able to resolve names as it uses the first entry, and then, when it has no reply, uses the second one.

In the guest though, DNS would fail. After a bit of tcpdumping, nmapping… I found out that DNS queries were resolved, but for some reason, the queries where not returned to the guest.

Checking the trace, I could see that queries were still first done to my home DNS server, e.g /dev/null, then came the query to my office DNS server.

All this was going through the vmnet8 IP stack.

3. The Fix

Seeing that my old DNS entry was still in my /etc/resolv.conf which was useless, I decided to remove it…. and that was it!!

So, if my /etc/resolv.conf looked like:


The VMs could resolve names! In other words, only the first DNS entry result was sent back to the VM.

So, here you go, if you hit this issue, just make sure that your first DNS server is active 😉

Hoping this will help some of you.