5

Is there a way to have fail2ban ban the entire class C network from which a ban address comes from?

A

A.Adverse
  • 305
  • 1
  • 3
  • 11

1 Answers1

3

As fail2ban adds rules to iptables, You may prefer to use iptables directly

iptables -A INPUT -s 197.198.199.0/24 -j DROP

fail2ban can block an ip range, see how with the client:

# fail2ban-client -v set [JailName] banip 197.198.199.0/24
# example:

fail2ban-client -v set recidive banip 197.198.199.0/24

Since jails are time limited, iptables could be a better idea, depending of what you want/need.

But, to answer your question :
Someone have done a configuration customization to ban the whole network of an ip sent in jail
See: https://www.righter.ch/index.php/2014/12/10/block-a-whole-ip-range-with-fail2ban/

cmak.fr
  • 8,976