NETMAP target

NETMAP is a new implementation of the SNAT and DNAT targets where the host part of the IP address isn't changed. It provides a 1:1 NAT function for whole networks which isn't available in the standard SNAT and DNAT functions. For example, lets say we have a network containing 254 hosts using private IP addresses (a /24 network), and we just got a new /24 network of public IP's. Instead of walking around and changing the IP of each and every one of the hosts, we would be able to simply use the NETMAP target like -j NETMAP -to and voila, all the hosts are seen as 10.5.6.x when they leave the firewall. For example, would become

Table 11-11. NETMAP target options

Exampleiptables -t mangle -A PREROUTING -s -j NETMAP --to
ExplanationThis is the only option of the NETMAP target. In the above example, the 192.168.1.x hosts will be directly translated into 10.5.6.x.


Works under Linux kernel 2.5 and 2.6.