October 29, 2017 | Leave a comment 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 220.127.116.11 and 18.104.22.168, 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: Default nameserver 22.214.171.124 nameserver 126.96.36.199 123 nameserver 188.8.131.52nameserver 184.108.40.206 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: Default sudo vim /etc/NetworkManager/NetworkManager.conf 12 sudo vim /etc/NetworkManager/NetworkManager.conf and comment out Default dns=dnsmasq 12 dns=dnsmasq changed to Default #dns=dnsmasq 12 #dns=dnsmasq 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!