netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* iptables vs. IPsec SP
@ 2009-02-18 16:17 Jianqing Zhang
  2009-02-18 16:29 ` Jan Engelhardt
  0 siblings, 1 reply; 4+ messages in thread
From: Jianqing Zhang @ 2009-02-18 16:17 UTC (permalink / raw)
  To: netfilter-devel

If I configure both IPsec SPs and iptables, when an IP packet is going
out or coming,  which will process the packet first? SP or iptables
(netfilters) rules?

Thanks

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

* Re: iptables vs. IPsec SP
  2009-02-18 16:17 iptables vs. IPsec SP Jianqing Zhang
@ 2009-02-18 16:29 ` Jan Engelhardt
  2009-02-18 18:15   ` Jianqing Zhang
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Engelhardt @ 2009-02-18 16:29 UTC (permalink / raw)
  To: Jianqing Zhang; +Cc: netfilter-devel


On Wednesday 2009-02-18 17:17, Jianqing Zhang wrote:

>If I configure both IPsec SPs and iptables, when an IP packet is going
>out or coming,  which will process the packet first? SP or iptables
>(netfilters) rules?

On the input path, obviously ESP is the first one seen, then the unpacked one;
on the output path this is precisely reversed.

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

* Re: iptables vs. IPsec SP
  2009-02-18 16:29 ` Jan Engelhardt
@ 2009-02-18 18:15   ` Jianqing Zhang
  2009-02-18 18:17     ` Jianqing Zhang
  0 siblings, 1 reply; 4+ messages in thread
From: Jianqing Zhang @ 2009-02-18 18:15 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: netfilter-devel

Yes, that is also what I thought.

However it does not work in my test.
I add a SNAT rule on the host of 192.168.1.20 as following:

 iptables -t nat -A POSTROUTING -p udp --dport 5002 -o eth0 -j SNAT
--to-source 192.168.1.55

to change the source address of outgoing upd packets with port 5002 to
192.168.1.55.

I also insert one SPs as follows (output of "ip xfrm policy list"):

...
src 192.168.1.55/32 dst 192.168.1.21/32
	dir out priority 2080 ptype main
	tmpl src 192.168.1.20 dst 192.168.1.21
		proto esp reqid 16409 mode tunnel
...

Then I send udp multicast at the port 5002.

But, I cannot see any ESP packets by tcpdump. Furthermore, on the
recipient side, I can get the muliticast udp with the changed source
IP (192.168.1.55). Actually I have stopped IPsec on the recipient
side. It looks that IPsec on the sender side is bypassed. Do I miss
something?

Thanks


On 2/18/09, Jan Engelhardt <jengelh@medozas.de> wrote:
>
> On Wednesday 2009-02-18 17:17, Jianqing Zhang wrote:
>
>>If I configure both IPsec SPs and iptables, when an IP packet is going
>>out or coming,  which will process the packet first? SP or iptables
>>(netfilters) rules?
>
> On the input path, obviously ESP is the first one seen, then the unpacked
> one;
> on the output path this is precisely reversed.
>

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

* Re: iptables vs. IPsec SP
  2009-02-18 18:15   ` Jianqing Zhang
@ 2009-02-18 18:17     ` Jianqing Zhang
  0 siblings, 0 replies; 4+ messages in thread
From: Jianqing Zhang @ 2009-02-18 18:17 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: netfilter-devel

Oops, I get it. SP does not catch multicast address in this case.
Sorry about that.


On 2/18/09, Jianqing Zhang <arrow.jianqing@gmail.com> wrote:
> Yes, that is also what I thought.
>
> However it does not work in my test.
> I add a SNAT rule on the host of 192.168.1.20 as following:
>
>  iptables -t nat -A POSTROUTING -p udp --dport 5002 -o eth0 -j SNAT
> --to-source 192.168.1.55
>
> to change the source address of outgoing upd packets with port 5002 to
> 192.168.1.55.
>
> I also insert one SPs as follows (output of "ip xfrm policy list"):
>
> ...
> src 192.168.1.55/32 dst 192.168.1.21/32
> 	dir out priority 2080 ptype main
> 	tmpl src 192.168.1.20 dst 192.168.1.21
> 		proto esp reqid 16409 mode tunnel
> ...
>
> Then I send udp multicast at the port 5002.
>
> But, I cannot see any ESP packets by tcpdump. Furthermore, on the
> recipient side, I can get the muliticast udp with the changed source
> IP (192.168.1.55). Actually I have stopped IPsec on the recipient
> side. It looks that IPsec on the sender side is bypassed. Do I miss
> something?
>
> Thanks
>
>
> On 2/18/09, Jan Engelhardt <jengelh@medozas.de> wrote:
>>
>> On Wednesday 2009-02-18 17:17, Jianqing Zhang wrote:
>>
>>>If I configure both IPsec SPs and iptables, when an IP packet is going
>>>out or coming,  which will process the packet first? SP or iptables
>>>(netfilters) rules?
>>
>> On the input path, obviously ESP is the first one seen, then the unpacked
>> one;
>> on the output path this is precisely reversed.
>>
>

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

end of thread, other threads:[~2009-02-18 18:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-18 16:17 iptables vs. IPsec SP Jianqing Zhang
2009-02-18 16:29 ` Jan Engelhardt
2009-02-18 18:15   ` Jianqing Zhang
2009-02-18 18:17     ` Jianqing Zhang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).