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

global_biz 2015-10-14 06:07:16
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.
#
...全文
434 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
global_biz 2015-10-15
  • 打赏
  • 举报
回复
引用 3 楼 zw0283 的回复:
一般来说,NAT是做地址转换的,比如修改源地址和目标地址,对数据包的通过和丢弃应该是在filter或mangle里做的。。写一个就好吧,要是有特殊要求可以写多个,不过我没试过。。。 还有,你这是Linux的问题。。这里是Java的,当然没人回复了
谢谢
zw0283 2015-10-15
  • 打赏
  • 举报
回复
一般来说,NAT是做地址转换的,比如修改源地址和目标地址,对数据包的通过和丢弃应该是在filter或mangle里做的。。写一个就好吧,要是有特殊要求可以写多个,不过我没试过。。。 还有,你这是Linux的问题。。这里是Java的,当然没人回复了
global_biz 2015-10-14
  • 打赏
  • 举报
回复
又没回复
global_biz 2015-10-14
  • 打赏
  • 举报
回复
有回复就结贴送分了。

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧