一些传出的 http 连接失败

一些传出的 http 连接失败

最近重启后,我的服务器无法通过 http 连接,但并非一直如此。

我有一个针对端口 80 的接受规则,这是我的 iptables:

Chain INPUT (policy ACCEPT)
target     prot opt source               destination

RH-Firewall-1-INPUT  all  --  anywhere             anywhere

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination
RH-Firewall-1-INPUT  all  --  anywhere             anywhere

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

Chain RH-Firewall-1-INPUT (2 references)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere
ACCEPT     icmp --  anywhere             anywhere            icmp any
ACCEPT     esp  --  anywhere             anywhere
ACCEPT     ah   --  anywhere             anywhere
ACCEPT     udp  --  anywhere             anywhere            udp dpt:ipp
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:ipp
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:ssh
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:smtp
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:http
REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited

我无法通过 cURL 连接,但 traceroute 似乎工作正常。

$ curl www.google.com
curl: (7) couldn't connect to host

traceroute to www.google.com (74.125.20.104), 30 hops max, 40 byte packets
1  pe-in-f104.1e100.net (74.125.20.104)  0.042 ms  0.020 ms  0.019 ms

服务器发送大量的 http 请求,有些请求成功,有些请求失败。

我不太清楚还能在哪里找到这个。如能得到任何帮助我将不胜感激。

编辑:我重新启动了 iptables 服务,问题就消失了,但那时很多 http 作业也已经完成了。我尝试再次运行作业,但没有看到问题再次出现。如果再次看到问题,我会切换到 wget 而不是 cURL。

答案1

询问您的托管服务提供商/ISP 是否在他们那边实施了任何过滤。也许有人试图对您的服务器进行 dDoS 攻击,攻击端口为 80。其他想法是:检查路由和您的 DNS 解析器配置。

在该服务器和另一台机器之间进行一些测试运行。使用 tcpdump 检查两台机器上的端口 80。使用 tcpdump 您应该可以看到传入/传出的流量,即使您自己的机器的防火墙正在丢弃它。

相关内容