How can I block a specific IP address?

To block an individual IP address from accessing your Linux server, you can use the following iptables command:

iptables -A INPUT -s IPADDR -j DROP

Simply replace IPADDR with the IP address you are wanting to drop all packets from.

How do I block ranges?

Here is an example of a range block:

iptables -A INPUT -s 192.168.0.1/24 -j DROP

This would block 192.168.0.1-255

How do I unblock the IP?

Simply change "DROP" in the commands above to "ACCEPT".


  • 1 Users Found This Useful
Was this answer helpful?

Related Articles

How do I bind my additional IPs?

These instructions are for CentOS / Fedora specifically.By default, we only binds your first...

How do I run a traceroute?

Both Windows and Linux have the ability of diagnosing the health of a connection between a source...

How do I schedule FSCK to run automatically?

Using cron to schedule an FSCKBy default, a fsck is forced after 30 reboots or 180 days.To avoid...

Why is cPanel/WHM not loading?

There are two main reasons why cPanel/WHM isn't loading that we've seen.Brand New ServerIf you...

How to install cPanel on CentOS

Installation Notes A CentOS or Red Hat server that is going to have cPanel installed needs a...