Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

SOLVED: I got this working by reconfiguring the vbox network settings to (in VirtualBox -> Preferences -> Network) and commenting the line specifying a gateway as it's not needed (no external access on the host only interface) as per this post.

I can then SSH to from OSX and connect to Ubuntu. I changed my /etc/fstab mounts to point to //

I have a Ubuntu guest configured with two interfaces, eth0 is using NAT and works fine, I can access the net.

The second interface eth1 is set to host only networking and VirtualBox has created a vboxnet0 virtual adapter on the host.

I've configured vboxnet0 in VirtualBox adapter settings with the following:


Once the VM guest is running, ifconfig on OSX has vboxnet0 setup as:

vboxnet0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    ether 0a:00:27:00:00:00 
    inet netmask 0xffffff00 broadcast

In the guest, eth0 is set to use DHCP, I've statically assigned eth1 to (this was a mistake and the IPs clash between host and guest):

auto eth1
iface eth1 inet static
    address (should be .19)

There is no device on - what should I set my gateway to? (turns out a gateway is not needed as it's a HOST only interface). Net access is provided by the NAT adapter.

In the guest the routes look like so:

Destination    Gateway       Genmask        Flags Metric   Ref  Use  Iface   *     U     0        0    0    eth1       *     U     0        0    0    eth0
default        UG    100      0    0    eth0
default        UG    100      0    0    eth1

Route table on OSX:

$ netstat -nr
Routing tables

Destination        Gateway          Flags      Refs      Use    Netif Expire
default         UGSc         28        0      en1
10.77.36/22        link#5           UCS           5        0      en1        UHS           1     2236      lo0       link#5           UHLWbI        1       66      en1
127              UCS           0        0      lo0        UH            1     8642      lo0
169.254            link#5           UCS           0        0      en1
192.168.21         link#7           UC            2        0  vboxnet      a:0:27:0:0:0     UHLWI         0        4      lo0     link#7           UHLWbI        2       64  vboxnet

I can't SSH from the host to the guest (I used to be able to when the VM was configured with a bridged connection):

$ ssh
ssh: connect to host port 22: Connection refused

What have I done wrong here? TIA

share|improve this question
up vote 7 down vote accepted

I reconfigured the vboxnet0 virtual adapter IP on the host to so it differs from the guests configuration of .20 - then they don't clash. See my updates in the post with more details about the solution.

share|improve this answer
I also blogged about this – Greg K Feb 22 '13 at 16:22
Nice one! thanks for the tip ;D – punkbit Mar 1 '13 at 18:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .