原文地址:http://blog.sina.com.cn/s/blog_654a4e8b0100ii3y.html

modprobe ip_tables
modprobe ip_conntrack
modprobe iptable_filter
modprobe ipt_state

Networking --->
Networking options --->
Network packet filtering framework (Netfilter) --->
Core Netfilter Configuration --->
Now just set the modules you need for your netfilter box. That's it, I hope now it works to you.

如果执行 iptable -L 出现以下信息,那么就需要重新配置和编译内核:
iptables v1.4.2: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.

配置选项:

Networking —->

Networking options —->

[*] Network packet filtering (replaces ipchains)  —>

Core Netfilter Configuration  —>

<*> Netfilter Xtables support (required for ip_tables)

IP: Netfilter Configuration —>

<*> Connection tracking (required for masq/NAT)

<*> IP tables support (required for filtering/masq/NAT)

<*>   IP range match support

<*>   Packet filtering

<*>     REJECT target support

<*>   Full NAT

ip_forward

除此之外,需要在主机上打开 ip 转发以保持连接通道。

查看是否已打开 ip 转发(1 表示打开):

cat /proc/sys/net/ipv4/ip_forward

如果未打开,则用以下命令打开:

echo 1 > /proc/sys/net/ipv4/ip_forward

保存设置

以上 iptables 设置和 ip 转发设置在重启系统之后就会消失,因此如果有需要,请将设置保存。

保存 iptables 设置:

/etc/init.d/iptables save

设置系统启动时自动加载 iptables 设置(以 gentoo 为例):

rc-update add iptables default

保存 ip_forward 设置(在 /etc/sysctl.conf 中设置):

net.ipv4.ip_forward = 1

安全隐患

在打开了 ip_forward 后,一般要同时打开 rp_filter (Reverse Path filter),对数据包的源地址进行检查。

如果在没有打开这个设置,就很容易受到来自内部网的 IP 欺骗。

打开 rp_filter:

for f in /proc/sys/net/ipv4/conf/*/rp_filter ; do echo 1 > $f ; done

保存设置(在 /etc/sysctl.conf 中设置):

net.ipv4.conf.default.rp_filter = 1

net.ipv4.conf.all.rp_filter = 1

Linux中can't initialize iptables table `nat': Table does相关推荐

  1. Linux中的火墙(1)(iptables)

    文章目录 1.火墙介绍 2.火墙管理工具切换 3.iptables 的使用 4.火墙默认策略 5.iptables命令 1.火墙介绍 netfilter:真正的防火墙,位于内核空间. iptables ...

  2. 【Q】之Linux中的防火墙netfilter iptables

    防火墙 一.Linux防火墙基础 1.1 Linux包过滤防火墙概述 1.2 数据包控制的匹配流程 控制的匹配流程

  3. Linux中的火墙策略优化(iptables,firewalld)

    一.火墙介绍 1.netfilter 2.iptables 3.iptables | firewalld 二.火墙管理工具切换 在rhel8中默认使用的是firewalldfirewalld----- ...

  4. linux服务器80端口是默认开放的么_「Linux」25节-防火墙iptables

    前言 Linux作为最热门的服务器操作系统,自然离不开网络请求.谈到Linux,只要听过Linux系统名字的同学估计都会说"安全性高",我们说的安全性也包括了网络安全. 在Linu ...

  5. 【Linux】Linux中IP地址的配置及常见网络问题

    目录 一.Linux中IP地址的配置 (NAT模式)网卡配置文件解析: 二.Network服务和NetworkManager服务 centos下network和NetworkManager冲突的解 决 ...

  6. linux中iptables入门教程--设置静态防火墙

    1.iptables介绍 iptables是复杂的,它集成到linux内核中.用户通过iptables,可以对进出你的计算机的数据包进行过滤.通过iptables命令设置你的规则,来把守你的计算机网络 ...

  7. Linux中的火墙 - iptables

    Linux中的火墙 - iptables 1.火墙介绍 2.火墙管理工具切换 3.iptables 的使用 4.火墙默认策略 5.iptables命令 1.火墙介绍 1.火墙技术 防火墙技术是通过有机 ...

  8. 【linux进阶9】linux中的iptables火墙优化策略

    linux中的iptables火墙优化策略 一.基本命令 二.火墙的切换 三.iptables的使用及火墙使用规则 (1).名词解释 (2).表格解释 (3).iptables使用方式 1).基本命令 ...

  9. linux中iptables配置文件及命令详解详解

    linux中iptables配置文件及命令详解详解 2018年05月04日 14:23:41 hxpjava1 阅读数 956 linux中iptables配置文件及命令详解详解 iptables配置 ...

最新文章

  1. D~信息学/计算机专业操作
  2. SAP财务中国本土好内容
  3. 分布式架构的水平和垂直扩容
  4. c语言中的素数定理,素数定理
  5. 词法分析器java_Java代码到底是如何编译成机器指令的。
  6. 机器学习实战9-运行Tensorflow(california_housing数据集)
  7. Requesting JavaScript AST from selection
  8. 来自一个用户的体验-Alpha项目测试
  9. AE/PR/FCPX超强视觉特效插件包FxFactory
  10. ASP.net发布项目引用了C++DLL后页面提示找不到指定模块的异常
  11. 【UE4】特效之 Particle System 详解(一)—— 综述
  12. xrd计算晶面间距_xrd如何计算晶格间距(1)
  13. 录音怎么转换成mp3格式?
  14. java 视频转mp4_java视频转码mov转MP4
  15. android edittext怎样获取输入的内容,如何获取edittext中输入的内容?
  16. Ubuntu Server 安装Nginx 实例
  17. K8S集群中Pod挂载Storageclass存储卷异常排查思路
  18. 园友们赶快行动起来,免费获得微软MCSD证书!
  19. BZOJ2716天使玩偶
  20. 怎样在Winform窗体中嵌入Web浏览器

热门文章

  1. 【财富空间】彭剑锋:中国企业如何赢得未来?这6个关键词最值得关注
  2. 剪贴板增强工具Ditto
  3. 量化交易软件:运用 R-平方 评估策略余额曲线的品质
  4. 微信小程序云开发之用户输入数据后excel表格导出升级版
  5. 分享:一个javaweb宿舍管理系统(bootstrap)(附码云源码)~~~
  6. excel2013将表格打印在一张纸上
  7. 掌握企业核心:工商详细信息API 60多项全维度信息解读
  8. T1049晶晶赴约会 (信息学一本通C++)
  9. 计算机组成原理系统总线概念,计算机组成原理-系统总线
  10. 【观察】“新基建”下的数据中心,未来的演进与趋势