All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jörg Harmuth" <harmuth@mnemon.de>
To: netfilter@lists.netfilter.org
Subject: Re: Fwd: Re: IP Tables slows network response times
Date: Mon, 15 Aug 2005 17:35:50 +0200	[thread overview]
Message-ID: <4300B656.40704@mnemon.de> (raw)
In-Reply-To: <200508152332.15400.michael@networkstuff.co.nz>

Oohps, forgot to send to the list :(

Michael Hallager schrieb:
[SNIP]

> *filter
> :INPUT DROP [0:0]
> :FORWARD ACCEPT [0:0]
> :OUTPUT ACCEPT [24885:3543903]
> -A INPUT -i lo -j ACCEPT
> -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
> -A INPUT -d 202.150.101.225 -p tcp -m tcp --dport 22 -j ACCEPT
> -A INPUT -d 202.150.101.225 -p tcp -m layer7 --l7proto smtp -m tcp --dport 25 
> -j ACCEPT
> -A INPUT -d 202.150.101.225 -p tcp -m layer7 --l7proto dns -m tcp --dport 53 
> -j ACCEPT
> -A INPUT -d 202.150.101.225 -p udp -m layer7 --l7proto dns -m udp --dport 53 
> -j ACCEPT
> -A INPUT -d 202.150.101.235 -p tcp -m layer7 --l7proto dns -m tcp --dport 53 
> -j ACCEPT
> -A INPUT -d 202.150.101.235 -p udp -m layer7 --l7proto dns -m udp --dport 53 
> -j ACCEPT
> -A INPUT -d 202.150.101.225 -p tcp -m layer7 --l7proto http -m tcp --dport 80 
> -j ACCEPT
> -A INPUT -d 202.150.101.225 -p tcp -m tcp --dport 110 -j ACCEPT
> -A INPUT -d 202.150.101.226 -p tcp -m tcp --dport 443 -j ACCEPT
> -A INPUT -d 202.150.101.227 -p tcp -m tcp --dport 443 -j ACCEPT
> -A INPUT -s 129.223.123.249 -d 202.150.101.225 -p tcp -m tcp --dport 9050 -j 
> ACCEPT
> -A OUTPUT -o lo -j ACCEPT
> COMMIT
> # Completed on Mon Aug 15 23:29:05 2005
> root@202-150-101-225:/home/michael#     

Ok, I see. I think your problem is related to L7, 'cause you cannot have
a policy of DROP with L7. The following is likely to happen:

1.) You get e.g. an SMTP request == SYN bit set.
2.) As none of your rules match the packet hits the policy,
    which is DROP.
3.) L7 is never able to recognize the SMTP protocol.

So I don't think that the network speed is slowed down, I think there is
no SMTP, DNS and HTTP connection at all. You have no problem with POP3
and HTTPS, right ?

I would recommend the following:

1.) Move your L7 rules to mangle/PREROUTING *and* mangle/POSTROUTING.
    This is because you don't forward the packets. As Eric said,
    some protocols are recognized in OUTPUT and some in INPUT.
2.) Omit the port with L7. L7 is designed for detecting protocols,
    even on non standard ports (well, that's one point :)) You
    may omit -p too.
3.) Don't rely on L7 in terms of security (you read the HOWTO ?) !!
4.) Filter in filter table. If you really want to filter with L7,
    I think it's best, to mark the packets in PREROUTING and
    and then filter based on the marks in filter table. Only my 2C.

If you don't have the need of recognizing protocols (means: using L7 for
convenience), do standard filtering like port matches and so on using
connection tracking (so, compile nat into the kernel).

HTH and have a nice time,

Joerg




  parent reply	other threads:[~2005-08-15 15:35 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-15 11:32 Fwd: Re: IP Tables slows network response times Michael Hallager
2005-08-15 11:59 ` Eric Leblond
2005-08-15 13:13 ` /dev/rob0
2005-08-15 15:35 ` Jörg Harmuth [this message]
  -- strict thread matches above, loose matches on Subject: below --
2005-08-15 11:07 Michael Hallager
2005-08-14 17:39 Gary W. Smith
2005-08-15  8:18 ` Fwd: " Michael Hallager
2005-08-15  9:32   ` Jörg Harmuth
2005-08-15  9:45     ` Michael Hallager
2005-08-15  9:59       ` /dev/rob0
2005-08-15 10:10         ` Michael Hallager
2005-08-15  9:46     ` /dev/rob0
2005-08-15 10:05     ` Michael Hallager
2005-08-15 10:53       ` Jörg Harmuth
2005-08-15 11:04         ` Michael Hallager
2005-08-15 11:21       ` /dev/rob0

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=4300B656.40704@mnemon.de \
    --to=harmuth@mnemon.de \
    --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.