In order to block an IP on your Linux server you need to use iptables firewall. First you need to log into shell as root user. To block IP address you need to type iptables command as follows:
iptables -A INPUT -s IP-ADDRESS -j DROP
Replace IP-ADDRESS with actual IP address. For example if you wish to block ip address 18.104.22.168 for whatever reason then type command as follows:
# iptables -A INPUT -s 22.214.171.124 -j DROP
If you have IP tables firewall script, add above rule to your script.
If you just want to block access to one port from an ip 126.96.36.199 to port 25 then type command:
# iptables -A INPUT -s 188.8.131.52 -p tcp –destination-port 25 -j DROP
The above rule will drop all packets comming from IP 184.108.40.206 to port mail server port 25.
powered by performancing firefox