1. 发现问题
在 ubuntu-20.04 上使用 iptables
时,遇到以下报错:
iptables v1.8.4 (legacy): Couldn't load match `string':No such file or directory
Try `iptables -h' or 'iptables --help' for more information.
2. 解决问题
ubuntu-20 的 apt 源中只有 iptables-1.8.4
,需要先换上 ubuntu-22 的 apt 源,然后重装 iptables
:
sudo apt reinstall iptables
就可以安装上 iptables-1.8.7
,此时再使用就不会出现问题了。