| 1 |
# snat |
| 2 |
|
| 3 |
Source NAT is used to mangle traffic by using standard [rules](../rule/index.md). |
| 4 |
|
| 5 |
Example: |
| 6 |
|
| 7 |
``` |
| 8 |
snat { |
| 9 |
# Masquerade all traffic from 10.0.0.0/8 going to eth0 interface. |
| 10 |
# New outgoing IP is eth0's IP address. |
| 11 |
saddr 10.0.0.0/8 oifname eth0 masquerade |
| 12 |
|
| 13 |
# Use outgoing IP 192.0.2.32 to all non-IPsec traffic coming from |
| 14 |
# 10.0.0.0/8 and going to eth1 interface. |
| 15 |
saddr 10.0.0.0/8 oifname eth1 -dipsec snat 192.0.2.32 |
| 16 |
|
| 17 |
# IPv6-to-IPv6 Network Prefix Translation (NPTv6) |
| 18 |
saddr fd00:f00:4444::/64 oifname eth2 snat_prefix to 2a03:1111:222:8888::/64 |
| 19 |
} |
| 20 |
``` |
| 21 |
|
| 22 |
Remember to accept SNAT'ed traffic in zone-zone section. |
| 23 |
See [dnat](dnat.md) for more examples. |