There may not be generic iptables rules to deal with all distributed "SYN Flood" attacks. I have always had to create some rules to deal with the specific attack, sometimes resulting collateral damage (i.e. blocking legitimate packets, I don't care). The following examples span an 11 year period.
Legend:
# The location of the iptables program
#
IPTABLES=/sbin/iptables
#Setting the EXTERNAL and INTERNAL interfaces and addresses for the network
#
EXTIF="enp1s0"
INTIF="br0"
EXTIP="173.XXX.YYY.ZZZ" (hidden)
EXTOTHERIP="173.XXX.YYY.ZZQ" (hidden)
INTNET="192.168.111.0/24"
INTIP="192.168.111.1/32"
UNIVERSE="0.0.0.0/0"
Example 1: A SYN Flood attack against port 80 where the source port was also port 80. No real web surfing client would have a source port of 80, so block it:
# Related to SYN flood attacks on port 80.
# Drop packets that have source port = destination port = 80, as they seem to come forever
# via (I think) the ESTABLISHED,RELATED path and are never caught by the bad guy detector.
#
$IPTABLES -A INPUT -i $EXTIF -s $UNIVERSE -d $EXTIP -p tcp --sport 80 --dport 80 -j DROP
Examples 2 and 3: SYN Flood attacks where the TCP window size is always the same:
# SYN Flood (trickle, actually) attack of 2011.02:
# Always had same TCP window size of 61690 (0xF0FA), which was unique to this attack.
# TOS (type of service) offset = 6 ; TCP service = 6 ; Window size offset = 32
#
#$IPTABLES -A INPUT -i $EXTIF -m u32 --u32 "6&0xFF=0x6 && 32&0xFFFF=0xF0FA" -j LOG --log-prefix "BADZ:" --log-level info
#$IPTABLES -A INPUT -i $EXTIF -m u32 --u32 "6&0xFF=0x6 && 32&0xFFFF=0xF0FA" -j DROP
#
# SYN Flood (trickle, actually) attack of 2016.05 - ??:
# Always had same TCP window size of 32120 (0x7D78), which was not unique to this attack, but very rare
# TOS (type of service) offset = 6 ; TCP service = 6 ; Window size offset = 32
#
$IPTABLES -A INPUT -i $EXTIF -m u32 --u32 "6&0xFF=0x6 && 32&0xFFFF=0x7D78" -j LOG --log-prefix "BADZ:" --log-level info
$IPTABLES -A INPUT -i $EXTIF -m u32 --u32 "6&0xFF=0x6 && 32&0xFFFF=0x7D78" -j DROP
Example 4: SYN Flood attack using illegal source port number:
# Ver 0.39: Current SYN flood attack uses illegal ports. Filter based on port 0 to get rid of them.
# Ver 0.40: Comment out. Event has ended.
#
#$IPTABLES -A INPUT -i $EXTIF -m recent --update --hitcount 2 --seconds 5400 --name BADGUY_SYN -j LOG --log-prefix "SYN BAD:" --log-level info
#$IPTABLES -A INPUT -i $EXTIF -m recent --update --hitcount 2 --seconds 5400 --name BADGUY_SYN -j DROP
#$IPTABLES -A INPUT -i $EXTIF -p tcp -m tcp --sport 0 --dport 80 -m recent --set --name BADGUY_SYN -j DROP
Example 5: SYN Flood attack that was no so "Distributed", mainly coming from one IP address sub-net. Just block the entire sub-net. I have a great many of these, in addition to using ipset
to block all of Russia, China, and some other countries:
$IPTABLES -A INPUT -i $EXTIF -s 184.105.0.0/16 -d $UNIVERSE -j DROP