Linux Netfilter discussions
 help / color / mirror / Atom feed
* DNATing packets sent to the NATing box
@ 2003-12-14  0:52 horape
  2003-12-14  4:55 ` Joel Newkirk
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: horape @ 2003-12-14  0:52 UTC (permalink / raw)
  To: netfilter

I've a system that at its core has an UDP proxy that's the performance
bottleneck. I wanted to use the DNAT kernel facilities to replace my
code with the very tuned one on netfilter.

I'm adding a rule that says something like this:

/sbin/iptables -t nat -A PREROUTING -d myip -p udp -m udp --dport 5000 -j DNAT
		--to-destination otherip:18918

but the rule never see the packets (they never got to the chain)

I assume that it's because I've a socket listening on udp:5000, and it seems
reasonable what's happening... I'd like to add a PREPREROUTING chain that
is processed before deciding if the packet is for a local socket, can somebody
give me a hint on where to look for it?

Saludos,
					HoraPe
---
Horacio J. Peña
horape@compendium.com.ar
horape@uninet.edu


^ permalink raw reply	[flat|nested] 16+ messages in thread
* Re: DNATing packets sent to the NATing box
@ 2003-12-14 13:52 horape
  2003-12-14 14:28 ` Jeffrey Laramie
       [not found] ` <200312140919.04832.JALaramie@Loudoun-Fairfax.com>
  0 siblings, 2 replies; 16+ messages in thread
From: horape @ 2003-12-14 13:52 UTC (permalink / raw)
  To: netfilter

> > Yes, and I've added a rule like this:
> > /sbin/iptables -t nat -A PREROUTING -j LOG and don't see the packets.

> 	Ummmm
>     if you ADD the rule above after the rule that is re-routing the packet, 
> 	no ... you wont see the packets.  Try 
> 	iptables -t nat -I PREROUTING (line number)
> 	where (line number) is less than the line on which your DNAT line occurrs.
> 	(see iptables -t nat --line-numbers -v )

I'm really replacing the DNAT rule with the LOG one (only rule in the chain is the
LOG one)

Saludos,
					HoraPe
---
Horacio J. Peña
horape@compendium.com.ar
horape@uninet.edu


^ permalink raw reply	[flat|nested] 16+ messages in thread
* Re: DNATing packets sent to the NATing box
@ 2003-12-14 15:39 horape
  0 siblings, 0 replies; 16+ messages in thread
From: horape @ 2003-12-14 15:39 UTC (permalink / raw)
  To: netfilter

> > > > Yes, and I've added a rule like this:
> > > > /sbin/iptables -t nat -A PREROUTING -j LOG and don't see the packets.
> > > 	Ummmm
> > >     if you ADD the rule above after the rule that is re-routing the
> > > packet, no ... you wont see the packets.  Try
> > > 	iptables -t nat -I PREROUTING (line number)
> > > 	where (line number) is less than the line on which your DNAT line
> > > occurrs. (see iptables -t nat --line-numbers -v )
> > I'm really replacing the DNAT rule with the LOG one (only rule in the chain
> > is the LOG one)
> 	This sounds *very* strange.  Perhaps more detail would give those on the list 
> a chance to determine what your problem is. 

Thanks for your help.

> 	More detail of what the proxy is and more detail about your system setup 
> would likely help us determine what course of action you need to take.

I'm running 2.4.23, I have an udp socket listening on port 5000, and a rule
that says:

iptables -t nat -A PREROUTING -p udp -j LOG --log-prefix "PREROUTING: "

(that's not the rule that I want, but it seems clearer with that one)

And when the box receives packets for udp 5000, the socket gets it, but
the rule doesn't see it.

Saludos,
					HoraPe
---
Horacio J. Peña
horape@compendium.com.ar
horape@uninet.edu


^ permalink raw reply	[flat|nested] 16+ messages in thread
* Re: DNATing packets sent to the NATing box
@ 2003-12-14 18:02 horape
  0 siblings, 0 replies; 16+ messages in thread
From: horape @ 2003-12-14 18:02 UTC (permalink / raw)
  To: netfilter

> > > > It looks like the proxy is grabbing the packets first and then dropping
> > > > them directly onto the INPUT chain. Try disabling the proxy and release
> > > > the bound ports then try it again. Once the packets reach PREROUTING
> > > > you can DNAT them to another port.
> > > I could ubnderstand the proxy code managing to grab the packet off the
> > > wire before netfilter (PREROUTING) sees it, but I don't see how it would
> > > then get seen by the INPUT chain - as far as I know, it's not possible
> > > for a packet to reach netfilter's INPUT chain without first going through
> > > the PREROUTING chain.   If a packet bypasses one of these, it will bypass
> > > both.
> > Well that's what I thought but I can't explain his results any other way.
> > What are we missing here?

> 	My question exactly ... 
> 	a silly question is :
> 	what if anything is in /proc/net/ip_conntrack for these connections?

udp      17 179 src=200.68.94.100 dst=200.61.169.146 sport=5000 dport=18416 src=200.61.169.146 dst=
200.68.94.100 sport=18416 dport=5000 [ASSURED] use=2

(200.68.94.100 is my ip)

> 	Alistair Tonner

Saludos y gracias,
					HoraPe
---
Horacio J. Peña
horape@compendium.com.ar
horape@uninet.edu


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

end of thread, other threads:[~2003-12-21  4:49 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-12-14  0:52 DNATing packets sent to the NATing box horape
2003-12-14  4:55 ` Joel Newkirk
2003-12-14  8:42 ` Antony Stone
2003-12-14 12:32   ` horape
2003-12-21  4:49 ` horape
  -- strict thread matches above, loose matches on Subject: below --
2003-12-14 13:52 horape
2003-12-14 14:28 ` Jeffrey Laramie
     [not found] ` <200312140919.04832.JALaramie@Loudoun-Fairfax.com>
2003-12-14 15:26   ` horape
2003-12-14 15:51     ` Jeffrey Laramie
2003-12-14 16:04       ` horape
2003-12-14 16:55         ` Jeffrey Laramie
2003-12-14 17:16           ` Antony Stone
2003-12-14 17:35             ` Jeffrey Laramie
2003-12-14 17:51             ` horape
2003-12-14 15:39 horape
2003-12-14 18:02 horape

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