Ubuntu 17.04 connects to network but not the Internet
Posted on: Sunday, Dec 17, 2017
An Ubuntu 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.
It took an embarrassing amount of time to come to that conclusion. I spent a great deal of time thinking the issue was either rooted in a VirutalBox issue or a host-related issue, which lead down several rabbit holes before 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 126.96.36.199 and 188.8.131.52, so I needed to figure out how to apply those addresses again--or so it seemed. 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. More study later showed 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 out of desperation, I edited this file even though comments in the file clearly say "DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN" by adding these two lines to the file:
nameserver 184.108.40.206 nameserver 220.127.116.11
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:
sudo vim /etc/NetworkManager/NetworkManager.conf
and comment out
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!