How to make one to one NAT with iptables ?

Daniel Elías Robles d.robles@codetel.net.do
Thu, 5 Jul 2001 03:21:26 +0100


I Just implemented the two lines below in my script and can not get that
nat?

Any help ?


Elias


On Mon, Jul 02, 2001 at 11:46:38AM +0800, Steven Foong wrote:
> Hi !
>
> May I know how to make an one to one NAT with iptables ? I am using RedHat
> 7.1 with kernel 2.4 and using IPTABLES. Now I need to map a few public IP
to
> private IP , how can I do it with iptables ? Thank You !

I'm thinking you want something like the following to nat 192.168.1.2 to
1.2.3.4:

iptables -t nat -A POSTROUTING -s 192.168.1.2 -j SNAT --to 1.2.3.4
iptables -t nat -A PREROUTING -d 1.2.3.4 -j DNAT --to 192.168.1.2

-Adam