In this short tutorial you will learn how to block an IP using iptables on your server.
Saturday’s morning. Just woke up, you have just booted up your computer and drink morning’s coffee. Before you start working on tasks requiring more brain’s processing power, you have decided to check webserver’s logs for anomalies.
You scroll through the logs and you see yet another IP bombarding your server with guess URLs to files of popular scripts. Should you ban him on your website? No! You should block him access for the entire server. The guy has no pure intentions and should have no access to your server at all.
In your console, under root account, you enter (where 220.127.116.11 is bad guy’s IP):
Voila! The bad guy cannot connect to your server anymore. At least from this IP…
Ah, and one more thing for the end of this article. Don’t do a mistake and ban your own IP! It’s worth to remember your own workstation’s public IP to avoid situations like this.