Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Philip Craig <philipc@snapgear.com>
To: Yaron Presente <ypresente@mrv.com>
Cc: netfilter@lists.netfilter.org
Subject: Re: many one-to-one NAT
Date: Mon, 17 May 2004 16:09:55 +1000	[thread overview]
Message-ID: <40A85733.5090400@snapgear.com> (raw)
In-Reply-To: <40A76773.2060402@mrv.com>

Yaron Presente wrote:
> I would like to do NAT from a private range to a public range of the 
> same size, in a way that just
> the network part of the IP address would be translated.

Use the NETMAP target.  This is included in 2.6, but I think you have to
patch 2.4 kernels still.

> For example, I would like a single iptables rule to map 192.168.10.0/24 
> => 10.1.1.0/24 as follows:
> 192.168.10.1 => 10.1.1.1
> 192.168.10.2 => 10.1.1.2
> .
> .
> .
> 192.168.10.254 => 10.1.1.254

Assuming 192.168.10.0/24 is private:

iptables -t nat -A PREROUTING -d 10.1.1.0/24 -j NETMAP --to 192.168.10.0/24
iptables -t nat -A POSTROUTING -s 192.168.10.0/24 -j NETMAP --to 10.1.1.0/24

-- 
Philip Craig - SnapGear, A CyberGuard Company - http://www.SnapGear.com



      reply	other threads:[~2004-05-17  6:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-16 13:06 many one-to-one NAT Yaron Presente
2004-05-17  6:09 ` Philip Craig [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=40A85733.5090400@snapgear.com \
    --to=philipc@snapgear.com \
    --cc=netfilter@lists.netfilter.org \
    --cc=ypresente@mrv.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox