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 192.168.0.1/24 -j DROP

This would block 192.168.0.1-255

Unblock the IP

Simply change “DROP” in the commands above to “ACCEPT”.

Radhe

Radhe Dhakad is Support Executive and Network Admin at RackBank Datacenters Pvt. Ltd.. He is our curious techie who loves experimenting on servers and likes to pen down whatever he explores new on server technology!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

© Copyright 2013-2021 RackBank© Datacenters Pvt. Ltd.


Data Center in India

Rated 4.7/5 based on 31 reviews at Google+