Can’t connect to the VM: Connection refused

You are here:
Estimated reading time: 1 min

Use Case

The VM is ready as shown by the screenshot below:

VM ready

Then you connect to the VM through SSH FROM ANOTHER terminal with the command

ssh -p 2222 vagrant@localhost

And you get the following error:

Connection refused


You didn’t configure the Network adapters correctly


Shutdown the VM.

In the settings of the VM, go to Network

Adapter 1 must be attached to NAT as shown in the screenshot below

VM settings Adapter 1

Adapter 2 must be attached to Bridged Adapter with the first item of the list selected

In my case en0 as shown below

VM settings Adapter 2

Once everything the Adapters are correctly defined, run the VM and try to connect again.

If you are on Windows,

Try to connect to the VM with Putty:

The host should be on port 2222

When you the prompt shows:

Putty prompt



and the password is vagrant as well

Was this article helpful?
Dislike 0
Views: 237