Since I’m running iptables modifications via ansible inside docker containers, with Ubuntu as my Host OS, I’m frequently hit by being unable to do something like, when defining iptables rules in init.d :
1
service firewall restart
that problem is Host related.
When we inspect journalctl
with:
1
sudo journalctl -xe
We get greeted by
1
ip6tables v1.4.21: can't initialize ip6tables table `filter': Table does not exist (do you need to insmod?)
And each time this happens, I have to go through some messaging history to fix it.
So I decided to put here, so that others can also have an easy way to find the fix.
This happens after kernel updates for instance and is triggered in every container that has been started with:
1
--cap-add=NET_ADMIN
And even though the above, allows you to have iptables running inside the container, it also relies on the Host to provide the network capabilities, and that means it must first modprobe iptables.
So how to fix, if running in a Linux based Host?
With below command:
1
sudo modprobe ip6table_filter
And that’s it, you should by now have the problem solved.