All of lore.kernel.org
 help / color / mirror / Atom feed
* only SNAT packets originating from local?
@ 2005-09-02 13:35 Christian Bricart
  2005-09-06 20:39 ` curby .
  0 siblings, 1 reply; 2+ messages in thread
From: Christian Bricart @ 2005-09-02 13:35 UTC (permalink / raw)
  To: netfilter

Hi,

is there a simple way to do SNAT for packets that originate from the
router itself?
I want to set a static IP for a multihomed router that does forwarding, too.

I've tried to set:

iptables -t nat -I POSTROUTING -p tcp --dport 4711 -j SNAT --to-source
1.2.3.4

but that does SNAT on forwardes packets, too..
Do I miss a rule on "-t filter OUTPUT"? maybe mangle with -j MARK and SNAT
packets that have a mark set?

Christian


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

* Re: only SNAT packets originating from local?
  2005-09-02 13:35 only SNAT packets originating from local? Christian Bricart
@ 2005-09-06 20:39 ` curby .
  0 siblings, 0 replies; 2+ messages in thread
From: curby . @ 2005-09-06 20:39 UTC (permalink / raw)
  To: netfilter

(forgot to CC the list the first time i sent this)

On 9/2/05, Christian Bricart <christian@bricart.de> wrote:
> is there a simple way to do SNAT for packets that originate from the
> router itself?

Try using something like the following:

iptables -t nat -A OUTPUT -j SNAT --to-source $EXTDEV_SNATIP

Of course, this is oftentimes not necessary, but it might be if you
have *multiple* external-facing static IPs from which you want to set
one for outbound traffic.

Off-topic musing: It might also be strange if you have two static IPs
A and B with sshd listening to port 22 on both of them.  Someone
connects to B, but you SNAT the reply out of A, and the client gets
confused and drops the reply.

--Curby


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

end of thread, other threads:[~2005-09-06 20:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-02 13:35 only SNAT packets originating from local? Christian Bricart
2005-09-06 20:39 ` curby .

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.