Article Taggé NAT
Natting a network range with NETMAP+Iptables
Some times we need to do a 1 to 1 NAT of a network range depending upon a condition (the destination network for example).
For example, you have the 192.168.1.0/24 network and you would like to NAT each IP to its equivalent in 192.168.2.0/24 when the packet travels through the NAT device (so 192.168.1.100 becomes 192.168.2.100).
If you use Netfilter as a NAT device or gateway you can use the NETMAP module like this :
iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -d 10.1.1.0/24 -j NETMAP --to 192.168.2.0/24
I think that’s clear enough
Add comment 24 mars 2009
