How to set up IPV6 NAT using nftables?

Since the master has switched to fw4, iptables becomes legacy, but I can't find a way to use nftables to set up IPV6 NAT. I have kmod-nft-nat6 installed.

The command doesn't work:

nft add rule ip6 nat POSTROUTING ip6 saddr $(uci get network.globals.ula_prefix) meta oif wan counter masquerade

masq6 maybe, but I dont know if it was updated

Sorry for the late reply because I didn't have chance to access my router until today. I updated to the master version and found the command in the main post is totally wrong in syntax

The right command should be:

nft add rule inet fw4 srcnat oifname wan meta nfproto ipv6 counter masquerade

This command enables IPV6 NAT.

The same effect can be achieved by setting option masq6 1 in the wan zone.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.