msa*_*ers 6 iptables centos apache-2.2
我正在使用 Apache 2/MySQL 运行 Centos 6.0 服务器。我已经运行了 iptables。我今晚按照以下步骤使用 iptables 阻止来自 IP 的所有流量:
iptables -A INPUT -s xxx.xxx.xxx.xxx -j DROP
iptables -A OUTPUT -d xxx.xxx.xxx.xxx -j DROP
service iptables save
service iptables restart
Run Code Online (Sandbox Code Playgroud)
但是我仍然在我的 Apache 访问日志中不断看到来自这个 IP 的点击,即使在我重新启动 Apache 之后也是如此。iptables 肯定正在运行,而且它绝对是正确的 IP 地址。
这些是我其余的 iptables 条目:
Chain INPUT (policy ACCEPT)
num target prot opt source destination
1 ACCEPT all -- anywhere anywhere
2 REJECT all -- anywhere loopback/8 reject-with icmp-port-unreachable
3 ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
4 ACCEPT tcp -- anywhere anywhere tcp dpt:http
5 ACCEPT tcp -- anywhere anywhere tcp dpt:https
6 ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:30000
7 ACCEPT icmp -- anywhere anywhere icmp echo-request
8 REJECT all -- anywhere anywhere reject-with icmp-port-unreachable
Chain FORWARD (policy ACCEPT)
num target prot opt source destination
1 REJECT all -- anywhere anywhere reject-with icmp-port-unreachable
Chain OUTPUT (policy ACCEPT)
num target prot opt source destination
1 ACCEPT all -- anywhere anywhere
Run Code Online (Sandbox Code Playgroud)
我错过了什么?
dmo*_*ati 19
您的第一个 iptables 规则允许您尝试阻止的流量。
1 ACCEPT all -- anywhere anywhere
Run Code Online (Sandbox Code Playgroud)
订单很重要。
起初,我建议您使用system-config-firewall或system-config-firewall-tui。有一个带有“自定义规则”的部分可以为您执行此操作。
如果您想手动执行此类操作,则必须在 tcp dpt:http 的“接受”之前插入规则。最简单的方法是:
iptables -I INPUT 1 -s xxx.xxx.xxx.xxx -j DROP
(在位置 1 插入,而不是追加)
| 归档时间: |
|
| 查看次数: |
6510 次 |
| 最近记录: |