Y Melo
Y Melo

Reputation: 423

Gcloud instance can't ping another one

I have 2 instances running on Compute engine, although the documentation says that I'm able to ping and establish a communication between these VMs I can't. I've tried the ping with VM name and ipv4 address. I also tried to configure new work-group for both VMs and nothing.

Here's the link: https://cloud.google.com/compute/docs/vm-ip-addresses

If you are communicating between instances in the same network, you can send packets to an instance using the instance name, and the network automatically resolves the name to the internal IP address of the instance.

My VMs configuration:

Both are in the same network instances Ipconfig from web01 Ipconfig from sql01

I even turn off the firewalls

firewall off

But no connection between at all.

web not pinging sql

Anyone passed for the same? someone knows what is going on? How do I solve this issue?

Upvotes: 4

Views: 17033

Answers (6)

patilnitin
patilnitin

Reputation: 1171

Make sure you restart the network on VMs in order to work it fine. This helped me pretty well.

Upvotes: 0

kevthanewversi
kevthanewversi

Reputation: 3756

This is due to firewall rules. You need to add the allow-icmp network tag in the Network tags section of the instances edit page > enter image description here

You can create new Network tags to open up new ports/protocols in the VPC Network>Firewall rules section:

enter image description here

EDIT 1: Please note that the 0.0.0.0/0 subnet used on the screenshot above opens up the ports to the entire internet and I only used it for demonstration purposes to avoid sharing my IPs. I would STRONGLY advise against using that subnet for firewall rules in a production environment. The internet is a dark and scary place.

Upvotes: 4

Vojta Hejda
Vojta Hejda

Reputation: 187

This happens to us from time to time - suddenly our 2 instances cannot reach each other through API or even ping. Even though we haven't changed any firewall rules or anything. I guess it's some GCloud glitch.

Nothing we have tried works, except for restarting the instances, then everything works again. So, if anyone has the same, and nothing seems to help the issue, I suggest, as a last resort, to reboot the instances.

Upvotes: 4

Brad
Brad

Reputation: 21

Be sure the firewall rules include the GCE subnet. In your case, it would mean that 10.10.0.0/24 has icmp allowed.

I'm not sure why the firewall rules apply within the network subnet, but apparently they do.

Upvotes: 2

k''
k''

Reputation: 832

If you did not change network and or firewall rules and use default network and firewall rules then simply edit hosts file (open hosts on all vm, copy hosts line for each vm and add its all other vm) and then try ping. I have tried same between three centos instance and its working.

Upvotes: 0

Angus Davis
Angus Davis

Reputation: 2683

Each network in Google Compute Engine has its own firewall configuration which by default will block incoming traffic to your VM. See the firewall documentation to see how the default network is configured and how to apply similar rules to your custom network.

Upvotes: 2

Related Questions