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 :

service firewall restart

that problem is Host related.

When we inspect journalctl with:

sudo journalctl -xe

We get greeted by

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:

    --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:

    sudo modprobe ip6table_filter

And that’s it, you should by now have the problem solved.

André Ilhicas dos Santos

Devops Padawan, curious about systems automation, learning new languages, paradigms tools each day.

ilhicas ilhicas


Published