Making the Switch to VirtualBox
Until recently I’ve been using VMware Fusion for my testing needs. With the release of Snow Leopard, Fusion no longer cut it. It was buggy on SL, and lacked 64-bit capability. Since I’ve set my system to boot 64-bit by default Fusion didn’t work at all. I’ve also grown quite dissatisfied with VMware ESX.
Enter VirtualBox. VirtualBox is free (no more $70 upgrades!) and has a headless (server) mode. I’ve been using Vbox for a couple of months now with one problem. I need to be able to SSH into my VMs, and I use Avahi to make this easy.
Manoj over at Sun describes setting up port forwarding. This is both a pain in the ass and exposes my guests outside my host. Neither of which I want.
I have my VMs configured with NAT networking. The most straightforward way to solve this would be to switch to Bridged, but that again exposes them. Reading the VirtualBox User Manual I found host-only networking which “can be used to create a network containing the host and a set of virtual machines, without the need for the host’s physical network interface.” Perfect. I added a second interface to my Debian guest and everything started working, kind of. Avahi and Bonjour were getting confused between the two virtual interfaces and my physical interfaces. Avahi was broadcasting on all interfaces, and that was getting received in weird ways on my Mac.
According to the Avahi documentation, it can’t ignore or skip an interface, but it fails to operate on interfaces without multicast. Turning off multicast sure enough allows me to ssh into my guests using mDNS name resolution.
Here’s my final config:
- Interface in NAT mode for Internet access
- Interface in Host-Only mode for host access
- Avahi installed with the ssh.service configured
- Multicast disabled on the NAT interface