Linux Netfilter discussions
 help / color / mirror / Atom feed
* RE: [OT] Was: ESP does not hit the nat table
@ 2004-08-03 12:42 Jason Opperisano
  2004-08-04  8:49 ` Antony Stone
  0 siblings, 1 reply; 7+ messages in thread
From: Jason Opperisano @ 2004-08-03 12:42 UTC (permalink / raw)
  To: netfilter

> Hi all,
> Thanks for the reply, I know I messed up the iptables syntax - I did not include the chain...
>
> My main problem however was that ESP packets do not hit the nat table, but it does traverse mangle/filter table. Is this normal? I am mainly looking at SNAT/MASQUERADING ipsec traffic and I am not able to find any documentation on doing this, especially since there is no point in putting a "iptables -t nat -A PREROUTING -p 50 -j SNAT --to-source <me>". -p 50 means ESP as you can already guess.
> Am I missing something here? How do I masquerade ipsec traffic? (assuming my ipsec-VPN client/server is fine with it...)

it would be helpful if you

a) posted your rules (iptables -vxnL && iptables -vxnL -t nat && iptables -vxnL -t mangle)
b) explained what you're trying to do specifically
c) describe how you're testing

as far as the generic "can i nat ESP traffic with iptables" the answer is "surely."  i do it on one of my gateways where it's necessary for the LAN behind the gateway to appear differently when it goes through the VPN tunnel.

if i had to take a stab in the dark as to why you're having trouble--i would say that it's related to the fact that the outbound interface of your IPSec traffic needs to be specified as "-o ipsec0" (or whatever number your actual ipsec interface is), not ethX...

you *did* say you were using frees/wan, right?

-j


^ permalink raw reply	[flat|nested] 7+ messages in thread
* RE: [OT] Was: ESP does not hit the nat table
@ 2004-08-05 14:26 Kashyap Ashwin
  0 siblings, 0 replies; 7+ messages in thread
From: Kashyap Ashwin @ 2004-08-05 14:26 UTC (permalink / raw)
  To: Ming-Ching Tiew, netfilter

I am sorry, this was my mistake, man page:

nat    This table is consulted when a packet that creates a new connec-
       tion is encountered.  It consists of three built-ins: PREROUTING
       (for  altering  packets  as  soon  as they come in), OUTPUT (for
       altering  locally-generated   packets   before   routing),   and
       POSTROUTING  (for altering packets as they are about to go out).


This is what happened:
	1. I put a ACCEPT rule in PREROUTING for ESP traffic when client
connects. There is also MASQUERADE rule in the POSTROUTING chain.
	2. The client can now do ipsec vpn
	3. The client logs out and I remove the ACCEPT rule. There is
catch-all DROP rule in the PREROUTING chain. I was expecting the ESP
"connection" to be terminated.
	4. Since the ESP "connection" is already in established state,
later packets never hit the catch-all DROP rule in the PREROUTING chain.

	5. The client is happy, since he gets free access:)

I just put some rules in the filter table, FORWARD chain (each and every
packet hits this). Things seem to work OK.

Thanks for all the replies!
Ashwin


-----Original Message-----
From: netfilter-admin@lists.netfilter.org
[mailto:netfilter-admin@lists.netfilter.org] On Behalf Of Ming-Ching
Tiew
Sent: Thursday, August 05, 2004 12:36 AM
To: netfilter@lists.netfilter.org
Subject: Re: [OT] Was: ESP does not hit the nat table


Did you patch the kernel using NAT-T patch ? And 
did you turn on the nat_traversal ?

It happens to my system too where I have
nat-t patch, but nat_traversal is disabled (default) in 
freeswan configuration, then I put in a rule like this :-

     iptables -t nat -I PREROUTING -p esp

When I list the rule, I can't see any packet going thru' it.

Regards.









^ permalink raw reply	[flat|nested] 7+ messages in thread
* [OT] Was: ESP does not hit the nat table
@ 2004-08-02 14:49 Kashyap Ashwin
  0 siblings, 0 replies; 7+ messages in thread
From: Kashyap Ashwin @ 2004-08-02 14:49 UTC (permalink / raw)
  To: netfilter

[-- Attachment #1: Type: text/plain, Size: 994 bytes --]

Hi all,

Thanks for the reply, I know I messed up the iptables syntax - I did not
include the chain... 

 

My main problem however was that ESP packets do not hit the nat table,
but it does traverse mangle/filter table. Is this normal? I am mainly
looking at SNAT/MASQUERADING ipsec traffic and I am not able to find any
documentation on doing this, especially since there is no point in
putting a "iptables -t nat -A PREROUTING -p 50 -j SNAT --to-source
<me>". -p 50 means ESP as you can already guess. 

Am I missing something here? How do I masquerade ipsec traffic?
(assuming my ipsec-VPN client/server is fine with it...)

 

Thanks!

Ashwin

 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~            \|/ ____ \|/ 
Ashwin Kashyap                                   @~/ ,. \~@ 
Member Technical Staff                          /_( \__/ )_\ 
Thomson - Corporate Research                       \__U_/ 
                                                Don't Panic!

 


[-- Attachment #2: Type: text/html, Size: 4504 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread
* RE: ESP does not hit the nat table
@ 2004-08-01 19:03 Jason Opperisano
  2004-08-01 22:28 ` [OT] Was: " Antony Stone
  0 siblings, 1 reply; 7+ messages in thread
From: Jason Opperisano @ 2004-08-01 19:03 UTC (permalink / raw)
  To: netfilter

> iptables -t nat -j DROP
>
> Will not block ESP traffic.

It's not a valid command, either.  In addition to specifying the table (-t nat) to act upon, you also need to specify a command and a chain to operate on; i.e.,

	iptables -t nat -A PREROUTING -j DROP

Not that I'm recommending the above rule, but it'll sure drop some traffic...

> On the other hand
>
> iptables -t filter -p 50 -j DROP
>
> will block ESP traffic.

Nope...

	iptables -A FORWARD -p 50 -j DROP
Or
	iptables -A INPUT -p 50 -j DROP
Or
	iptables -A OUTPUT -p 50 -j DROP

("-t filter" is assumed if no "-t" is specified)

<OT>
 Where is the new-found obsession with dropping packets in the NAT table coming from?
</OT>

-j


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

end of thread, other threads:[~2004-08-05 14:26 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-03 12:42 [OT] Was: ESP does not hit the nat table Jason Opperisano
2004-08-04  8:49 ` Antony Stone
2004-08-05  4:36   ` Ming-Ching Tiew
  -- strict thread matches above, loose matches on Subject: below --
2004-08-05 14:26 Kashyap Ashwin
2004-08-02 14:49 Kashyap Ashwin
2004-08-01 19:03 Jason Opperisano
2004-08-01 22:28 ` [OT] Was: " Antony Stone
2004-08-02  8:03   ` Jozsef Kadlecsik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox