Linux anti-SYN flood attack

Source: Internet
Author: User

Protect Against SYN


SYN attack is the principle of using TCP/IP Protocol 3-time handshake, sending a large number of network packets to establish the connection, but not actual

Establish a connection that eventually causes the network queue of the attacked server to be full and inaccessible to normal users.

The Linux kernel provides several SYN-related configurations, with commands:

sysctl-a | grep syn

See:

Net.ipv4.tcp_max_syn_backlog = 1024

net.ipv4.tcp_syncookies = 0

Net.ipv4.tcp_synack_retries = 5

Net.ipv4.tcp_syn_retries = 5


Tcp_max_syn_backlog is the length of the SYN queue, tcp_syncookies is a switch, whether to open the Syn Cookie

feature that prevents partial SYN attacks. Tcp_synack_retries and tcp_syn_retries define SYN

Number of retries.


Increasing the SYN queue length can accommodate more network connections waiting to be connected, and opening the SYN cookie feature can block some

SYN Attacks, reducing the number of retries also have a certain effect.


Here's how to adjust the settings above:

Increase the SYN queue length to 2048:

Sysctl-w net.ipv4.tcp_max_syn_backlog=2048

To open the SYN cookie feature:

Sysctl-w Net.ipv4.tcp_syncookies=1

To reduce the number of retries:

Sysctl-w net.ipv4.tcp_synack_retries=3

Sysctl-w net.ipv4.tcp_syn_retries=3


To maintain the above configuration for system restart, add the above command to the/etc/rc.d/rc.local file.



Linux anti-SYN flood attack

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.