Block specific IP addresses

Some times there is a need to block specific IP addresses, for example: you saw that you mysql server sometimes is crashing, than you checked /var/log/apache2/access.log and you saw that your website is receiving DDoS attack.

To ban IP address type something like this in command line tool (IP address “185.112.102.164” must be changed):

iptables -A INPUT -s 185.112.102.164 -j DROP

To check which IP addresses were banned:

iptables -L INPUT -v -n