4

We have a server that consistently gets pounded by people trying to break in. We have DenyHosts and Fail2Ban running on the server but it still gets a ton of traffic from people who are up to no good. My boss is finally tired of it, he went to http://ipinfodb.com/ip_country_block.php and created a list of ip ranges that he wants to block from the server. The thing is it is a list just over 13,000 ips.

What is the best way to block these ips? I could write a script to loop through the list and add them to iptables but this seems like a bad idea. I can paste the list into DenyHosts but I am not sure what the performance hit on this would be. Would there be a better alternative than either of these?

Is there anyone out there that can give me some advice on this?

1 Answers1

2

Use ipset to create set of IP ranges (with a script probably) and then use --match-set in iptables rule. This way matching will be pretty efficient because ipsets are hashed.

Eugene
  • 511