I am trying to run an Ubuntu Server 16.04 guest in an Ubuntu 15.10 host with Host Only networking in VirtualBox. I am aware there are few questions with similar problems, their configuration isn't quite the same as mine and I'm still stuck after reading them.
The guest can ping and fetch data from both the host and external websites.
The host cannot ping the guest or connect to any web service running on the guest.
I am following these instructions with some details changed.
In VirtualBox
One Host-Only network created, vboxnet0
with address 192.168.100.0
and network mask 255.255.255.0
.
Guest has NAT for adapter 1 (default setting) and vboxnet0
as adapter 2.
On the Host
#> ifconfig vboxnet0
vboxnet0 Link encap:Ethernet HWaddr 0a:00:27:00:00:00
inet addr:192.168.100.0 Bcast:192.168.100.255 Mask:255.255.255.0
On the Guest
This is /etc/network/interfaces
# The loopback network interface
auto lo
iface lo inet loopback
# Host-only interface
# vboxnet0 Host Only Adapter has address 191.168.100.0
# guest has address 192.168.100.1
auto enp0s8
iface enp0s8 inet static
address 192.168.100.1
netmask 255.255.255.0
network 192.168.100.0
broadcast 192.168.56.255
# NAT interface
auto enp0s3
iface enp0s3 inet dhcp
The interface names are not eth0
etc, apparently this is due to kernel evolution and it should be fine.
After a reboot, this is ifconfig
This seems to show the correct inet addr for enp0s8
(which is the Host Only adapter), and enp0s3
is NAT which appears to be working.
If I run route
I don't know how to interpret this exactly, but for some reason it lists 192.168.100.0
instead of 192.168.100.1
, which is what ifconfig
and /etc/network/interfaces
have.
EDIT in an earlier version of this question, the static IP of the guest wasn't within the netmask range of the Host Only adapter. Then, ping
seemed to hang, now ping 192.168.100.1
from the host produces
PING 192.168.100.1 (192.168.100.1) 56(84) bytes of data.
From 192.168.100.0 icmp_seq=1 Destination Host Unreachable
What's wrong? Thanks.
192.168.200.1
would be reachable because of the existence of vboxnet0, that's it's raison d'etre (I have not idea why it's.0
inroute
). And I have no idea what you mean about the netmask,196.168.100.0
is supposed to be the gateway, I believe. – spraff Sep 12 '16 at 0:13192.168.100.2
as the address? The scheme I'm going for is192.168.100.n
is the nth machine, with n starting from 1, so far there's only one machine (guest). – spraff Sep 12 '16 at 9:15