'How do I access to GCP vm from external if I set up later?

Environment: Google Cloud Platform
Ubuntu 20.04 LTS

I've created below environment on GCP.

  1. I've created: network nw1 (for ssh from external), nw2 (private), nw3 (public)
  2. I've created vm1 (nic with nw1, nw2, ExternalIP in nw1)
  3. I can access vm2 using ExternalIP from external my machine
  4. I've created vm2 (nic with nw2, nw3 without ExternalIP)
  5. I can access vm2 via ssh to vm1 and then ssh via nw2
  6. I've created new ExternalIP to nw3 and set vm2
  7. Now I cannot access (icmp, ssh, etc.) vm2 via nw3 (Firewall allows all traffic form 0.0.0.0/0)

What should I change?



Solution 1:[1]

I still don't fully understand your setup, however, in order to allow communication between subnetworks, firewall rules must permit two-way communication.
So for example:
Firewall in NW2 must allow packets from NW3
AND
Firewall in NW3 must allow packets from NW2

It can be helpful to enable Firewall logging and trace the packets to find where they are being dropped.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sergiusz