5

我创建了一个 Google Compute Engine 实例,但无法 ping 通它的外部 IP 地址(173.255.118.164)。

我可以通过 gcutil SSH 进入实例,但我无法从家用计算机 ping 外部地址。

使用 Amazon EC2,这很简单,而且很有效。

谷歌怎么了?

4

1 回答 1

23

By default, all incoming traffic is blocked except for SSH. To enable ICMP (ping), you can create a firewall rule by running:

$ gcloud compute firewall-rules create allow-ping --direction=INGRESS --network=default --action=ALLOW --rules=icmp --source-ranges=0.0.0.0/0

This will allow you to ping all of your instances on the default network. Firewall rules can also be created in the Cloud Console --> Compute Engine --> Networks UI.

You can also create rules which only apply to groups of instances, etc. Details in the documentation for Networks and Firewalls.

The same steps apply for allowing other kinds of traffic. If you want to allow HTTP traffic, for example:

$ gcloud compute firewall-rules create allow-http --direction=INGRESS --network=default --action=ALLOW --rules=tcp:80 --source-ranges=0.0.0.0/0
于 2013-07-28T01:30:32.330 回答