Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Antony Stone <Antony@Soft-Solutions.co.uk>
To: netfilter@lists.netfilter.org
Subject: Re: DNATing packets sent to the NATing box
Date: Sun, 14 Dec 2003 08:42:08 +0000	[thread overview]
Message-ID: <200312140842.08855.Antony@Soft-Solutions.co.uk> (raw)
In-Reply-To: <20031214005212.GA8217@tinuviel.compendium.com.ar>

On Sunday 14 December 2003 12:52 am, horape@tinuviel.compendium.com.ar wrote:

> 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?

PREROUTING works exactly as the name suggests - it is applied to packets 
before the routing decision is made about whether they are local, or being 
routed through the box.   Therefore you *can* use the PREROUTING chain to 
divert packets which would otherwise be accepted locally, so that they go to 
another machine, or else divert packets which would have gone somewhere else, 
so that they are accepted locally.

You say the rule never sees the packets...  how do you know this?   Are you 
looking at the packet / byte counters, and they stay at zero all the time?

You also say you have a local process listening on port 5000 - is that getting 
any packets and responding to them, even with above rule in place?

Antony.

-- 
The first fifty percent of an engineering project takes ninety percent of the 
time, and the remaining fifty percent takes another ninety percent of the 
time.

                                                     Please reply to the list;
                                                           please don't CC me.



  parent reply	other threads:[~2003-12-14  8:42 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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=200312140842.08855.Antony@Soft-Solutions.co.uk \
    --to=antony@soft-solutions.co.uk \
    --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