Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why can't I ping the external IP address of my Google Compute Engine instance?

I created a Google Compute Engine instance but can not ping its external IP address (173.255.118.164).

I can ssh into the instance via gcutil, but I can not ping the external address from my home computer.

With Amazon EC2, this is straightforward and just works.

What's up with Google ?

like image 205
user2626544 Avatar asked Nov 28 '22 15:11

user2626544


1 Answers

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
like image 109
Brian Dorsey Avatar answered Dec 20 '22 18:12

Brian Dorsey