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
$ sudo apt install openssh-server
First: create /etc/netplan/02-netcfg.yaml
file to append the following lines:
network:
version: 2
renderer: networkd
ethernets:
enp0s8: // `ip address` will show three adapter: lo, enp0s3, enp0s8. enp0s3 is the NAT adapter with ip 10.0.2.15/24(maybe different on your vm), so enp0s8 is the host-only adapter
addresses:
- 192.168.99.200/24 //you can change this static ip by yourself
dhcp4: no
then:
$ sudo netplan generate
$ sudo netplan apply
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:
- http://superuser.com/questions/424083/virtualbox-host-ssh-to-guest
- https://forums.virtualbox.org/viewtopic.php?f=8&t=40076
- Install OpenSSH server ``
- Update file
/etc/sysconfig/network-scripts/ifcfg-eth1
to:
DEVICE=eth1
BOOTPROTO=none
ONBOOT=yes
NETWORK=10.141.141.0
NETMASK=255.255.255.0
IPADDR=10.141.141.27
USERCTL=no