Skip to contentSkip to conversation

exclude NAT to multiple networks

DISCUSSION Matthew TenHulzen 2 participants 2 messages Nov 15, 2002 – Nov 22, 2002

lore
Share & tools
lore
#0 lore raw

I have the following NAT line that excludes NAT'ing to the 192.168.250.0/24 network.

$IPTABLES -t nat -A POSTROUTING -o $INET_IFACE -d ! 192.168.250.0/24 -j SNAT --to-source $INET_IP

I need to exclude NAT for additional networks, but cannot figure out how to do it. I have tried duplicating this line, but it doesn't work. I also cannot figure out how to specify multiple subnets in the same line.

Does anyone know how to exclude traffic to multiple subnets from being NAT'ed??

Matt

#1 lore raw
Quoted 6 lines · Matthew TenHulzen

I have the following NAT line that excludes NAT'ing to the 192.168.250.0/24 network.

$IPTABLES -t nat -A POSTROUTING -o $INET_IFACE -d ! 192.168.250.0/24 -j SNAT --to-source $INET_IP

Quoted 7 lines

I need to exclude NAT for additional networks, but cannot figure out how to do it. I have tried duplicating this line, but it doesn't work. I also cannot figure out how to specify multiple subnets in the same line.

Does anyone know how to exclude traffic to multiple subnets from being NAT'ed??

If you want those subnets to be ACCEPTed instead of SNATted, just set up a series of rules that test for your selected subnets, and ACCEPT them, then SNAT anything that makes it past those.

j