Linux Security: How to block an IP so it can’t connect to your server

You can use IP Tables or a reject route.

Reject route ex:

/sbin/route add -host 200.x.x.x reject

list routes:     route -n

remove block: route del 192.168.0.123 reject

 

or, you can use iptables to ban a range of IPs from your server, like so:

iptables -I INPUT -s 178.33.0.0/178.33.0.0 -j DROP