Mani Varma Indukuri
Mani Varma Indukuri

Reputation: 1

How to add NFT SNAT rule for IPv6?

I am trying to add SNAT NFT rule for IPv6 in my router. Any ougoing packet through interface enp1s0 should be SNATted with the below IPv6 address. These are the rules I tried and errors.

nft add rule inet nat postrouting oifname "enp1s0" snat ip6 to 2401:fb00:0:1ff::32d/64

Error: Could not process rule: No such file or directory add rule inet nat postrouting oifname enp1s0 snat ip6 to 2401:fb00:0:1ff::32d/64 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

nft add rule nat postrouting oifname "enp1s0" snat to 2401:fb00:0:1ff::32d

Error: Could not resolve hostname: Address family for hostname not supported add rule nat postrouting oifname enp1s0 snat to 2401:fb00:0:1ff::32d ^^^^^^^^^^^^^^^^^^^^

nft add rule nat postrouting ip6 oifname enp1s0 snat to 2401:fb00:0:1ff::32d

Error: syntax error, unexpected oifname add rule nat postrouting ip6 oifname enp1s0 snat to 2401:fb00:0:1ff::32d ^^^^^^^

These are the issues I get. Any help would be appreciated.

Upvotes: 0

Views: 2730

Answers (1)

billyklh
billyklh

Reputation: 49

You can try:

nft add rule ip6 nat postrouting meta oifname enp1s0 snat to 2401:fb00:0:1ff::32d

Ref: Quick reference-nftables in 10 minutes

Upvotes: 1

Related Questions