Wednesday, September 25, 2013

VirtualBox - Allowing one hosts file to rule them all

So, I started using a nice feature on VirtualBox for simple DNS mappings. If you are using a NAT interface on your guest virtual machine, you can set up the host to resolve DNS requests for each guest. This is especially handy for me when setting up host-only networks for guests because it eliminates the need for a dedicated DNS server and I can simply rely on the host OS for lookups. Simply run the following for each guest VM you want it to apply to:

VBoxManage modifyvm "My VM Name" --natdnshostresolver1 on

Now, you can configure some simple DNS using the hosts file on your host machine and the guest VMs will see the changes as if you edited the hosts file on each of them. Of course, if you have more robust needs, running a dedicated DNS server will probably be more appropriate.

No comments:

Post a Comment