KB Knowledge Base
How To Block IP Addresses Using IPtables

Article By samantha


Best Linux Firewall iptables for your VPS at BIPmedia.com The following article describes various ways to block IPs using the built-in RedHat firewall, iptables. The following command will drop all incoming connections from IP xx.xx.xx.xx:

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

To block a range, such as xx.xx.xx.* specify the CIDR block as follows:

iptables -I INPUT -s xx.xx.xx.0/24 -j DROP

If you wanted to later remove this entry you would replace the -I with -D as follows:

iptables -D INPUT -s xx.xx.xx.xx -j DROP
iptables -D INPUT -s xx.xx.xx.0/24 -j DROP

Tags: , , , ,

Spin up a VPS server in no time flat

Simple setup. Full root access. Straightforward pricing.


Leave a Reply