当前位置: 代码迷 >> Java Web开发 >> 在严厉情况下配置 iptables 时是否需要同时设置 filter, mangle, nat, raw, and security 为 DROP
  详细解决方案

在严厉情况下配置 iptables 时是否需要同时设置 filter, mangle, nat, raw, and security 为 DROP

热度:983   发布时间:2016-04-13 22:19:01.0
在严格情况下配置 iptables 时是否需要同时设置 filter, mangle, nat, raw, and security 为 DROP?
本帖最后由 global_biz 于 2015-10-14 18:08:02 编辑
Hi,

在严格情况下配置 iptables 时是否需要同时设置 filter, mangle, nat, raw, and security 为 DROP?
发现 filter, mangle, raw, security 可以将 chain 设置为 DROP ,但是 nat 不能设置为 DROP,提示说 nat 不是用来做 filtering??

实际项目上有没设置过 nat 为 DROP 或 REJECT 的?谢谢。

# iptables -L -t nat
Chain PREROUTING (policy ACCEPT)
target     prot opt source               destination         

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         

Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination         
# iptables -t nat -P OUTPUT DROP
iptables v1.4.21: 
The "nat" table is not intended for filtering, the use of DROP is therefore inhibited.


Try `iptables -h' or 'iptables --help' for more information.

------解决思路----------------------
一般来说,NAT是做地址转换的,比如修改源地址和目标地址,对数据包的通过和丢弃应该是在filter或mangle里做的。。写一个就好吧,要是有特殊要求可以写多个,不过我没试过。。。
还有,你这是Linux的问题。。这里是Java的,当然没人回复了
  相关解决方案