Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Carsten Maass <cm@blinkenlichten.de>
To: netfilter@lists.netfilter.org
Subject: Re: [solved] Re: Iptables / KAME IPSec problem: source port information lost
Date: Sun, 14 Mar 2004 01:55:38 +0100	[thread overview]
Message-ID: <4053AD8A.8070607@blinkenlichten.de> (raw)
In-Reply-To: <200403132235.54603.Antony@Soft-Solutions.co.uk>

Antony Stone wrote:
> On Saturday 13 March 2004 10:16 pm, Carsten Maass wrote:
> 
> 
>>Even if it's not completely clear to me why: the offending rule was
>>
>>$IPTABLES -t nat -A POSTROUTING -o $INET_IFACE -j SNAT --to-source $INET_IP
>>
>>It seems to do some kind of NATing to all traffic leaving the gateway.
> 
> 
> Er, why shouldn't it do this?   The rule says "for any packet leaving 
> $INET_IFACE, change the Source Address so that it is $INET_IP".
> 
> Therefore all traffic leaving the gateway is going to be SNATted.... no 
> surprise there?

Not all traffic should be SNATed, only traffic leaving via $INET_IFACE. 
Traffic leaving via $LAN_IFACE should not be altered, which the above 
rule nevertheless did.

>>When i narrowed it down to only match traffic which comes out of the LAN
>>it works like a charm:
>>
>>$IPTABLES -t nat -A POSTROUTING -s 192.168.3.0/24 -o $INET_IFACE -j SNAT
>>--to-source $INET_IP
> 
> 
> So the new rule will not SNAT anything which already has a source address 
> other than 192.168.3.0/24 (such as, for example, $INET_IP).   It seems to me 
> that this is probably necessary because of the way your IPsec packets are now 
> going twice through the same interface (in the old 2.4 FreeS/WAN 
> implementation, they would go once through eth0, and once through ipsec0, but 
> I believe this is no longer the case?)

Yes, they are going twice through $INET_IFACE, but the alteration occurs 
when leaving through $LAN_IFACE, which should not be matched as 
SNAT-target by the original rule. And in fact occurs no full SNAT but a 
change of the source port.

>>Is this a bug?
> 
> 
> No, I'd say it's a literal interpretation of what the rule says :)

Maybe at least we both agree that the above behavior is not *intended* 
by the applied rule? :)

Greetings,
Carsten.



  reply	other threads:[~2004-03-14  0:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-09 12:27 Iptables / KAME IPSec problem: source port information lost Carsten Maass
2004-03-09 19:36 ` Alexander Samad
2004-03-10 14:16   ` Carsten Maass
2004-03-13 22:16 ` [solved] " Carsten Maass
2004-03-13 22:35   ` Antony Stone
2004-03-14  0:55     ` Carsten Maass [this message]
2004-03-14  9:13       ` Antony Stone

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=4053AD8A.8070607@blinkenlichten.de \
    --to=cm@blinkenlichten.de \
    --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