问题
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?
回答1:
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
回答2:
Google Compute Engine firewall also have to define "Network".
For custon "Network":
gcutil --project=yourproject addfirewall --allowed=tcp:22 default-ssh --network yournetwork
来源:https://stackoverflow.com/questions/19295742/google-compute-engine-troubleshooting-ssh-connection-refused