Moovendra Dhinesh babu
Moovendra Dhinesh babu

Reputation: 818

Google Compute Engine - troubleshooting SSH "Connection refused"

I am using the following command to access my instance on Google Compute Engine:

gcutil ssh my-instance-name

but it gives me this error:

ssh: connect to host ip-address port 22: Connection refused

I checked and deactivated the firewall, but I am still getting this error. Can someone please tell me how to solve this?

Upvotes: 2

Views: 3522

Answers (2)

Clement
Clement

Reputation: 17

Google Compute Engine firewall also have to define "Network".

For custon "Network":

gcutil --project=yourproject addfirewall --allowed=tcp:22 default-ssh --network yournetwork

Upvotes: 0

Brian Dorsey
Brian Dorsey

Reputation: 4688

The Compute Engine firewall blocks all traffic unless there is a rule to allow it. The most common issue is missing the default firewall rule which allows SSH. To add it back, run:

gcutil --project=myproject addfirewall --allowed=tcp:22 default-ssh

If that isn't it, there is some good advice for troubleshooting SSH connection issues in the docs: Troubleshooting SSH errors

Upvotes: 7

Related Questions