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 1.2.3.4 is bad guy’s IP):
# iptables -I INPUT -s 1.2.3.4 -j DROP