Enabling VirtualBox SSH on IPv6 (Linux Host, Linux Guest)

This is a quick article describing how to SSH to a VirtualBox machine from the host machine, written for VirtualBox 4.1.18 Fedora. The standard choice – bridged networking – doesn’t work when the host has an IPv6 address.

According to the help page for bridged networking (the standard choice): > On Linux hosts … for other protocols such as IPv6 and IPX, you must choose a wired interface.

I moved into the dorms yesterday, where I was hit by an IPv6 address and found that I couldn’t SSH to one of my VMs. After playing around and finding the solution, I thought I’d write a guide since I hadn’t found one immediately on the internet.

0. Install OpenSSH (Guest)

Make sure the SSH server is installed:

$ sudo apt-get install openssh-server  # Ubuntu, Debian
$ sudo yum install openssh-server   # Fedora

1. Create a host-only network (Host)

Navigate to File -> Preferences -> Network, and click the icon with a plus sign. By default, it will create a host network named vboxnet0.

File -> Preferences -> Network -> Add Host Network

2. Add a network adapter (Host)

On the host, first shut off the guest VM. Next, right-click the VM in the library and open the settings. We’ll create a second adapter (“Adapter 2”) attached to a Host-only Adapter, as shown in the picture below.

Settings -> Network -> Adapter 2 -> Host-only Adapter

3. Add a network interface (Guest)

On the Linux guest, add the following lines to /etc/network/interfaces:

auto eth1
iface eth1 inet dhcp

Start the network interface:

$ sudo ifup eth1

4. Find the IP address (Guest)

On the Linux guest, run the ifconfig command and search for the inet addr. In the output below, the address that we need is

$ ifconfig | grep eth1 -C 5
RX packets:25 errors:0 dropped:0 overruns:0 frame:0
TX packets:33 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3700 (3.6 KiB)  TX bytes:2867 (2.7 KiB)

eth1      Link encap:Ethernet  HWaddr 08:00:27:32:ac:fd
inet addr:  Bcast:  Mask:
inet6 addr: fe80::a00:27ff:fe32:acfd/64 Scope:Link
RX packets:7963 errors:0 dropped:0 overruns:0 frame:0
TX packets:4691 errors:0 dropped:0 overruns:0 carrier:0

5. SSH to the virtual machine (Host)

Finally, we can SSH to the virtual machine.

$ ssh user@