在使用docker启动容器的时候提示iptables: No chain/target/match by that name。这是因为没有iptables的的模块。
一开始觉得怎么可能,因为都可以使用指令了,为什么会没有包含此模块,结果lsmod的看了一下,还真的没有,试着做以下指令,
root@xxxx:~# iptables -L modprobe: FATAL: Module ip_tables not found. iptables v1.4.21: can't initialize iptables table `filter': Table does not exist (do you need to insmod?) Perhaps iptables or your kernel needs to be upgraded. root@xxxx:~# modprobe ip_tables modprobe: FATAL: Module ip_tables not found.
结果还真的没有此模块。
【解决办法】
find / -name "ip_tables*" ///lib/modules/`uname -r`/kernel/net/ipv4/netfilter/ip_tables.ko //如果找到了ip_tables.ko,你就可以进行如下操作 depmod modprobe ip_tables //或者 insmod /lib/modules/`uname -r`/kernel/net/ipv4/netfilter/ip_tables.ko 如果ip_tables.ko没有找到,那你就只能重新编译内核来支持iptables了 sudo make menuconfig // 選擇下面的 module // Networking support -> // Networking options -> // Network packet filtering framework (Netfilter) -> // IP: Netfilter Configuration sudo make all sudo make modules_install sudo make install