I set up a new testing environment for IE11 through VirtualBox on my computer running Ubuntu. But I couldn’t get to any of my sites that are served by the Ubuntu host. I had to do some tricks to get this working on my old work Mac, and the same principle applies for Ubuntu.

On my Ubuntu system, I use Dnsmasq for local DNS so I can test sites locally like client1.test, client2.test, etc. Normally those fake top-level domains resolve to a localhost IP: But when you bring VirtualBox into the mix, the host and the guest both have their own notions of localhost. We need a common ground to communicate on. This is solved with a loopback alias.

Loopback Alias

A loopback alias is just another IP that you can assign to your localhost loopback device. To add one, add the following to your network interfaces configuration file:

sudo vi /etc/network/interfaces

auto lo:0
iface lo:0 inet static

sudo service networking restart


Now instead of having your fake TLDs resolve to, we need them to resolve to our loopback alias address – Depending if you’re using Dnsmasq with or without NetworkManager, you can edit/add the following file (respectively):

sudo vi /etc/NetworkManager/dnsmasq.d/01_localhost
sudo vi /etc/dnsmasq.d/01_localhost


sudo service network-manager restart

VirtualBox Networking

Lastly, we just need to tell our VirtualBox guest to use the DNS from our host system. These instructions work for both OSX and Linux hosts: https://serverfault.com/questions/453185/vagrant-virtualbox-dns-10-0-2-3-not-working/453260

I’m using the 2nd option to make the guest use the host’s DNS settings:

VBoxManage modifyvm "VM name" --natdnshostresolver1 on

Test everything out by starting your VM guest and pinging for network connectivity. Then try to ping a .test domain from the guest. If it looks good you should be able to load a .test domain through Internet Explorer on the guest OS.

2 thoughts on “VirtualBox: connect to Ubuntu host served website

  1. Pingback: Chaining DNSMasq and resolved - Justin Foell

  2. Pingback: XPS 13 Developer Edition Settings - Justin Foell

Leave a Reply