path: root/extensions/
diff options
authorJan Engelhardt <>2007-07-09 16:50:17 +0000
committerPatrick McHardy <>2007-07-09 16:50:17 +0000
commit21df4af43dcc9f635baa2aff3ace53768d9704bc (patch)
tree27980b185cd1984cefb5b6ed1de7cb403f9fc108 /extensions/
parent0c6bf10fbdbea24ec224a87118ff422279311887 (diff)
PATCH: Add connlimit to iptables.
Signed-off-by: Jan Engelhardt <>
Diffstat (limited to 'extensions/')
1 files changed, 27 insertions, 0 deletions
diff --git a/extensions/ b/extensions/
new file mode 100644
index 00000000..ca5974ea
--- /dev/null
+++ b/extensions/
@@ -0,0 +1,27 @@
+Allows you to restrict the number of parallel connections to a server per
+client IP address (or client address block).
+[\fB!\fR] \fB--connlimit-above \fIn\fR
+Match if the number of existing connections is (not) above \fIn\fR.
+\fB--connlimit-mask\fR \fIprefix_length\fR
+Group hosts using the prefix length. For IPv4, this must be a number between
+(including) 0 and 32. For IPv6, between 0 and 128.
+# allow 2 telnet connections per client host
+iptables -A INPUT -p tcp --syn --dport 23 -m connlimit --connlimit-above 2 -j REJECT
+# you can also match the other way around:
+iptables -A INPUT -p tcp --syn --dport 23 -m connlimit ! --connlimit-above 2 -j ACCEPT
+# limit the number of parallel HTTP requests to 16 per class C sized \
+network (24 bit netmask)
+iptables -p tcp --syn --dport 80 -m connlimit --connlimit-above 16
+--connlimit-mask 24 -j REJECT
+# limit the number of parallel HTTP requests to 16 for the link local network \
+ip6tables -p tcp --syn --dport 80 -s fe80::/64 -m connlimit --connlimit-above
+16 --connlimit-mask 64 -j REJECT