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

文章讲述了在LinuxAlmaLinux9.2环境下,容器内部尝试使用iptables时遇到的初始化失败问题。通过检查发现宿主机和容器共享内核但iptable_filter模块未加载,随后作者演示了如何加载该模块并成功使容器内的iptables功能恢复正常。
摘要由CSDN通过智能技术生成

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       

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值