i have Ubuntu 15.4 server i open a port with number 20000 i got massive ddos attack on this port i typed in terminal
netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n
to catch the attacker ip and block it i found bazillion ip's with opened connection 55
i need to create automatic script using iptables to protect that port
so if ip have connection more than 5 iptable block it automatically using
iptables -A INPUT -s attacker ip address -j DROP
but i dont know how to do that script it will take forever to block the ips one by one :)
eth0
. – Doug Smythies Aug 29 '16 at 05:03iptables -A INPUT -i eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT
then added the rest rules i see attack reduced – Vlark.Lopin Aug 29 '16 at 20:51