Linux – SNAT in IP6Tables

iptablesipv6linux

Netfilter says they have support for SNAT and DNAT for ipv6. I look under the man pages of ip6tables and see that there is SNAT and DNAT listed. So my question is how do you make rules for them? I tried using the same structure of the rules for iptables, but ip6tables does not have a nat table and SNAT/DNAT are virtual states. So I don't know what modifications to make from an example like:

iptables -t nat -A POSTROUTING -o eth0 -j SNAT –to 1.2.3.4

to be applicable to ip6tables. Thanks for the help!

Best Answer

EDIT**: You need a 3.7+ kernel as that's when they released the NAT table for ipv6. Then you use iptables 1.4.17 and you can use the simple command of:

  • ip6tables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

ORIGINAL**:

Under the netfilter website you can find:

  • all kinds of network address and port translation, e.g. NAT/NAPT (IPv4 and IPv6)

From the ipv6 man page (http://linux.die.net/man/8/ip6tables)

  • SNAT
  • A virtual state, matching if the original source address differs from the reply destination.
  • DNAT
  • A virtual state, matching if the original destination differs from the reply source.

So it appears to be possible. But I have not found examples of its usage.