DDoS Deflate+iptables Defense Lightweight DDoS attacks

Source: Internet
Author: User

I. Viewing an attacker's IP

awk ' {print $} ' Cut Sort Uniq Sort -N



Two. Installing the DDoS deflate

#wget http:// // download DDoS deflate#chmod0700  Install. SH // Add permissions #./install. SH // Execution



Three. Configuring DDoS deflate
The following is the default configuration of the DDoS deflate in/usr/local/ddos/ddos.conf, which reads as follows:

##### Paths of the script and other filesprogdir= "/usr/local/ddos" prog= "/usr/local/ddos/ddos.sh" ignore_ip_list= "/usr/ Local/ddos/ignore.ip.list "//IP address white list cron="/etc/cron.d/ddos.cron "//Timed Execution Program apf="/ETC/APF/APF "ipt="/sbin/iptables "# # # # Frequency in minutes for running the script##### caution:every time this setting was changed, run the script with--c ron##### option so the the new frequency takes effectfreq=1//check interval, default 1 minutes ##### How many connections define a Bad IP? Indicate that below.no_of_connections=150//maximum number of connections, more than this number of IP will be blocked, the general default can be ##### apf_ban=1 (make sure your APF version are at least 0.96) ##### apf_ban=0 (Uses iptables for banning IPs instead of APF) Apf_ban=1//using APF or iptables. It is recommended to use Iptables to change the value of Apf_ban to 0. ##### kill=0 (Bad IPs is ' NT banned, good for interactive execution of script) ##### kill=1 (Recommended setting) kill=1/ /whether to block IP, default can ##### an e-mail is sent to the following address when a IP is banned.##### Blank would suppress sending of Mai Lsemail_to= "Root "//when IP is blocked to send mail to a designated mailbox, it is recommended to use it for your own mailbox to ##### number of seconds the banned IP should remain in blacklist. ban_period=600//Disable IP time, default 600 seconds, can be adjusted according to the situation



Users can modify the configuration file according to the comment prompt content that is added to the default profile.

View line 117th of the/usr/local/ddos/ddos.sh file

Netstat-ntu | awk ' {print $} ' | Cut-d:-f1 | Sort | uniq-c | Sort-nr > $BAD _ip_list



Modify it to the following code

awk ' {print $5cutsed -n '/[0-9sortuniqsort -nr > $BAD _ip_list

DDoS Deflate+iptables Defense Lightweight DDoS attacks

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.