Re: NAT: 1-1 mapping from 192.168.x.x to 10.168.x.x ?

From: Allen Kistler (ackistler_at_oohay.moc)
Date: 09/01/04


Date: Wed, 01 Sep 2004 01:26:17 GMT

Stefano Masini wrote:
> Hi,
>
> I have a machine on a 192.168.x.x network that I would like to
> configure in such a way that it believes to be in 10.168.x.x.
>
> In other words, if a packet comes in from, say, 192.168.3.4, I would
> like it to be mangled as it was coming from 10.168.3.4.
>
> In the same way, I would like outgoing packets for 10.168.x.x to be
> mapped to 192.168.x.x.
>
> [snip]
>
> Anybody knows if this is doable ?

Specify a netmask on the --to address. The example in the netfilter HOWTO:

# iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -o eth1 \
         -j SNAT --to 1.2.3.0/24

The example does SNAT based on outgoing source address, whereas you
probably want to do SNAT based on incoming source address and DNAT based
on incoming destination address (separate rules) in PREROUTING for
different interfaces.



Relevant Pages

  • Outgoing DNAT, incoming SNAT?
    ... I know it's possible to perform SNAT on outgoing packets and DNAT on ... incoming ones, for purposes of IP masquerading, but is it possible to ...
    (microsoft.public.windowsxp.security_admin)
  • Outgoing DNAT, incoming SNAT?
    ... I know it's possible to perform SNAT on outgoing packets and DNAT on ... incoming ones, for purposes of IP masquerading, but is it possible to ...
    (microsoft.public.windowsxp.general)