gpt4 book ai didi

google-compute-engine - 尽管有防火墙规则,仍无法连接到Google Cloud Compute实例上的端口80

转载 作者:行者123 更新时间:2023-12-01 13:33:41 25 4
gpt4 key购买 nike

总而言之,尽管我设置了允许tcp:80的防火墙规则,但位于“默认”网络上的GCE实例不接受与端口80的连接。看来我的实例上仅打开了端口22。我可以对其进行ping操作,但在64跳以下无法跟踪到它。

接下来的是我的调查,这些调查使我得出了这些结论。

gcloud beta compute firewall-rules list

NAME NETWORK DIRECTION PRIORITY ALLOW DENY
default-allow-http default INGRESS 1000 tcp:80
default-allow-https default INGRESS 1000 tcp:443
default-allow-icmp default INGRESS 65534 icmp
default-allow-internal default INGRESS 65534 tcp:0-65535,udp:0-65535,icmp
default-allow-rdp default INGRESS 65534 tcp:3389
default-allow-ssh default INGRESS 65534 tcp:22
temp default INGRESS 1000 tcp:8888


gcloud compute instances list
NAME ZONE MACHINE_TYPE PREEMPTIBLE INTERNAL_IP EXTERNAL_IP STATUS
ssrf3 us-west1-c f1-micro true 10.138.0.4 35.197.33.182 RUNNING


gcloud compute instances describe ssrf3
...
name: ssrf3
networkInterfaces:
- accessConfigs:
- kind: compute#accessConfig
name: external-nat
natIP: 35.197.33.182
type: ONE_TO_ONE_NAT
kind: compute#networkInterface
name: nic0
network: https://www.googleapis.com/compute/v1/projects/hack-170416/global/networks/default
networkIP: 10.138.0.4
subnetwork: https://www.googleapis.com/compute/v1/projects/hack-170416/regions/us-west1/subnetworks/default
...
tags:
fingerprint: 6smc4R4d39I=
items:
- http-server
- https-server

我将ssh放入35.197.33.182(这是ssrf3实例)并运行:
sudo nc -l -vv -p 80

在本地计算机上,我运行:
nc 35.197.33.182 80 -vv
hey

但什么也没发生。
因此,我尝试对主机执行ping操作。看起来很健康:
ping 35.197.33.182 
PING 35.197.33.182 (35.197.33.182): 56 data bytes
64 bytes from 35.197.33.182: icmp_seq=0 ttl=57 time=69.172 ms
64 bytes from 35.197.33.182: icmp_seq=1 ttl=57 time=21.509 ms

Traceroute经过64跳后退出,但未到达35.197.33.182目标。

因此,我检查了使用nmap打开的端口:
nmap 35.197.33.182

Starting Nmap 7.12 ( https://nmap.org ) at 2017-06-18 16:39 PDT
Note: Host seems down. If it is really up, but blocking our ping probes, try -Pn
Nmap done: 1 IP address (0 hosts up) scanned in 3.06 seconds



nmap 35.197.33.182 -Pn

Starting Nmap 7.12 ( https://nmap.org ) at 2017-06-18 16:39 PDT
Nmap scan report for 182.33.197.35.bc.googleusercontent.com (35.197.33.182)
Host is up (0.022s latency).
Not shown: 999 filtered ports
PORT STATE SERVICE
22/tcp open ssh

Nmap done: 1 IP address (1 host up) scanned in 6.84 seconds

…即使我在35.197.33.182上运行 nc -l -p 80

最佳答案

确保虚拟机级防火墙没有介入。例如,与所有其他默认镜像相比,Container-Optimized OS有点特殊:

By default, the Container-Optimized OS host firewall allows only outgoing connections, and accepts incoming connections only through the SSH service. To accept incoming connections on a Container-Optimized OS instance, you must open the ports your services are listening on.



https://cloud.google.com/container-optimized-os/docs/how-to/firewall

关于google-compute-engine - 尽管有防火墙规则,仍无法连接到Google Cloud Compute实例上的端口80,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44620723/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com