<feed xmlns='http://www.w3.org/2005/Atom'>
<title>firewall4/tests/03_rules/16_nat_npt, branch master</title>
<subtitle>OpenWrt nftables firewall</subtitle>
<id>https://git.openwrt.org/project/firewall4/atom?h=master</id>
<link rel='self' href='https://git.openwrt.org/project/firewall4/atom?h=master'/>
<link rel='alternate' type='text/html' href='https://git.openwrt.org/project/firewall4/'/>
<updated>2026-10-28T13:07:03Z</updated>
<entry>
<title>fw4: add the npt target to nat sections</title>
<updated>2026-10-28T13:07:03Z</updated>
<author>
<name>John Crispin</name>
</author>
<published>2026-10-28T10:27:30Z</published>
<link rel='alternate' type='text/html' href='https://git.openwrt.org/project/firewall4/commit/?id=135420c4b039aa37c8a3f589df12c18a8bd24efe'/>
<id>urn:sha1:135420c4b039aa37c8a3f589df12c18a8bd24efe</id>
<content type='text'>
A nat section with target 'npt' maps an internal prefix to an external
prefix of the same length, in the manner of RFC 6296:

  config nat
          option name 'lan-ula'
          option src 'wan'
          option target 'npt'
          option src_ip 'fd00:21::/64'
          option snat_ip '2001:db8:200::/64'

src or device selects the interface. fw4 emits a prefix SNAT for
traffic that leaves on it and the reverse prefix DNAT for traffic that
enters on it, so the interface identifier is kept and each host maps
1:1. IPv4 prefixes give a netmap the same way.

The nft prefix mapping is stateful and recomputes the transport
checksum, where RFC 6296 is stateless and checksum-neutral; the
addresses on the wire are the same. The mapping accepts no traffic:
the forward rules still decide.

Signed-off-by: John Crispin &lt;john@phrozen.org&gt;
</content>
</entry>
</feed>
