There are 2 methods
- Port Forwarding via NAT
- Host-only Adapter
Port Forwarding
Assuming you want to SSH from Host to Client.
VirtualBox -> Settings -> Network -> Adapter 1. Assuming it is attached to NAT as per default.
Expand Advanced.
Click on Port Forwarding.
At the following entry
- Name:
SSH - Protocol:
TCP - Host IP:
127.0.0.1(or leave blank) - Host Port:
2222 - Guest IP:
10.0.2.15(or leave blank) - Guest Port:
22(SSH default port)
Click OK.
NOTE: To make sure the Ubuntu client have SSH server, you might want to install sudo apt install openssh-server and test local connection (ssh [email protected])
On the windows host, install Putty (If you don't have a SSH client) and connect to
- Host Name (or IP address):
127.0.0.1 - Port:
2222
NOTE: If connection denied, you might want to check if your Ubuntu client have firewall installed.
Host-only Adapter
You can leave Adapter 1 as NAT, for configure Host-only Adapter as Adapter 2.
VirtualBox -> File -> Host Network Manager, there should be a VirtualBox Host-Only Ethernet Adapter. If not, do create one.
Adapter -> Configure Adapter Manually- IPv4 Address:
192.168.56.1 - IPv4 Network Mask:
255.255.255.0
- IPv4 Address:
DHCP Server:- Check
Enable Server - Server Address:
192.168.56.100 - Server Mask:
255.255.255.0 - Lower Address Bound:
192.168.56.101 - Upper Address Bound:
192.168.56.254
- Check
VirtualBox -> Settings -> Network -> Adapter 2
- Check
Enable Network Adapter - Attached to:
Host-only Adapter - Name:
VirtualBox Host-Only Ethernet Adapter
Check the ip address of Ubuntu Client
enp0s3isNATenp0s8isHost-only Adapter, where the IP is192.168.56.101
ifconfig -aNOTE: Install via sudo apt install net-tools is command not found
enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.0.2.15 netmask 255.255.255.0 broadcast 10.0.2.255
inet6 fe80::6985:240e:c74:951d prefixlen 64 scopeid 0x20<link>
ether 08:00:27:4f:1c:84 txqueuelen 1000 (Ethernet)
RX packets 39 bytes 5879 (5.8 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 64 bytes 9487 (9.4 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
enp0s8: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.56.101 netmask 255.255.255.0 broadcast 192.168.56.255
inet6 fe80::506e:b210:fa8c:2a3b prefixlen 64 scopeid 0x20<link>
ether 08:00:27:d7:b0:01 txqueuelen 1000 (Ethernet)
RX packets 10 bytes 1785 (1.7 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 29 bytes 4205 (4.2 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 35 bytes 3839 (3.8 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 35 bytes 3839 (3.8 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0On the windows host, install Putty (If you don't have a SSH client) and connect to
- Host Name (or IP address):
192.168.56.101 - Port:
22
NOTE: If connection denied, you might want to check if your Ubuntu client have firewall installed.