从windows和putty到谷歌云虚拟机的SSH隧道:网络错误:连接超时

问题描述 投票:0回答:1

我正在尝试从Windows计算机连接到我的谷歌云VM。

我的正常机器在Linux下,一切都很好但是现在,我不能使用它,所以我尝试从这个窗口连接。

我安装了gcloud sdk,当我尝试打开ssh隧道连接到Web UI时:

gcloud compute ssh my-spark-master --project=my-project --zone=us-east1-b -- -D localhost:10000 -N

我有一个网络错误:连接超时

用户是在我的VM上创建的(我将它放在主目录中)。我的本地计算机上有一个google_compute_engine.ppk,我的项目上打开了22个TCP端口。我已经在Windows防火墙中授权“C:\ Program Files(x86)\ Google \ Cloud SDK \ google-cloud-sdk \ bin \ sdk \ putty.exe”(但它做得好吗?)

 gcloud compute firewall-rules list
NAME                    NETWORK  DIRECTION  PRIORITY  ALLOW                         DENY
default-allow-icmp      default  INGRESS    65534     icmp
default-allow-internal  default  INGRESS    65534     tcp:0-65535,udp:0-65535,icmp
default-allow-rdp       default  INGRESS    65534     tcp:3389
default-allow-ssh       default  INGRESS    65534     tcp:22

To show all fields of the firewall, please show in JSON format: --format=json
To show all fields in table format, please see the examples in --help.

任何提示?

google-cloud-platform google-compute-engine ssh-tunnel
1个回答
1
投票

使用PuttyGen,创建一个SSH密钥(通过随机移动鼠标指针并保存PPK供以后使用),并将ssh-rsa *前缀的文本添加到元数据 - >计算引擎服务中的SSH密钥中。

在PuttyGen中,Key-comment提到了您要用于登录虚拟机的用户名,例如: GCP-用户

现在,当使用Putty连接到Google Cloud Compute Engine VM时,只需使用gcp-user@<Public-IP-of-VM>并在密钥对中使用上面保存的PPK文件。

希望这可以帮助您,如果有任何疑虑,请告诉我。

© www.soinside.com 2019 - 2024. All rights reserved.