In this tutorial we will learn how to block an IP or subnet address from your linux server or operating system.
In order to block an IP on Linux, we need to make use of the ‘iptables’ tool
Step 1. Log into the Linux shell as the root user.
Step 2 Type in the following command :
iptables -A input -s IP.ADD.RE.SS -j drop service iptables save
Replace IP.ADD.RE.SS with the address you wish to block.
If you wish to unblock an IP address from the server, simply replace ‘IP.ADD.RE.SS’ with the address you wish to Unblock :
iptables -D input -s IP.ADD.RE.SS -j drop service iptables save