Use a CIDR calculator or ban /24.
To ban a range you just type the normal ban command:
sudo fail2ban-client set jailnamehere banip 1.2.3.0/24