Networking – Host cannot reach guest via VirtualBox host-only network

networkingroutingvirtualbox

In VirtualBox on Windows, I have a guest running Ubuntu Server, with the apache2 and openssh-server services running. The configuration file /etc/network/interfaces gives it a static IP of 10.10.10.2/24, and in the properties of the VM, the network adapter is set to host-only. The VirtualBox Host-Only Ethernet Adapter on the host has the IP 10.10.10.1/24. These addresses aren't in the same range as the host (which is DHCP-assigned in the 192.168.1.0/24 range).

From the host, I can browse to 10.10.10.2 and see Apache's "It works" page, and I can SSH to 10.10.10.2 and log into the guest. All good.

The setup I'm aiming for, though, is this same Ubuntu guest running on an Ubuntu Server host (rather than a Windows host). So I have exported the guest as an appliance, and imported it to VirtualBox on Ubuntu. Because VirtualBox Host-Only Ethernet Adapter is Windows-specific, and on Linux the adapter is called vboxnet0, I used vboxmanage modifyvm <foo> hostonlyadapter1 vboxnet0 to update the guest appropriately. The guest boots headless with no errors, but from the host, I cannot wget 10.10.10.2 or ssh 10.10.10.2. Both commands say "no route to host". ping 10.10.10.2 causes From 10.10.10.1 [...] Destination Host Unreachable.

What extra do I need to do on Ubuntu that must be happening automatically on Windows, so that the host can reach the guest via the host-only network?

Best Answer

My guess is that your ubuntu server does not auto-configure vboxnet0 (that is, the fake network card on the host computer) properly. You can verify this using ifconfig - vboxnet0 should be present and list the correct IP configuration.

If vboxnet0 does not exist, you need to create it (see this description for how to do that).

If it does exist, it may need to be configured manually (by editing /etc/interfaces or whatever other method is recommended for ubuntu).

Related Question