You got unwanted network traffic I feel bad for you son, I got 99 problems but a DDOS ain’t one.
So, your noticing your site is getting flooded by a ton of malicious traffic, and the traffic all originates from one or a set of IPs (let us say for example the bad range was 154.112.x.x. If you are using AWS VPC, you can simply create a deny http policy under the security group for the instance, ‘deny http 184.108.40.206/16’ and you would be set.
However, lets say you were in EC2 Classic, or lets even say you are not using AWS at all, well, now you have to rely on ip tables.
In order to block an IP address or IP range on your box, you need to SSH in then enter:
‘sudo iptables -A INPUT -s 220.127.116.11/16 -j DROP’
This will then deny all attempts to reach your website from the IP range between 18.104.22.168-22.214.171.124.
You can choose to remove this from your ip tables via this command:
‘sudo iptables -D INPUT -s 126.96.36.199/16 -j DROP’
Finally, if you want to view the rules of your iptables, simply enter ‘sudo iptables –list’
AWESOME GIF ACTION: