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.dev, client2.dev, etc. Normally those fake top-level domains resolve to a localhost IP: 127.0.0.1. 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
	address 10.254.254.254
	network 10.0.0.0
	netmask 255.0.0.0

sudo service networking restart

Dnsmasq

Now instead of having your fake TLDs resolve to 127.0.0.1, we need them to resolve to our loopback alias address – 10.254.254.254. 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
OR
sudo vi /etc/dnsmasq.d/01_localhost

address=/dev/10.254.254.254

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 10.254.254.254 for network connectivity. Then try to ping a .dev domain from the guest. If it looks good you should be able to load a .dev domain through Internet Explorer on the guest OS.

Leave a Reply