Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Http firewall issue

Problem:
I am trying to raise an Http server on GCP on port 8080 or 80. But I can only connect locally, and not from outside the GCP network.
From GCP: "curl localhost:8080" works, but "curl external_ip:8080" does not work.
From local computer: "curl external_ip:8080" does not work.
Error: connection timeout / no route to host.

When trying port 80. I get "connection refused" with external_ip , regardless if http server is on or not.

Other info:
2. OS: Ubuntu
3. On machine creation I marked: allow_http and allow_https network tags.
4. Result of command: sudo iptables -L

maor1152_0-1666163802544.png

5. I added fire wall rule that allows all ips v4/v6, for all ports and protocols, and associated it with default netowork.
6. I turned on logging for firewall rule on port 80, and get "hit counts" when I try reaching port 80. I did a network test from the GCP web console, and it showed port 80 as reachable.
7. I performed "connectivity test" for both port 80 and 8080 from my laptop external ip to GCP external Ip. for port 80 it is reachable. for port 8080 is is unreachable. and it fails on the firewall rule:

maor1152_1-1666164381251.png

But I my "allow all" rule has higher priority then that. and I tried also a lower number, the same result. Fail on this rule.

 

Any help would be appriciated. Thanks!

 

 

0 3 1,871