Difference between revisions of "Limiting number of simultaneous connections"

From Notes_Wiki
(Created page with "=Limiting number of simultaneous connections using iptables= ==Using connlimit module== We can use connlimit module of iptables to limit number of simultaneous connections t...")
 
m
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
=Limiting number of simultaneous connections using iptables=
[[Main Page|Home]] > [[CentOS]] > [[CentOS 6.x]] > [[Iptables configuration]] > [[Limiting number of simultaneous connections]]


==Using connlimit module==
==Using connlimit module==
Line 14: Line 14:
</pre>
</pre>
This would allow only 16 connections from each /24 network.
This would allow only 16 connections from each /24 network.
[[Main Page|Home]] > [[CentOS]] > [[CentOS 6.x]] > [[Iptables configuration]] > [[Limiting number of simultaneous connections]]

Latest revision as of 13:24, 14 July 2022

Home > CentOS > CentOS 6.x > Iptables configuration > Limiting number of simultaneous connections

Using connlimit module

We can use connlimit module of iptables to limit number of simultaneous connections to server in following manner

iptables -I INPUT -p tcp --syn --dport 22 -m connlimit --connlimit-above 1 -j REJECT

This will allow only one ssh connection to server per client.

To limit number of simultaneous connections based on subnets we can use below syntax

iptables -p tcp --syn --dport 22 -m connlimit --connlimit-above 16 --connlimit-mask 24 -j REJECT

This would allow only 16 connections from each /24 network.



Home > CentOS > CentOS 6.x > Iptables configuration > Limiting number of simultaneous connections