Google Compute Engine - troubleshooting SSH “Connection refused”

半世苍凉 提交于 2019-12-22 18:01:16

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!