Ranged 1:1 NAT with iptables
Posted on 2011-10-10
I currently have two networks that I need to be able to talk to each other via a 1:1 NAT situation. I have a CentOS machine running iptables with a nic on each network, and would like to NAT a range of IP addresses between the two networks.
Even if it's a manual process rather than a couple of ranged commands, that's okay - I'm just struggling to get this working.
Basically, i'm trying to NAT 10.0.0.x/24 <--> 172.16.0.x/24
Computer A: 10.0.0.8/255.255.255.0
Computer B: 172.16.0.9/255.255.255.0
From computer A, I would like to be able to ping 10.0.0.9 and that be mapped to computer B's IP, 172.16.0.9, and vice versa. If computer B pings 172.16.0.8, that should be mapped to computer A @ 10.0.0.8.
Is this possible with iptables to begin with, and what's the best way of going about this?