代码之家  ›  专栏  ›  技术社区  ›  Jice

从windows和putty到google云VM的SSH隧道:网络错误:连接超时

  •  0
  • Jice  · 技术社区  · 6 年前

    我正在尝试从windows计算机连接到我的google云虚拟机。

    我的普通机器是在linux下的,在这台机器上一切正常,但现在,我不能使用它,所以我试着从这台windows连接。

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

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

    我遇到网络错误:连接超时

    用户是在我的虚拟机上创建的(我在主目录中有它)。我的本地计算机上有一个google_compute_engine.ppk,我的项目上有22个TCP端口打开。我已经在我的windows防火墙中授权了“C:\程序文件(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.
    

    有什么线索吗?

    1 回复  |  直到 5 年前
        1
  •  1
  •   Murtaza Kanchwala    6 年前

    使用 油灰 ,创建一个SSH密钥(随机移动鼠标指针并保存PPK以备以后使用),然后添加前缀为 ssh-rsa * 进入计算引擎服务中的元数据->SSH密钥。

    在PuttyGen, Key-comment 请提供一个用于登录虚拟机的用户名,例如。 gcp用户

    现在,当使用 油灰 ,就用这个 gcp-user@<Public-IP-of-VM> 在密钥对中使用上面保存的PPK文件。

    希望这对你有帮助,如果有什么问题请告诉我。