curl:(28) 134767 毫秒后无法连接到 api.ipify.org 端口 443:连接超时

问题描述 投票:0回答:1

我尝试通过 api.ipify.org 获取公共 IP,但在curl 连接超时时失败。

这是我的 iptables:

❯ sudo iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

这是我的UFW:

❯ sudo ufw status
Status: inactive
❯ nslookup ipify.org
Server:     127.0.0.53
Address:    127.0.0.53#53

Non-authoritative answer:
Name:   ipify.org
Address: 175.139.142.25
❯ nslookup ipify.org 1.1.1.1
Server:     1.1.1.1
Address:    1.1.1.1#53

Non-authoritative answer:
Name:   ipify.org
Address: 104.26.13.205
Name:   ipify.org
Address: 172.67.74.152
Name:   ipify.org
Address: 104.26.12.205

一开始我无法 ping 通 ipify

❯ ping ipify.org
PING ipify.org (175.139.142.25) 56(84) bytes of data.
^C
--- ipify.org ping statistics ---
4 packets transmitted, 0 received, 100% packet loss, time 3057ms

将 172.67.14.152 ipify.org 添加到 /etc/hosts 后,我可以 ping ipify.org,但仍然无法正确卷曲。

❯ ping ipify.org
PING ipify.org (172.67.74.152) 56(84) bytes of data.
64 bytes from ipify.org (172.67.74.152): icmp_seq=1 ttl=57 time=12.2 ms
64 bytes from ipify.org (172.67.74.152): icmp_seq=2 ttl=57 time=6.88 ms
64 bytes from ipify.org (172.67.74.152): icmp_seq=3 ttl=57 time=8.72 ms
64 bytes from ipify.org (172.67.74.152): icmp_seq=4 ttl=57 time=8.64 ms
64 bytes from ipify.org (172.67.74.152): icmp_seq=5 ttl=57 time=8.18 ms
^C
--- ipify.org ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4007ms
rtt min/avg/max/mdev = 6.881/8.917/12.157/1.748 ms
❯ curl https://api.ipify.org
^C
❯ curl https://api.ipify.org
curl: (28) Failed to connect to api.ipify.org port 443 after 134744 ms: Connection timed out
curl
1个回答
0
投票

将以下行添加到 /etc/hosts 中

172.67.74.152   ipify.org
172.67.74.152   api.ipify.org
© www.soinside.com 2019 - 2024. All rights reserved.