听说用modprobe ip_tables就可以启动iptables了。但是用了这个命令以后,出现:
modprobe: ERROR: ../libkmod/libkmod.c:514 lookup_builtin_file() could not open builtin file '/lib/modules/2.6.32-042stab116.1/modules.builtin.bin'
modprobe: FATAL: Module iptables not found in directory /lib/modules/2.6.32-042stab116.1现在糊涂了,到底会是iptables的错误还是modprobe的错误?该怎么解决?
另外还有其它问题,如:怎么启动iptables,怎么停止iptables?
分别尝试过以下命令:service iptables start 
然后就报错,说没有iptables这个服务。我明明装了啊
iptables -LChain INPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:sshChain FORWARD (policy ACCEPT)
target     prot opt source               destination         Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination   求热心人士小帮一把。

解决方案 »

  1.   

    可以参考http://blog.csdn.net/renwotao2009/article/details/51225359
      

  2.   

    看过了,好像就点像天书,目前我只想确认下iptables有没有启动。
    我试过 service iptables start
    结果:Failed to start iptables.service: Unit iptables.service not found
    我试过:/etc/init.d/iptables start
    结果:bash: /etc/init.d/iptables: No such file or directory
      

  3.   

    看过了,好像就点像天书,目前我只想确认下iptables有没有启动。
    我试过 service iptables start
    结果:Failed to start iptables.service: Unit iptables.service not found
    我试过:/etc/init.d/iptables start
    结果:bash: /etc/init.d/iptables: No such file or directory
    你安装iptables了吗?
      

  4.   

    看过了,好像就点像天书,目前我只想确认下iptables有没有启动。
    我试过 service iptables start
    结果:Failed to start iptables.service: Unit iptables.service not found
    我试过:/etc/init.d/iptables start
    结果:bash: /etc/init.d/iptables: No such file or directory
    你安装iptables了吗?
    肯定安装了啊。安没安装我还是知道的。
    最近在做VPN server 要用到iptables 做nat转发,结果无论怎么做,都不能上外网啊。大侠要是有这方面的经验还望不吝赐教!!
    谢谢了
      

  5.   

    另外,这是我目前设置的规则:
    root@localhost:/home/sam# iptables -t nat -nL
    Chain PREROUTING (policy ACCEPT)
    target     prot opt source               destination         Chain POSTROUTING (policy ACCEPT)
    target     prot opt source               destination         
    SNAT       all  --  192.168.1.0/24       0.0.0.0/0            to:23.83.225.181Chain OUTPUT (policy ACCEPT)
    target     prot opt source               destination         
    root@localhost:/home/sam# 
      

  6.   

    貌似楼主安装了iptables命令行,而且从iptables -L的输出来看,各种内核模块也都有,应该可以正常工作。另外,serverice下面的iptabels(服务)只是一堆包装的服务/脚本而已,有没有没有关系。(主要影响开启自动启动)PS,如果在谈“启动”/“停止”iptables的时候,多半指的是iptables服务,也就是service或者init.d目录下的控制脚本。
      

  7.   

    举个(不恰当的)例子,有点像安装了apache但是没有httpd service的状态。
    不能开机自动启动,但是不妨碍手工启动。
      

  8.   

    http://askubuntu.com/questions/687369/could-not-open-builtin-file-modules-builtin-bin
    Looks like you have a mismatch between which kernel version modprobe is looking for 2.6.32-042stab104.1 vs the version you have (re)installed 3.19.0-30-generic.
    use uname -r to dump your running kernel. It looks like you have some custom kernel installed - check your bootloader (probably grub) to see if it is hardcoded to some ancient kernel instead of the lastest installed kernel.
    2.6.32 is old (ancient) enough that it probably doesn't use modules.builtin.bin - so you may have a mismatch in your modutils version vs your kernelhttps://lists.debian.org/debian-boot/2014/09/msg00880.html
    modules.builtin is generated at kernel build time and can't be regenerated from the installed kernel or modules.
      

  9.   

    谢谢你热心回复。
    小弟英文实在是差!目前能掌握的英文基本上都是从羡剧里学的
    看到kernel这个词我就怕了,小弟是新手,才接触linux,更不要提内核了这个系统是刚刚安装的,什么都没动过呢。另外今天又有新的问题,安装mysql,然后就启动,结果Error,说是遇到找不到mysql.sock文件,看错误日志吧,找了半天没到。我想可能是因为是正在安装,所以没来得及写日志就退出了。
    我是apt-get install安装的,如果需要依赖的话,它自己应该能搞定。
    只能看屏幕,看configure的记录,发现有很多文件夹没有crateing成功,再往前翻,发现locale:cannot set TC_某某某。于是看locales,cat出来结果是空文件,然后又cd /var/lib/locales,然后就提示 no such file.....我也是不知道怎么办了,想当然的apt-get install locale吧,结果还是么有想把我电脑上的locales文件夹scp过去吧,结果提示:这不是一个普通的文件(机器翻译过的)
    我醉醉的,重装系统吧。。
      

  10.   

    modprobe: FATAL: Module iptables not found in directory /lib/modules/2.6.32-042stab116.1这个错误表时是配置问题呀你用的是什么操作系统?另外最近在做VPN server 要用到iptables 做nat转发,结果无论怎么做,都不能上外网啊。大侠要是有这方面的经验还望不吝赐教!!请问你的SELINUX配置了吗?直接把SELINUX关了试一下(怎么关问度娘)
      

  11.   

    和楼主相同的错误,centos,
    联网之后,执行下面的命令就可以使firewald加载iptables
    systemctl stop firewalld
    system mask firewalld
    yum install iptables-services
    service iptables status
    OK...
      

  12.   

    Ubuntu 安装完就有 iptables (预装了),无需另外安装。
    我也没有见过 modprobe iptables 这句。modprobe 其他 iptables 的模块就有。
    你现在应该直接用就行。另外,看看 
    iptables -t nat -S
    的输出。
      

  13.   

    用的是CentOS 7 吗1.防火墙状态接着先是看centos7的防火墙的状态,查看的命令为
    sudo systemctl status firewalld。
    查看后,看到active(running)就意味着防火墙打开了。2.启动防火墙打开防火墙的命令为:
    sudo systemctl start firewalld。3.关闭防火墙如果想关闭防火墙,命令为:
    sudo systemctl stop firewalld。
    关闭后查看是否关闭成功,如果看到inactive(dead)就意味着防火墙关闭了。
    (我也是从网上找的)