Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Patrick Schaaf <bof@bof.de>
To: Christian Seberino <seberino@spawar.navy.mil>
Cc: netfilter@lists.samba.org
Subject: Re: how is this stuff getting thru default deny iptables firewall?....
Date: Thu, 27 Jun 2002 09:37:30 +0200	[thread overview]
Message-ID: <20020627093730.C1873@oknodo.bof.de> (raw)
In-Reply-To: <20020627002144.B13910@spawar.navy.mil>; from seberino@spawar.navy.mil on Thu, Jun 27, 2002 at 12:21:44AM -0700

> > 	   The "nat" table is NOT consulted for "second or more"
> > 	   packet of an existing conntrack.
> 
> I thought /ALL/ packets first went thru -t nat PREROUTING
> and then -t filter and then -t nat POSTROUTING.

No, that's not the case. I'll try again explaining that path slowly.

At PREROUTING, if there is already a conntrack record in existence,
that record determines how the addresses and ports of the packet are
to be rewritten. That rewrite is then done.

On the other hand, if there is not yet a conntrack record in existence
for the packet, the nat PREROUTING table is consulted, and rules there
modify the fresh conntrack record to remember how exactly to do future
rewriting for BOTH directions of the connection. This is the point in
time where, for NAT action to multiple IPs and/or ports, the exact
address information for that single connection is determined.
You CAN use the DROP target in the NAT chain, that way ABORTING
creation / setup of the conntrack. But that's not usually done.

Next, a routing decision is made, depending (usually) on the destination
IP of the possibly rewritten packet. This decision determines whether the
packet (each packet!) will then pass through the filter table's FORWARD,
or INPUT chain. It will pass INPUT when the destination is localhost
(in all its disguises), or it will pass FORWARD when it is to be routed
out of the box.

Again, EVERY packet passes the filter table.

Nat table tells how to rewrite. Filter table filters. It's all clean
and simple (given the complexities of what NAT has to accomplish...)

OK now?

best regards
  Patrick


  reply	other threads:[~2002-06-27  7:37 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-22 17:30 how is this stuff getting thru default deny iptables firewall? Christian Seberino
2002-06-22 17:38 ` Antony Stone
2002-06-23  7:13   ` Christian Seberino
2002-06-23  7:53     ` Patrick Schaaf
2002-06-27  7:21       ` Christian Seberino
2002-06-27  7:37         ` Patrick Schaaf [this message]
2002-07-09 19:08           ` Christian Seberino
2002-06-23  8:07     ` Antony Stone
2002-06-27  7:14       ` Christian Seberino
2002-06-27  7:28         ` Patrick Schaaf
  -- strict thread matches above, loose matches on Subject: below --
2002-06-22 21:43 James T. Moore
2002-06-23  7:13 ` Christian Seberino
2002-07-09 19:43 j davis
2002-07-09 21:41 ` Christian Seberino
2002-07-09 21:43 ` Christian Seberino
     [not found]   ` <Pine.LNX.4.33.0207101903030.1723-100000@dodobirdy.nestac.com>
2002-07-10 16:34     ` Christian Seberino

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=20020627093730.C1873@oknodo.bof.de \
    --to=bof@bof.de \
    --cc=netfilter@lists.samba.org \
    --cc=seberino@spawar.navy.mil \
    /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