Tools -> Click to Button More -> Network -> Create new network vboxnet0
:
- Adapter: IP: 192.168.56.1
- DHCP Server: 192.168.56.2, from 192.168.56.3 to 192.168.56.254
Ubuntu Server -> Settings -> Network
- Adapter 1: NAT
- Adapter 2: Host-only Network -> vboxnet0
Check network adapters
# Currently without Host-only network
$ ifconfig
enp0s3: ...
lo: ...
# We have network adapter enp0s8, is host-only network
$ ifconfig -a
enp0s3: ...
lo: ...
enp0s8: ...
Install necessary pacakge
$ sudo apt install ifupdown
Edit network interfaces
$ sudo vim /etc/network/interfaces
Edit to
# Use for after install apt ifupdown
source /etc/network/interfaces.d/
# Loopback
auto lo
iface lo inet loopback
# DHCP - NAT network
auto enp0s3
iface enp0s3 inet dhcp
# Static IP - Host only network
auto enp0s8
iface enp0s8 inet static
address 192.168.56.10 # your IP address
netmask 255.255.255.0
Up interface enp0s8 and restart networking
sudo ifconfig enp0s8 up
sudo /etc/init.d/networking restart
Test ping Open terminal outsite VM, ping to VM by IP
$ ping 192.168.56.10
PING 192.168.56.10 (192.168.56.10) 56(84) bytes of data.
64 bytes from 192.168.56.10: icmp_seq=1 ttl=64 time=0.020 ms
64 bytes from 192.168.56.10: icmp_seq=2 ttl=64 time=0.039 ms
64 bytes from 192.168.56.10: icmp_seq=3 ttl=64 time=0.060 ms
sudo apt install -y openssh-server
sudo systemctl status ssh
sudo systemctl start ssh
sudo systemctl disable ssh
sudo systemctl enable ssh
sudo systemctl restart ssh
Open terminal and trying SSH (on MacOS or Linux, on Windows, use Putty)
ssh [email protected]