All of lore.kernel.org
 help / color / mirror / Atom feed
* SNAT / MASQUERADE to a different IP
@ 2006-03-09 22:09 Eduardo Bejar
  2006-03-09 22:18 ` Robby Workman
  0 siblings, 1 reply; 2+ messages in thread
From: Eduardo Bejar @ 2006-03-09 22:09 UTC (permalink / raw)
  To: netfilter

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.

Any thoughts about this will be very appreciated.

Thanks!

Edo






^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: SNAT / MASQUERADE to a different IP
  2006-03-09 22:09 SNAT / MASQUERADE to a different IP Eduardo Bejar
@ 2006-03-09 22:18 ` Robby Workman
  0 siblings, 0 replies; 2+ messages in thread
From: Robby Workman @ 2006-03-09 22:18 UTC (permalink / raw)
  To: netfilter

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-03-09 22:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-09 22:09 SNAT / MASQUERADE to a different IP Eduardo Bejar
2006-03-09 22:18 ` Robby Workman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.