neil on the web!

virtualbox and dns

2009 Jul 22

I think that my problems with virtualbox networking have to do with both OS X and the way that VirtualBox handles NAT in the virtual machine. I seems that if the DNS entries on the host change then the DNS settings in the guest do not change. I often rotate through four different network connections during the day: home, 3G usb modem, cafe, work. Each will have different DNS settings.

The OS X Network Preferences - Advanced - DNS will show the current servers for an active connection.

I know that I could simply hand amend /etc/resolv.conf to the current DNS.

My second solution saves copies of /etc/resolv.conf for the connections that I use regularly and to use a shell script to save a copy of the current /etc/resolv.conf and then copy over the current DNS settings. I therefore use a script for each connection.

Now that I know that this system works I intend to evolve the shell script to accept a variable for the connection name. One script will handle many connections.