I have a Fedora 31 system on which I am using iptables-nft
. I need this because there is still a bunch of software that expects the legacy iptables
command line tools. This means that my nftables configuration has the corresponding set of tables to match the legacy configuration:
table ip filter
table ip nat
table ip6 filter
table ip mangle
table ip6 nat
table ip6 mangle
I use a containerized VPN service that, prior to nftables, would enable masquerading on my primary ethernet interface by running something like this when the vpn comes up:
iptables -t nat -A POSTROUTING -s 172.16.254.0/24 -o eth0 -j MASQUERADE
Since upgrading to Fedora 31 and iptables-nft
, this no longer works. The container (running alpine) does not have the iptables-nft
compatability wrapper, but it does have the nft
command itself.
I can't use the nft
cli to add rules to the existing tables, because this will break iptables-nft
. But I can create new tables. I was hoping I could just apply a configuration like this:
table ip vpn {
chain postrouting {
type nat hook postrouting priority filter; policy accept;
ip saddr 172.16.254.0/24 oifname "eth0" counter masquerade
}
chain forward {
type filter hook forward priority filter; policy accept;
ip saddr 172.16.254.0/24 counter accept
}
}
...but this doesn't appear to have any impact. By setting the chains in this table to priority 0 I was hoping they would match before the legacy nat
table, but that doesn't appear to be the case.
Is there a way to make this work?