How To Block an IP Address

How To Block an IP Address

Login to your Linux server via SSH.

Blocking an IP Address

To block a specific IP address, use the following command. Replace xx.xx.xx.xx with the IP address you want to block:

iptables -A INPUT -s xx.xx.xx.xx -j DROP

Saving the iptables Rules

Once you have blocked the IP address, you need to save the new rules to ensure they persist after a server restart. Use the following command to save the iptables configuration:

service iptables save
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Adding New IP Addresses to a CentOS/Fedora Server via SSH

Adding New IP Addresses to a CentOS/Fedora Server via SSH Follow the procedure below to add...

Disable Ping Response

Disable Ping Response What is a ping: A ping is a simple network utility used to check if a...

How to Change SSH Port in CentOS

How to Change SSH Port in CentOS Login to your server via PuTTY or any other SSH client....

How to Reset MySQL Password

How to Reset MySQL Password If you have forgotten your MySQL root password, follow these steps...

How to Add a Port to iptables in Linux

How to Add a Port to iptables in Linux Note: This document is for reference only. We do not take...