All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Andrew E. Mileski" <andrewm@isoar.ca>
To: netfilter@lists.netfilter.org
Subject: Re: NAT and DNS/NTP servers
Date: Sat, 01 May 2004 16:48:41 -0400	[thread overview]
Message-ID: <40940D29.3080302@isoar.ca> (raw)
In-Reply-To: <200405012121.27461.Antony@Soft-Solutions.co.uk>

Antony Stone wrote:
> 
> I do not think that netfilter will ever get "confused" about whether a reply 
> packet is in response to a locally-generated request, or a NATted connection 
> from a LAN client machine.   The gateway which you are running netfilter on 
> will always keep an accurate record of (a) locally-bound ports, and (b) 
> connection tracking table entries for packets originating elsewhere.
> 
> What makes you think that netfilter is getting anything wrong?   Are you 
> seeing packets in LOG entries which do not seem to correspond to current 
> connections?   If you are simply seeing connections not succeeding from time 
> to time, do keep in mind that this is UDP we're talking about, which although 
> is strictly known as User Datagram Protocol, can be fairly accurately 
> interpreted as Unreliable Datagram Protocol (unlike TCP, which is a reliable 
> service).

This is from a different machine (sorry), but my point is the same...

1) Make sure there are no existing entries
    # grep '123' /proc/net/ip_conntrack
    #

2) Start up a NTP server on the gateway with a poll period long enough
    to allow an entry in /proc/net/ip_conntrack to expire (I used
    minpoll 9 maxpoll 9)
    # grep '123' /proc/net/ip_conntrack
udp      17 166 src=66.11.173.24 dst=192.43.244.18 sport=123 dport=123 
src=192.43.244.18 dst=66.11.173.24 sport=123 dport=123 [ASSURED] use=1

3) Start up a NTP server on a private client with a short poll period
    (I used minpoll 4 maxpoll 4)
    # grep '123' /proc/net/ip_conntrack
udp      17 177 src=66.11.173.24 dst=192.43.244.18 sport=123 dport=123 
src=192.43.244.18 dst=66.11.173.24 sport=123 dport=123 [ASSURED] use=1
udp      17 162 src=192.168.2.244 dst=192.43.244.18 sport=123 dport=123 
src=192.43.244.18 dst=66.11.173.24 sport=123 dport=12 [ASSURED] use=1

The port was remapped to 12.  All is okay.

4) Stop the private host NTP server, keeping the gateway NTP server
    listening (long poll time remember), and make sure there are no
    existing entries (wait for any to expire)
    # grep '123' /proc/net/ip_conntrack
    #

5) Start a NTP server on a private client again with the short poll
    period
    # grep '123' /proc/net/ip_conntrack
udp      17 167 src=192.168.2.244 dst=192.43.244.18 sport=123 dport=123 
src=192.43.244.18 dst=66.11.173.24 sport=123 dport=123 [ASSURED] use=1

The port wasn't remapped... incoming packets will ALWAYS be routed
to this machine.  The NTP server process on the gateway will never
receive packets while this connecection exists.

It seems netfilter doesn't check for the existence of a local listener
on a port before deciding whether or not to remap it.  Only the
connection table seems to be referenced.

Bug or feature, I don't know.  I just wanted confirmation that this
exists.  I stated earlier that there are two ways around it.

-- 
Andrew E. Mileski


  reply	other threads:[~2004-05-01 20:48 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-01  2:52 NAT and DNS/NTP servers Andrew E. Mileski
2004-05-01  7:19 ` Antony Stone
2004-05-01 17:42   ` Andrew E. Mileski
2004-05-01 17:49     ` Andrew E. Mileski
2004-05-01 18:05     ` Antony Stone
2004-05-01 19:51       ` Andrew E. Mileski
2004-05-01 20:00         ` Andrew E. Mileski
2004-05-01 20:21         ` Antony Stone
2004-05-01 20:48           ` Andrew E. Mileski [this message]
2004-05-01 21:07             ` Antony Stone
2004-05-01 21:42               ` Andrew E. Mileski
2004-05-01 23:17                 ` Antony Stone
  -- strict thread matches above, loose matches on Subject: below --
2004-05-02 13:49 Steve Jones
2004-05-03  0:14 ` Andrew E. Mileski

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=40940D29.3080302@isoar.ca \
    --to=andrewm@isoar.ca \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.