在更新并重新启动gcloud
其与 的 SSH 连接之后gcloud update
,gcloud init
然后是gcloud compute config-ssh --remove
&& gcloud compute config-ssh
,有时和不可预测地,与服务器的任何连接,假设ssh hostname
有时会出现以下情况:
vim ~/.ssh/config
关于Google Cloud Platform的配置是:
20 # Google Compute Engine Section
21 #
22 # The following has been auto-generated by "gcloud compute config-ssh"
23 # to make accessing your Google Compute Engine virtual machines easier.
24 #
25 # To remove this blob, run:
26 #
27 # gcloud compute config-ssh --remove
28 #
29 # You can also manually remove this blob by deleting everything from
30 # here until the comment that contains the string "End of Google Compute
31 # Engine Section".
32 #
33 # You should not hand-edit this section, unless you are deleting it.
34 #
35 Host hostname
36 HostName XXX.XXX.XX.XX
37 IdentityFile /Users/userz/.ssh/google_compute_engine
38 UserKnownHostsFile=/Users/userz/.ssh/google_compute_known_hosts
39 HostKeyAlias=compute.1736255031467791084
40 IdentitiesOnly=yes
41 CheckHostIP=no
42
43 # End of Google Compute Engine Section
输出为ssh -vvv hostname
:
OpenSSH_7.5p1, OpenSSL 1.0.2l 25 May 2017
debug1: Reading configuration data /Users/userz/.ssh/config
debug1: /Users/userz/.ssh/config line 35: Applying options for hostname
debug1: Reading configuration data /usr/local/etc/ssh/ssh_config
debug2: resolving "XXX.XXX.XX.XX" port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to XXX.XXX.XX.XX [XXX.XXX.XX.XX] port 22.
debug1: connect to address XXX.XXX.XX.XX port 22: Operation timed out
ssh: connect to host XXX.XXX.XX.XX port 22: Operation timed out
此后,任何与服务器的连接,甚至转到domain.com
,尝试telnet XXX.XXX.XX.XX 22
或ping XXX.XXX.XX.XX
都会导致本地网络内的任何人超时。
我该怎么做才能解决这个问题?或者我该如何开始调试这个问题?
系统信息:
$ gcloud -v
Google Cloud SDK 173.0.0
alpha 2017.09.15
beta 2017.09.15
bq 2.0.26
core 2017.09.25
gcloud
gsutil 4.27
MacOS Sierra 10.12.6
答案1
我建议通过 ping 虚拟机(内部 IP)来进行层级检查,如果成功,则检查端口是否已启动
telnet localhost 22
如果 down 检查 sshd 服务是否启动
service ssh status