您的位置:首页 > 其它

iptables启动提示unable to initialize table 'filter'

2015-03-12 10:09 309 查看



部分执行yum update升级或自己编译了Linux内核的系统,在完成升级以后,重启或启动iptables会出现“iptables-restore: unable to initialize table 'filter''”错误,中文翻译是:iptables的恢复:无法初始化表“过滤器”。

详细错误如下:

Applying iptables firewall rules: FATAL: Could not open
'kernel/net/ipv4/netfilter/ip_tables.ko': No such file or directory
iptables-restore v1.4.9: iptables-restore: unable to initialize table
'filter'
Error occurred at line: 1
Try `iptables-restore -h' or 'iptables-restore --help' for more
information.


这个原因是可能在升级内核时,同时升级了iptables的系统模块,最新的模块未被加载,所以我们可以尝试以下方法解决。

一、尝试直接加载模块

modprobe ip_tables
modprobe iptable_filter


手动加载 ip_tables 和 iptables_filter模块,若没提示错误,表示模块加载没问题,直接尝试iptables重启即可。

若提示以下错误(如下图)请尝试第二步操作:



二、检查当前内核中是否有iptables相关模块

ls -al /lib/modules/`uname -r`/kernel/net/ipv4/netfilter


SSH执行以上命令,并输出以下结果



如果在输出的结果中拥有以上两个红色框线所示内容,则表示系统中有相关模块,但可能没被载入,需要手动载入。如果没有框线所示内容,请尝试重新编译内核。

depmod -a


载入完毕后,再进行一次模块加载

modprobe ip_tables
modprobe iptable_filter


SSH执行以上命令,重新分析并加载模块,执行完毕,尝试启动iptables,如下图则表示启动成功。



三、附一个内核重编译方法

cd /usr/src/linux    #进入源码目录
make install         #进行安装操作
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐