Shutdown your VM and do:
VirtualBox > Settings > Network > Add (you will get vboxnet0
)
On a terminal ifconfig
will show you new interface vboxnet0
VM's Settings > System > check "Enable I/O APIC." VM's Settings > Network > Adapter 2 > host-only vboxnet0
Install OpenSSH Server
Edit /etc/network/interfaces
file to append the following lines:
auto eth1
iface eth1 inet static
address 192.168.56.10
netmask 255.255.255.0
Run sudo ifup eth1
from the Ubuntu command line.
SSH server should be up and running. Switch to your host terminal and enter ssh 192.168.56.10
sources:
Two network interfaces are needed on the guest to enable it to connect to the internet and allow ssh from host.
$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000 link/ether 08:00:27:6c:bb:26 brd ff:ff:ff:ff:ff:ff
3: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000 link/ether 08:00:27:44:3b:96 brd ff:ff:ff:ff:ff:ff
enp0s3 is mapped to NAT and enp0s8 is mapped to vboxnet0 (
192.168.56.1
). Add the following to /etc/network/interfaces and leave the config for enp0s3 as is.# Add the following
auto enp0s8
iface enp0s8 inet static1
address 192.168.56.10
netmask 255.255.255.0
Back on host,
ssh 192.168.56.0
should work