SSH into VirtualBox Guest: Connection Refused
Solution 1:
Are you sure the IP is for the guest OS. I had the same problem and it turned out that the IP I had been using all along, the 192.168.56.101 was actually the Windows interface IP and the host OS IP was 192.168.56.103.
You can verify by doing ipconfig / ifconfig on both.
NOTE: I had also setup a static IP which it turns out I didn't need at all. In case you try from the start I found this tutorial to be better.
Solution 2:
None of the other solutions are good because:
- There is no point to ssh to your guest via bridge if the guest will loose access to internet
- All the other solutions above tell you to build a rocket to cross the road.
Scenario
- Host Ubuntu Desktop 16.04
- Guest Ubuntu Server 16.04 (Running on Virtual box 5)
Problem
SSH connection refused
Solution
- Shut your guest Ubuntu down
- On Virtualbox go to Setting>network>Adapter1>Advanced>Portforwarding
- Name=SSH Hostport=2022 (or any port but 22) Guestport(22)
- Reboot your guest
- On you host open a Putty or whatever you use for SSH
- ssh [email protected] -p2022 (or any port you mentioned as hostport)
- Have fun you are in
Solution 3:
The following works for me:
Before:
vboxnet0: 192.168.56.1
eth1: 192.168.56.1
After:
vboxnet0: 192.168.56.1
eth1: 192.168.56.101
So, basically I changed part of the file { /etc/network/interfaces } as follows:
Before:
auto eth1
iface eth1 inet static
address 192.168.56.1
netmask 255.255.255.0
After:
auto eth1
iface eth1 inet static
address 192.168.56.101
netmask 255.255.255.0
Works: ssh [email protected]
Solution 4:
You should check that your guest OS firewall is not blocking incoming connections on port 22.
Solution 5:
Maybe it's an issue with access control. To disable it and allow full access, as root:
xhosts +
I had a similar issue with VNC viewer