How To Block an IP Address

Login to your Linux server via SSH


To block a specific IP address you would use the following command. Then to save your changes to the iptables you’ll need to save the new rules in your config file, otherwise the rules will be lost if your server restarts. Replace xx.xx.xx.xx with the IP address you want to block.

iptables -A INPUT -s xx.xx.xx.xx -j DROP
service iptables save
  • 21 Users Found This Useful
Was this answer helpful?

Related Articles

How to Reset Mysql passowrd

  Step # 1 : Stop mysql service # /etc/init.d/mysql stop Output: Stopping MySQL database...

How to Change SSH Port in Centos

Login into your Server Via Putty or any SSH client.type in following...

Reset forgotten root password on CentOS

1. Boot the system and when you see the following message "Press any key to enter the...

Linux Firewall Fail2Ban

How To Protect SSH with fail2ban on CentOS 6  Step One—Install Fail2Ban Because...

Adding and viewing IP addresses on CentOS servers

To add newly assigned IP addresses from SSH, follow this procedure: (Please follow the steps...