Iptables Method for limiting concurrent TCP connections of a single IP Address

Source: Internet
Author: User
Article Title: iptables method that limits concurrent TCP connections of a single IP address. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
The method of limiting concurrent TCP connections of a single IP address is suitable for protecting various TCP services on Linux. It is implemented using iplimit patch in patch-o-matic in iptables, which is more common for various TCP services.

Practice:

Configure the Linux core, use 2.4.20, and use patch-o-matic in www.netfilter.org
Iplimit in the base patch. Compile the configuration to install the new core.
Use iptables 1.2.8 of www.netfilter.org to install it in the system.

Example:

1. the maximum number of connections allowed to telnet a single IP address to the local machine is 2. Connections exceeding the limit are denied:
Iptables-I INPUT-p tcp -- dport 23-m iplimit -- iplimit-above 2-j REJECT

2. Restrict the web services connected to the local machine. The number of concurrent connections of one IP segment C cannot exceed 100, and the number of connections exceeding the limit is denied:
Iptables-I INPUT-p tcp -- dport 80-m iplimit -- iplimit-above 100 -- iplimit-mask 24-j REJECT
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.