An Unbuntu 17.04 VirtualBox VM, (running from an Ubuntu 16.04 host) suddenly stopped connecting to the Internet. The last time it was running all was well; then one day, at boot-up, it couldn’t connect to the Internet. Other Ubuntu VMs internet connections worked just fine. This wasn’t a problem with the host, it appeared to be isolated to the one VM.

I’m embarrassed to admit how long it took me to come to that concrete conclusion. I spent a great deal of time thinking the issue was either rooted in a VirutalBox issue or host-related issue. I went down several rabbit holes before it occurred to me that the problem was isolated to the VM.

The first pass to fix this issue was to disable IPv6 on the VM’s wired network settings. That didn’t do anything.

A bit more study indicated that the VM had somehow lost its DNS configuration. Google’s public DNS servers are at addresses 8.8.8.8 and 8.8.8.4, so I needed to figure out how to apply those addresses again–or so I thought. I added these addresses to the VM’s wired network connection. The DNS address boxes were empty so this seemed promising. Alas, adding them didn’t change anything. I later learned that these values associated with the wired connection didn’t do anything for the VM; they are, by default, empty on VirtualBox VMs. Leave ’em empty.

With even more Googling, a potential solution turned up on StackExchange. Its answer has you directly edit the /etc/resolv.conf file. Partly because it’s Ubuntu and partly because I was desperate, I edited this file even though comments in the file clearly say “DO NOT EDIT THIS FILE BY HAND — YOUR CHANGES WILL BE OVERWRITTEN.” I added these two lines to the file:

Amazingly this worked. Also, not so amazingly, just like the comments said, the changes didn’t persist across reboots. Something else was up.

What finally worked

What finally worked for me was a tip in an UbuntuGeek article. Ubuntu includes a lightweight DNS server called dnsmasq, It is included to server up machine names that aren’t in a public DNS. Apparently, the use of this server was conflicting with the VM’s ability to connect to the public DNS servers. Disabling this server may have unintended consqeuences on some machines, but on my VMs its absence is OK.

To disable it, edit the NetworkManager.conf file:

and comment out

changed to

What happened?

Why did this issue suddenly start occurring? I flat don’t know. What I do know, for sure, is that I didn’t explicitly change any network configuration settings from one boot to another–and right out the blue the damned thing quit working! If there had occurred on a Windows box I’d be inclined to blame Windows updates. So, maybe, this is related to an apt-get upgrade (which may well have been performed on the VM). But beyond that, I’m in the dark why it so randomly occurred. I do know it affected my productivity for a couple of hours!

Leave a Reply

Your email address will not be published. Required fields are marked *