Optimize LINUX kernel block SYN flood attack __linux

Source: Internet
Author: User
Tags iptables

SYN flood attack (SYN flooding Attack) refers to the use of TCP/IP three-time handshake protocol is imperfect and malicious send a large number of only SYN handshake sequence packets of attack mode. This type of attack could lead to a denial of service and even crashes in the case of an attacking computer that is unable to be freed by a large amount of system resources during a certain period of time to maintain a potential connection. If you suffer from a SYN flood attack under a Linux server, you can do the following:

#缩短SYN-timeout Time:
Iptables-a forward-p tcp–syn-m limit–limit 1/s-j
Iptables-a input-i eth0-m limit–limit 1/sec–limit-burst 5-j

#每秒 up to 3 SYN packets entered are expressed as:
Iptables-n Syn-flood
Iptables-a input-p tcp–syn-j Syn-flood
Iptables-a syn-flood-p tcp–syn-m limit–limit 1/s–limit-burst 3-j return
Iptables-a syn-flood-j REJECT

#设置syncookies:
Sysctl-w Net.ipv4.tcp_syncookies=1
Sysctl-w net.ipv4.tcp_max_syn_backlog=3072
Sysctl-w net.ipv4.tcp_synack_retries=0
Sysctl-w net.ipv4.tcp_syn_retries=0
Sysctl-w net.ipv4.conf.all.send_redirects=0
Sysctl-w net.ipv4.conf.all.accept_redirects=0
Sysctl-w net.ipv4.conf.all.forwarding=0
Sysctl-w Net.ipv4.icmp_echo_ignore_broadcasts=1

#防止PING:
Sysctl-w net.ipv4.icmp_echo_ignore_all=1

#拦截具体IP范围:
Iptables-a input-s 10.0.0.0/8-I. eth0-j Drop
Turn from: http://www.hit008.com/read.php?30

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.