Networking 在google计算引擎计算机上启用传出流量,而无需分配外部ip

Networking 在google计算引擎计算机上启用传出流量,而无需分配外部ip,networking,google-compute-engine,gateway,Networking,Google Compute Engine,Gateway,我在谷歌计算引擎上有两台机器 机器1 x.x.x.x 机器2 y.y.y.y 机器1有一个外部ip地址,机器2没有 我需要从mahcine 2使用第三方库在端口80和443的internet上使用一些服务 在GCE中,默认情况下,没有外部IP地址的实例无法在网络外部发送数据包 Routing Packets to the Internet Currently, any packets sent to the Internet must be sent by an instance that h

我在谷歌计算引擎上有两台机器

机器1 x.x.x.x 机器2 y.y.y.y

机器1有一个外部ip地址,机器2没有

我需要从mahcine 2使用第三方库在端口80和443的internet上使用一些服务

在GCE中,默认情况下,没有外部IP地址的实例无法在网络外部发送数据包

Routing Packets to the Internet

Currently, any packets sent to the Internet must be sent by an instance that has an
external IP address. If you create a route that sends packets to the Internet from a 
particular instance, that instance must also have an external IP. If you create a route 
that sends packets to the Internet gateway, but the source instance doesn't have an
external IP address, the packet will be dropped.
在机器1中,为http和https连接设置squid代理,但第三方库不允许设置代理,也不关心http_代理和https_代理变量


有没有办法在机器1上创建默认网关并在机器2上设置?还有其他解决方案吗?

您可以使用添加一条将包NAT到计算机1的路由。访问了解更多信息。您还需要配置IP表,以便将流量路由到您的计算机1。您还可以访问Google Groups()上的此主题,其中将详细介绍此过程。

“是否有方法在机器1上创建默认网关”-所有实例都有一个默认网关。“…在机器2中设置?”-我不明白你打算用机器2做什么。