Limit the Number of Connections in Linux 5/5 (1)

Posted on

Limit the Number of Connections in Linux – So this as the answer of the question the member pc-mind in our email. In this case, if the website is accessed up to 1500 visitors usually RAM usage will go up and the loading of the site being slow. So the desired solution so that the connection to the server is restricted to visitors, say should only be 1000 while simultaneously.

Limit the Number of Connections in Linux

 

The most straightforward solution we use iptables and just execute the following command:

iptables -A INPUT -p tcp –syn -m connlimit –connlimit-above 1000 –connlimit-mask 0 -j DROP
iptables -A OUTPUT -p tcp –syn -m connlimit –connlimit-above 1000 –connlimit-mask 0 -j DROP

A bit of explanation, it simply gives a quota kind of connection on TCP and either input (incoming traffic) and output (outgoing traffic) are similarly limited 1000 only. The rest will be automatically discarded (REJECTS). If it is felt less or even more you can change its own numbers.

Share a little more. What is described above with the numbers it could not be said to be accurate. I mean, 1 visitors (browsers) in fact, it can open multiple connections in parallel to the server to speed up loading. Generally between 4-8 connections. so the settings will limit of around 250 visitor.

And the same solution, it might be more accurate when done well and limit of the web server used. then, I suggest you use the best setting

Please rate this

Leave a Reply

Your email address will not be published. Required fields are marked *