Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Robby Workman <netfilter@rlworkman.net>
To: netfilter@lists.netfilter.org
Subject: Re: SNAT / MASQUERADE to a different IP
Date: Thu, 09 Mar 2006 16:18:16 -0600	[thread overview]
Message-ID: <4410A9A8.50002@rlworkman.net> (raw)
In-Reply-To: <019d01c643c6$193ab020$6bb1a8c0@veruca>

Eduardo Bejar wrote:
> Hi,
> 
> I have this setup:
> 
> LAN with one Fedora Server as gateway/email server.
> 
> Currently I masquerade all LAN traffic to use the same IP as the Server:
> 
> iptables -t nat -A POSTROUTING -s $LAN -o eth0 -j MASQUERADE
> 
> So, LAN and mail server use both the same IP address. This works fine, but
> now I´d like to make the LAN use a different IP address than the mail
> server, so I´d like to know how can I do that?
> 
> I tested SNAT, like:
> 
> iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to $IP
> 
> but with this, LAN and mail server now use $IP both, and what I´d like to do
> is assign different IP addresses: one for the LAN and other for the mail
> server.


Perhaps I'm oversimplifying this, but isn't this what you want?

iptables -t nat -A POSTROUTING -s $MAILSERVER -o eth0 -j SNAT --to $IP1
iptables -t nat -A POSTROUTING -s $LAN -o eth0 -j SNAT --to $IP2

-- 

http://rlworkman.net


      reply	other threads:[~2006-03-09 22:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-09 22:09 SNAT / MASQUERADE to a different IP Eduardo Bejar
2006-03-09 22:18 ` Robby Workman [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=4410A9A8.50002@rlworkman.net \
    --to=netfilter@rlworkman.net \
    --cc=netfilter@lists.netfilter.org \
    /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