I'm having a problem using iptables on my Raspberry PI.
I've just downloaded a fresh version of Raspbian Lite on my PI and all I'm trying to do is check my iptables rules but it's not working and I'm getting this error:>> iptables -L
iptables/1.8.2 Failed to initialize nft: Protocol not supported
I don't know what to do? could I go back to an older version of iptables or something?
Bare in mind I'm a real beginner in the IT world.
Iptables/1.8.2 Failed to initialize nft: Protocol not supported
iptablesraspberry piraspbian
Best Answer
Raspbian certainly followed its Debian upstream there: by default the newer
iptables
userland tools are using the nftables kernel API instead of the "legacy" iptables kernel API, as told here:nftables
is aiming at completely replacingiptables
with extended features, but has a quite different implementation. A compatibility layer will be kept anyway, mostly in the userland tools, but partially in the kernel. This is in addition of the usualiptables
"legacy" layer which will still be in the kernel for a long time.The newer version of
iptables
is using this compatibility layer. This can be easily verified by running (as root)iptables -V
. Result will most certainly be:While the legacy version is still shipped:
At the same time I guess your kernel doesn't support nftables for whatever reason.
So you can:
get support for nftables in the kernel (and probably also at least
NFT_COMPAT
). Might require recompiling it or upgrading it in case you kept an older one. If this task requires too much effort, you can use the other alternative,or use legacy version of
iptables
which will use the usual iptables kernel API. The previous link explains how to do it. As root user do (at least foriptables
andip6tables
, and maybe forebtables
andarptables
if installed):