SSH into VirtualBox Guest: Connection Refused

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.


None of the other solutions are good because:

  1. There is no point to ssh to your guest via bridge if the guest will loose access to internet
  2. 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

  1. Shut your guest Ubuntu down
  2. On Virtualbox go to Setting>network>Adapter1>Advanced>Portforwarding
  3. Name=SSH Hostport=2022 (or any port but 22) Guestport(22)
  4. Reboot your guest
  5. On you host open a Putty or whatever you use for SSH
  6. ssh [email protected] -p2022 (or any port you mentioned as hostport)
  7. Have fun you are in

You should check that your guest OS firewall is not blocking incoming connections on port 22.

Tags:

Ssh

Virtualbox