All of lore.kernel.org
 help / color / mirror / Atom feed
* questions about chain traversal, new ascii diagram
@ 2005-01-06 17:23 Curby .
  2005-01-06 17:49 ` Lopsch
  0 siblings, 1 reply; 6+ messages in thread
From: Curby . @ 2005-01-06 17:23 UTC (permalink / raw)
  To: netfilter

Hi, I'm in the process of building a three-interface firewall and I have 
some questions about how the different chains see NAT packets and 
locally-generated packets.

Firstly, if I just do filtering in the INPUT/OUTPUT chains, NAT-ed packets 
will not traverse those chains, so I figure I should probably put similar 
filtering rules in the FORWARD chain? (For example, I'd like to be able to 
block all my internal users from accessing certain sites, or block incoming 
traffic sent by bad hosts from being port-forwarded to internal servers).

If I was trying to block incoming traffic from bad hosts, why not simply put 
the filters in the PREROUTING chain instead of both INPUT and FORWARD?  Is 
it because the nat table is intended for just nat and doing filtering there 
would be ugly, or would it actually fail to work?

I read in http://davidcoulson.net/writing/lxf/14/iptables.pdf (on the 
netfilter.org documentation page) that nat's OUTPUT chain performs DNAT on 
outgoing packets originating from the server, and POSTROUTING performs SNAT 
on outgoing packets passing through the firewall from other hosts.  If I 
have two Internet-facing IPs and would like to SNAT locally-generated 
traffic to one or the other, it would appear that iptables wouldn't let me 
do that very easily, right?  What is the purpose of nat's OUTPUT chain (in 
other words, when would I want to DNAT locally-generated traffic)?

In what order does locally-generated traffic traverse the OUTPUT chains of 
filter and nat tables?

Lastly, aside from those issues, is the diagram below a reasonable 
representation?  The only diagrams I found on chain traversal dealt with the 
nat and filter tables separately, but I'm hoping that it's possible to show 
them together.  (I hope hotmail doesn't completely destroy this ascii hehe).

# -->n.PREROUT-->routing decision-->f.FORWARD-->n.POSTROUT--,-->
#                       |                     ,-------------^
#                       v                     |
#                     f.INPUT              f.OUTPUT, n.OUTPUT
#                       |                     ^
#                       `--->local process----'

Thanks!

--curby




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

end of thread, other threads:[~2005-01-07 22:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-06 17:23 questions about chain traversal, new ascii diagram Curby .
2005-01-06 17:49 ` Lopsch
2005-01-06 19:20   ` Curby .
2005-01-07  2:12     ` John A. Sullivan III
2005-01-07 22:08     ` Andy Furniss
2005-01-06 20:50   ` Ipfilter for DHCP client sisdis

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.