求热心人帮忙,iptables不会用 我是ubuntu16

Porsion 2016-07-19 10:28:02
听说用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 -L

Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT tcp -- anywhere anywhere tcp dpt:ssh

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

求热心人士小帮一把。。。。
...全文
8532 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
韩老九 2019-10-21
  • 打赏
  • 举报
回复
用的是CentOS 7 吗

1.防火墙状态

接着先是看centos7的防火墙的状态,查看的命令为
sudo systemctl status firewalld。
查看后,看到active(running)就意味着防火墙打开了。

2.启动防火墙

打开防火墙的命令为:
sudo systemctl start firewalld。

3.关闭防火墙

如果想关闭防火墙,命令为:
sudo systemctl stop firewalld。
关闭后查看是否关闭成功,如果看到inactive(dead)就意味着防火墙关闭了。
(我也是从网上找的)
pyqix 2017-07-09
  • 打赏
  • 举报
回复
Ubuntu 安装完就有 iptables (预装了),无需另外安装。 我也没有见过 modprobe iptables 这句。modprobe 其他 iptables 的模块就有。 你现在应该直接用就行。 另外,看看 iptables -t nat -S 的输出。
Terisadeng 2017-06-13
  • 打赏
  • 举报
回复
和楼主相同的错误,centos, 联网之后,执行下面的命令就可以使firewald加载iptables systemctl stop firewalld system mask firewalld yum install iptables-services service iptables status OK...
califord 2016-07-23
  • 打赏
  • 举报
回复
modprobe: FATAL: Module iptables not found in directory /lib/modules/2.6.32-042stab116.1 这个错误表时是配置问题呀 你用的是什么操作系统? 另外最近在做VPN server 要用到iptables 做nat转发,结果无论怎么做,都不能上外网啊。大侠要是有这方面的经验还望不吝赐教!! 请问你的SELINUX配置了吗?直接把SELINUX关了试一下(怎么关问度娘)
Porsion 2016-07-23
  • 打赏
  • 举报
回复
引用 9 楼 nswcfd 的回复:
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 kernel https://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.
谢谢你热心回复。 小弟英文实在是差!目前能掌握的英文基本上都是从羡剧里学的。。。 看到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过去吧,结果提示:这不是一个普通的文件(机器翻译过的) 我醉醉的,重装系统吧。。
Porsion 2016-07-22
  • 打赏
  • 举报
回复
求帮忙啊 么人来帮一下吗,初学者,英文又差。。。。
nswcfd 2016-07-22
  • 打赏
  • 举报
回复
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 kernel https://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.
nswcfd 2016-07-22
  • 打赏
  • 举报
回复
举个(不恰当的)例子,有点像安装了apache但是没有httpd service的状态。 不能开机自动启动,但是不妨碍手工启动。
nswcfd 2016-07-22
  • 打赏
  • 举报
回复
貌似楼主安装了iptables命令行,而且从iptables -L的输出来看,各种内核模块也都有,应该可以正常工作。 另外,serverice下面的iptabels(服务)只是一堆包装的服务/脚本而已,有没有没有关系。(主要影响开启自动启动) PS,如果在谈“启动”/“停止”iptables的时候,多半指的是iptables服务,也就是service或者init.d目录下的控制脚本。
Porsion 2016-07-21
  • 打赏
  • 举报
回复
另外,这是我目前设置的规则: 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.181 Chain OUTPUT (policy ACCEPT) target prot opt source destination root@localhost:/home/sam#
Porsion 2016-07-21
  • 打赏
  • 举报
回复
引用 3 楼 renwotao2009 的回复:
[quote=引用 2 楼 Porsion 的回复:] [quote=引用 1 楼 renwotao2009 的回复:] 可以参考http://blog.csdn.net/renwotao2009/article/details/51225359
看过了,好像就点像天书,目前我只想确认下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 [/quote]你安装iptables了吗?[/quote] 肯定安装了啊。安没安装我还是知道的。 最近在做VPN server 要用到iptables 做nat转发,结果无论怎么做,都不能上外网啊。大侠要是有这方面的经验还望不吝赐教!! 谢谢了
renwotao2009 2016-07-20
  • 打赏
  • 举报
回复
引用 2 楼 Porsion 的回复:
[quote=引用 1 楼 renwotao2009 的回复:] 可以参考http://blog.csdn.net/renwotao2009/article/details/51225359
看过了,好像就点像天书,目前我只想确认下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 [/quote]你安装iptables了吗?
Porsion 2016-07-19
  • 打赏
  • 举报
回复
引用 1 楼 renwotao2009 的回复:
可以参考http://blog.csdn.net/renwotao2009/article/details/51225359
看过了,好像就点像天书,目前我只想确认下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
renwotao2009 2016-07-19
  • 打赏
  • 举报
回复
可以参考http://blog.csdn.net/renwotao2009/article/details/51225359

19,612

社区成员

发帖
与我相关
我的任务
社区描述
系统使用、管理、维护问题。可以是Ubuntu, Fedora, Unix等等
社区管理员
  • 系统维护与使用区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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