I created a NAT Network in VirtualBox and from the Ubuntu host I am trying to SSH into the Ubuntu server VM, but I get connection refused. The Ubuntu server VM is connected to the NAT Network using port forwarding. I can connect successfully with port forwarding if I set NAT instead of NAT Network in the adapter, but for this assignment I have to use NAT Network.
Can anybody help? I have already spent many hours trying to solve this. I think the problem might be with the Ubuntu host and not with VirtualBox, but still can't figure out the solution.
Host: Ubuntu 18.04.1. LTS
VirtualBox: 5.2.18_Ubuntu r123745
Guest Network Settings:
Port Forwarding Rules:
Guest Network Interfaces:
Failing SSH connection
root@ThinkPad:~# ssh -vvv email@example.com -p 1022 OpenSSH_7.6p1 Ubuntu-4ubuntu0.1, OpenSSL 1.0.2n 7 Dec 2017 debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 19: Applying options for * debug2: resolving "127.0.0.1" port 1022 debug2: ssh_connect_direct: needpriv 0 debug1: Connecting to 127.0.0.1 [127.0.0.1] port 1022. debug1: connect to address 127.0.0.1 port 1022: Connection refused ssh: connect to host 127.0.0.1 port 1022: Connection refused
- I have changed the entry port for the forwarding from 1022 to 10001, because with port 1022 forwarding wasn't working with NAT either.
- When I use port 10001 for forwarding, I can see the on the host VirtualBox is actually listening on that port:
root@giacomo-ThinkPad:~# netstat -tulpn Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:10001 0.0.0.0:* LISTEN 2482/VirtualBox tcp 0 0 192.168.122.1:53 0.0.0.0:* LISTEN 1489/dnsmasq
Instead when using the same forwarding rules with NAT Network, VirtualBox is not listening. So it looks like the problem might be in VirtualBox?