Portal Home > Knowledgebase > Linux > Security > How can I block a IP address?

How can I block a 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 you want to drop all packets from.

Block ranges of IP's

Here is an example of a range block:

iptables -A INPUT -s -j DROP

This would block

Unblock the IP

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

Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
How to use iptables? (Views: 5032)