简体   繁体   中英

GCP Firewall Issue - Unable to access specific port over public internet

I am unable to access some specific ports in a GCP instance I created. I spin up a simple python server using command python3 -m http.server <port#> on port 22221 and 22222 . I can curl to both ports inside the machine or another machine inside the same VPC(using localhost or public ip). but when I tried to curl both ports from outside using public ip, only 22222 works, but the other port does not work.In the firewall I opened up all the ports.

My Firewall rule opened up all the ports Firewall-Screenshot

Curl inside the machine-Screenshot

netstat netstat-screenshot

update 1 : i did the same steps in AWS. Created an Ec2 -> assigned security group which allows all ports inbound/outbound -> spinup python simple http server on port 22222 and 22221 . only 22222 is accessible from public ip address. Looks like it is specific to OS(I am using ubuntu). below is the nmap from inside and outside the instance.

nmap inside the instance

nmap from remote machine

@Alioua - I figured it out. Your hint on nmap helped. It is the Firewall Issue set by my corporate network. I was testing all from a corporate network and some of the ports are blocked. I tried through my mobile LTE data and came to know it was working fine from the very beginning.

这是未配置GCP防火墙,一个显示了您的屏幕截图,它只是允许网络中的内部流量(您注意到源IP为10.128.0.0/9),您必须添加新的防火墙规则以允许外部流量(如果要允许来自任何IP的外部流量,或者可以指定CIDR,则可以设置源IP(0.0.0.0/0))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM