How do you prevent SYN Flood attacks in Linux
This article introduces you how to prevent SYN Flood attacks in Linux, the content is very detailed, interested friends can refer to, hope to be helpful to you.
SYN flooding attack (SYN Flood) is an attack method that uses imperfect TCP/IP three-way handshake to maliciously send a large number of packets containing only SYN handshake sequence. This attack method may cause the attacked computer to deny service or even crash, so that the potential connection takes up a lot of system resources and cannot be completed three times. If you are under a SYN flood attack on the Linux server, you can set the following:
Reduce SYN- timeout:
Iptables-A FORWARD-p tcp-syn-m limit- limit 1max s-j ACCEPTiptables-An INPUT-I eth0-m limit- limit 1/sec-limit-burst 5-j ACCEPT
Up to 3 syn packets per second
Iptables-N syn-floodiptables-An INPUT-p tcp-syn- j syn-floodiptables-A syn-flood-p tcp-syn- m limit- limit 1Compact s-limit-burst 3-j RETURNiptables-A syn-flood-j REJECT
Set up syncookies
Sysctl-w net.ipv4.tcp_syncookies=1sysctl-w net.ipv4.tcp_max_syn_backlog=3072sysctl-w net.ipv4.tcp_synack_retries=0sysctl-w net.ipv4.tcp_syn_retries=0sysctl-w net.ipv4.conf.all.send_redirects=0sysctl-w net.ipv4.conf.all.accept_redirects=0sysctl-w net.ipv4.conf.all.forwarding=0sysctl-w net.ipv4.icmp_echo_ignore_broadcasts=1
Prevent ping commands
Sysctl-w net.ipv4.icmp_echo_ignore_all=1
Block specific IP ranges
Iptables-An INPUT-s 192.168.5.1 Drop 8-I eth0-j Drop about how you prevent SYN Flood attacks in Linux, that's all. I hope the above can be helpful and learn more. If you think the article is good, you can share it for more people to see.