iptables v1.6.1: can‘t initialize iptables table `filter‘

Linux系统:AlmaLinux 9.2

容器内部加载iptables失败:

bash-4.4# iptables -nvL
iptables v1.6.1: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.

var code = "fb0d5928-c0ef-4a54-a1a3-7f7162b9bc13"

分析:

理论上来说,宿主机和容器是公用内核的,iptables是基于 iptable_filter这个模块的,

使用lsmod查看内核有没有加载这个模块,发现的确没有加载,

加载内核模块iptable_filter

[root@localhost ~]# modprobe iptable_filter
[root@localhost ~]# lsmod | grep ip
iptable_filter         16384  0
ip_tables              28672  1 iptable_filter
nf_defrag_ipv6         24576  1 nf_conntrack
nf_defrag_ipv4         16384  1 nf_conntrack

成功加载iptable_filter以后发现容器内就可以使用iptables了

bash-4.4# iptables -nvL
Chain INPUT (policy ACCEPT 8847 packets, 1353K bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain OUTPUT (policy ACCEPT 9207 packets, 1257K bytes)
 pkts bytes target     prot opt in     out     source               destination       

posted @   JackLovey3  阅读(290)  评论(0编辑  收藏  举报  
相关博文:
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
点击右上角即可分享
微信分享提示