【发布时间】:2014-09-01 11:41:03
【问题描述】:
我刚刚在全新的 CentOS 6.5 安装中安装了 apache。我在浏览器地址栏输入了ip地址,连接失败。然后我关闭了 iptables,重新刷新,这次我可以连接了。
很明显 iptables 正在阻止 http(端口 80)流量。
所以我查看了 iptables 规则(在新的 Centos 安装后保持不变记住):
[root@centos ~]# iptables --list
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT icmp -- anywhere anywhere
ACCEPT all -- anywhere anywhere
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ssh
REJECT all -- anywhere anywhere reject-with icmp-host-prohibited
Chain FORWARD (policy ACCEPT)
target prot opt source destination
REJECT all -- anywhere anywhere reject-with icmp-host-prohibited
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
现在,我不是 iptables 专家,但我认为我对它的理解足以解决这样的简单问题。但我很困惑,因为 INPUT 链中的第 3 行是这样的:
ACCEPT all -- anywhere anywhere
这似乎是在说“对于任何协议,从任何来源,到任何目的地,都接受”
所以我希望我可以连接到网站(tcp,端口 80)。但我不能。所以我一定误解了 iptables 的工作原理,或者列表的含义。
谁能解释一下为什么上述规则不允许传入的http连接?
【问题讨论】: