Quantcast
Channel: linuxadmin: Expanding Linux SysAdmin knowledge
Viewing all articles
Browse latest Browse all 17770

Can iptables perform deterministic NAT when configured by IP range? (i.e original IP x always translates to NAT IP y)

$
0
0

Hello, everybody.

I found this article talking about how to configure a NAT range in iptables http://www.cyberciti.biz/tips/linux-iptables-how-to-specify-a-range-of-ip-addresses-or-ports.html

I'm not sure yet how to force the translations to be deterministic though.

I ask because I have a NAT table that's starting to look like the example below as new hosts are added to the mix. I'd like to replace all this with a one liner and still have all hosts consistently accessible

Chain PREROUTING (policy ACCEPT)

target prot opt source destination

DNAT all -- anywhere 172.1.1.1 to:10.1.1.1

DNAT all -- anywhere 172.1.1.2 to:10.1.1.2

DNAT all -- anywhere 172.1.1.3 to:10.1.1.2

..

Chain POSTROUTING (policy ACCEPT)

target prot opt source destination

SNAT all -- 10.1.1.1 anywhere to:172.1.1.1

SNAT all -- 10.1.1.2 anywhere to:172.1.1.2

SNAT all -- 10.1.1.3 anywhere to:172.1.1.3

..

Thanks SHM

Edit: All set. Solution provided in This x-post

submitted by simpleharmonicmotion
[link][comment]

Viewing all articles
Browse latest Browse all 17770

Trending Articles