I. Viewing an attacker's IPawk ' {print $} ' Cut Sort Uniq Sort -NTwo. Installing the DDoS deflate#wget http:// // download DDoS deflate#chmod0700 Install. SH // Add permissions #./install. SH // ExecutionThree. Configuring DDoS deflateThe following is the default configuration of the DDoS deflate in/usr/local/
iptables1.3.7 and system kernel versions Kernel-smp-modules-connlimit
3. Configure the corresponding iptables rules
Examples are as follows:
(1) Control the maximum number of concurrent connections for a single IPIptables-i input-p TCP--dport 80-m connlimit--connlimit-above 25-j REJECT #允许单个IP的最大连接数为25个
#早期iptables模块不包含connlimit, you need to compile the load
In IDCs, hardware firewalls are usually used to prevent DDOS and CC attacks. IPtables can provide good protection for a small amount of attacks. 1. firewall enabling/disabling in Linux Command 1) permanently effective. it will not be enabled after restart: chkconfigiptableson disabled: chkconfigiptablesoff2) effective immediately, in IDCs, hardware firewalls are usually used to prevent
the entry of the target group and returns a connection refused error message to the user attempting to connect to the service. DROP will discard the group and will not send any warning to the telnet user.
The rule added by the command takes effect temporarily. After the iptables service is restarted, it will be restored. You can save the Command service iptables save permanently or directly modify the con
Detailed description of Linux iptables firewall + anti-DDOS policy configuration
650) this. width = 650; "alt =" "border =" 0 "src =" http://www.bkjia.com/uploads/allimg/131227/0T2502549-0.jpg "/>
The network firewall function has been implemented in the Linux kernel for a long time. In different Linux kernel versions, different software is used to implement the firewall function.In the 2.0 kernel, the fire
The main 2 basic practical applications, mainly related to the ban Ping (IPv4) and the prohibition of UDP, that is, the use of the server to prevent hackers to outsource DDoS attack content.
First, if there is no iptables prohibit ping
echo 1 >/proc/sys/net/ipv4/icmp_echo_igore_all #开启echo 0 >/proc/sys/net/ipv4/icmp_echo_igore_all #关闭Second, the use of iptables
Relationship between iptables rules and between iptables rules
The relationship between iptables rules is ignored from top to bottom.Therefore, when adding rules, you must add them thro
An example of iptables anti-DDoS method
Mitigating DDoS attacks#防止SYN攻击, lightweight prevention
Iptables-n Syn-floodIptables-a input-p tcp–syn-j Syn-floodIptables-i syn-flood-p tcp-m limit–limit 3/s–limit-burst 6-j returnIptables-a syn-flood-j REJECT
#防止DOS太多连接进来, you can allow the external network card to each IP u
Anti-DDoS script
# Lightweight prevention against SYN AttacksIptables-N syn-floodIptables-A input-p tcp-syn-J syn-floodIptables-I syn-flood-P TCP-m limit-limit 3/s-limit-burst 6-J returnIptables-a syn-flood-J reject
# Prevent too many Dos connections. You can allow up to 15 Initial connections from each IP address of the Internet Nic, exceeding the limit of discardingIptables-A input-I eth0-P TCP-syn-M connlimit-abve 15-J DropIptables-A input-p tcp-M
Mitigating DDoS attacks#防止SYN攻击, lightweight preventionIptables-n Syn-floodIptables-a input-p tcp–syn-j Syn-floodIptables-i syn-flood-p tcp-m limit–limit 3/s–limit-burst 6-j returnIptables-a syn-flood-j REJECT
#防止DOS太多连接进来, you can allow the external network card to each IP up to 15 initial connections, over the discardedIptables-a input-i eth0-p tcp–syn-m connlimit–connlimit-above 15-j DROPIptables-a input-p tcp-m state–state established,related-j
Defense against DDOS attacks # lightweight prevention of SYN Attacks iptables-N syn-flood iptables-a input-p tcp -- syn-j syn-flood iptables-I syn-flood-p tcp- m limit -- limit 3/s -- limit-burst 6-j RETURN iptables-A syn-flood-j REJECT # prevent too many DOS connections, ea
Recently a period of time php-ddos flooding, a period of time before the VPS was hackers hanging horse, a few months of traffic ran hundreds of G, a bit of doubt is being used to php-ddos, so today reinstall the VPS system and reconfigure the environment.Under the use of Iptables, from the root causes of the ban on Php-ddos
The main 2 basic practical applications, mainly related to the ban Ping (IPv4) and the prohibition of UDP, that is, the use of the server to prevent hackers to outsource DDoS attack content.
First, if there is no iptables prohibit ping
echo 1 >/proc/sys/net/ipv4/icmp_echo_igore_all #开启echo 0 >/proc/sys/net/ipv4/icmp_echo_igore_all #关闭
Second, the iptables to p
This article introduces how Iptables limits the number of connections of the same IP address in linux to prevent CC/DDOS attacks. This is only the most basic method. If the attack is real, we still need hardware compaction to prevent it.
1. Set the maximum number of connections to port 80 to 10, which can be customized.
The Code is as follows:
Copy code
The iptables firewall can be used to create filters and NAT rules. All Linux distributions can use iptables. Therefore, understanding how to configure iptables will help you manage Linux firewalls more effectively. If you contact iptables for the first time, you will think i
1. Limit the maximum number of IP connections to a 80-port connection to 10, which can be customized to modify.
The code is as follows
Copy Code
Iptables-i input-p TCP--dport 80-m connlimit--connlimit-above DROP
2. Use the recent module to limit the number of new requests connected to the same IP time, recent more features please refer to: Iptables Module recent applic
1. Limit the number of IP connections to 80 ports to a maximum of 10, which can be customized.
The code is as follows
Copy Code
Iptables-i input-p TCP--dport 80-m connlimit--connlimit-above 10-j DROP
2. Use the recent module to limit the number of new requests in the same IP time, recent more features please refer to: Iptables Module recent application.
CC attack a bit siege feeling, the correct setting of protection rules can be done in a very unstable, here gives a iptables IP connection frequency and concurrency restrictions, limit the single IP connection and frequency of the set rules introduced
#单个IP在60秒内只允许新建20个连接, this assumes that the Web port is 80,
Copy Code code as follows:
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.