无法登录 GCP 虚拟机原因:无法连接到后端

问题描述

我的 GPC Linux VM 运行良好,有一天自然无法登录,即使它仍在运行, 我用nomachine登录提示“验证失败,请重试。”

当 SSH 时:

Connection via Cloud Identity-Aware Proxy Failed
Code: 4003
Reason: Failed to connect to backend
You may be able to connect without using the Cloud Identity-Aware Proxy.

我也尝试添加

#! /bin/bash 

useradd -G sudo USERNAME 

echo 'USERNAME:PASSWORD' | chpasswd

route add default gw <gateway ip> eth0

我创建了另一个虚拟机及其映像,但一天后我无法连接

解决方法

确保您有防火墙规则以允许 Cloud Identity-Aware Proxy (IAP) 连接到实例上的端口 22。完整说明可在 [1] 处找到。

[1] https://cloud.google.com/iap/docs/using-tcp-forwarding?authuser=0#create-firewall-rule

原因:

当实例没有公网IP地址时,浏览器中的SSH需要通过IAP转发SSH连接。错误“无法连接到后端”表示 IAP 代理服务无法打开到实例的 TCP 连接。

这通常是由于 VPC 防火墙没有允许代理连接到实例的规则。也可能是由于操作系统防火墙或其他虚拟机网络连接问题。