Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-cloud-platform/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google cloud platform Ethernet接口中未启用GoogleCloud实例公共IP_Google Cloud Platform_Google Cloud Console - Fatal编程技术网

Google cloud platform Ethernet接口中未启用GoogleCloud实例公共IP

Google cloud platform Ethernet接口中未启用GoogleCloud实例公共IP,google-cloud-platform,google-cloud-console,Google Cloud Platform,Google Cloud Console,我在Google cloud compute中创建了一个新实例,它有一个公共动态ip和lan ip,但是当我看到接口列表时,我只能看到一个lan ip接口。在ifconfig的输出下面。请帮助我如何在该接口中获取公共ip #ifconfig eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1460 inet 10.240.0.2 netmask 255.255.255.255 broadcast 10.2

我在Google cloud compute中创建了一个新实例,它有一个公共动态ip和lan ip,但是当我看到接口列表时,我只能看到一个lan ip接口。在ifconfig的输出下面。请帮助我如何在该接口中获取公共ip

#ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1460
        inet 10.240.0.2  netmask 255.255.255.255  broadcast 10.240.0.2
        inet6 fe80::4001:aff:fef0:2  prefixlen 64  scopeid 0x20<link>
        ether 42:01:0a:f0:00:02  txqueuelen 1000  (Ethernet)
        RX packets 1196  bytes 214299 (209.2 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1124  bytes 143037 (139.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 3515  bytes 1891143 (1.8 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 3515  bytes 1891143 (1.8 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
#ifconfig
eth0:flags=4163 mtu 1460
inet 10.240.0.2网络掩码255.255.255.255广播10.240.0.2
inet6 fe80::4001:aff:fef0:2预桥64作用域ID 0x20
以太42:01:0a:f0:00:02 txqueuelen 1000(以太网)
接收数据包1196字节214299(209.2千字节)
接收错误0丢弃0超出0帧0
发送数据包1124字节143037(139.6kib)
发送错误0丢弃0溢出0载波0冲突0
低:标志=73 mtu 65536
inet 127.0.0.1网络掩码255.0.0.0
inet6::1前缀轴128作用域ID 0x10
循环txqueuelen 0(本地环回)
接收数据包3515字节1891143(1.8 MiB)
接收错误0丢弃0超出0帧0
发送数据包3515字节1891143(1.8 MiB)
发送错误0丢弃0溢出0载波0冲突0
如果你需要更多的细节,请告诉我


提前感谢。

无法从
ifconfig
命令获取实例公共IP。 您可以使用
gcloud
命令行获取它:

$ gcloud compute instances describe <instance name>

这是显示的两个接口。这里eth0是私有IP,如何获得公共IP接口?
$ gcloud auth login