I use VirtualBox for my VMs. My office network setup is wireless, i.e. I connect to my company's WiFi network, which has a local DNS to resolve local names (such as something.mycompany.com going to 123.45.67.89). When I build a new VM, it can connect to the outside internet inheriting the host's connection but it doesn't resolve local names using the local DNS. So I have to go into /etc/hosts
on the VM and manually make an entry after I resolve the name on the host, which is annoying.
Is there a way to have VirtualBox automatically connect the guest to the host's DNS so that I do not have to do this manual step? My host is OSX Mountain Lion, the VMs are typically Ubuntu but I doubt that should matter.
Best Answer
To enable DNS Proxy Mode using the host's resolver, run the following command:
As a result, guest OS DNS requests will be intercepted and resolved using host DNS API, rather than having guest OS connect to external DNS servers as with
--natdnsproxy1 on
.You can get the name of the VM by running
VBoxManage list runningvms
.