From: Charlie Reitsma <reitsmac@denison.edu>
To: netfilter@lists.netfilter.org
Subject: Limiting number of connections
Date: Tue, 07 Jan 2003 11:26:13 -0500 [thread overview]
Message-ID: <3E1AFFA5.8040207@denison.edu> (raw)
the iplimit patch applies easiest to protocol tcp...it leaves out udp.
On my firewall the clients who are creating 200+ connections are using
udp. I've seen examples of iplimit for udp but attempts to use
iptables -A INPUT -p udp -m iplimit --iplimit-above 80 -j DROP
results in "invalid argument." Being able to look at the connection
table and limiting each source address to some number of entries is more
like what one would expect of a module that limits the number of
connections any client may create. I agree with Daniel that a script
that adds/remove drop rules would work. Perhaps the script could make
use of the "recent" module as discussed at
http://www.stearns.org/doc/adaptive-firewalls.v0.1.html
Charlie
--------------
Alex wrote:
I presume this is exactly what you are asking?
From... patch-o-matic/base/iplimit.patch.help
Author: Gerd Knorr <kraxel@bytesex.org>
Status: ItWorksForMe[tm]
This adds CONFIG_IP_NF_MATCH_IPLIMIT match allows you to restrict the
number of parallel TCP connections to a server per client IP address
(or address block).
Examples:
# allow 2 telnet connections per client host
iptables -p tcp --syn --dport 23 -m iplimit --iplimit-above 2 -j REJECT
# you can also match the other way around:
iptables -p tcp --syn --dport 23 -m iplimit ! --iplimit-above 2 -j
ACCEPT
# limit the nr of parallel http requests to 16 per class C sized
# network (24 bit netmask)
iptables -p tcp --syn --dport 80 -m iplimit --iplimit-above 16 \
--iplimit-mask 24 -j REJECT
Good luck - Alex.
On Fri, 2003-01-03 at 16:47, Daniel Fenert wrote:
> Is there a simple way to limit number of connection coming from
particular
> client (ip address or subnet)?
> I've searched through archive, and found only some patch to CVS version
> of netfilter (it was year 2000)...
>
> I've got problem with a few clients, they' are able to make 200+
> connections on 128Kbit connection (according to /proc/net/ip_conntrack)
>
> I thought about it today for a few minutes, and came with the idea:
> 1) Parse /proc/net/ip_conntrack and get clients with more than xxx
> connections
> 2) Setup rule to DROP NEW,RELATED to force them to close some connections
> 3) wait a minute, go to 1) checking additionally number of connections
> for blocked IP's. If number drops below xxx, delete rule DROP NEW,...
> This is ugly, but possibly will work.
>
> I hope that there's better way to do it?
next reply other threads:[~2003-01-07 16:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-01-07 16:26 Charlie Reitsma [this message]
-- strict thread matches above, loose matches on Subject: below --
2003-01-04 0:47 Limiting number of connections Daniel Fenert
2003-01-04 1:06 ` Alex McCubbin
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=3E1AFFA5.8040207@denison.edu \
--to=reitsmac@denison.edu \
--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.