I have this range of IPS  197.192.x.x that is brute force attacking my pop/imap/smtp servers day after day.I have this ipset in place that is blocking every IP that tries to hack on my server.I would like to block access for pop/smtp/imap for all IPs starting with 197.192To do this, I have typed this command:ipset -A myIpset 197.192.0.0/24but this added 65536 IPs to my ipset, making it huge and now I cannot add more IPs to it.Is there another way to do this in a more elegant way?
iptables... blocking a range without flooding ipset set with IPs
ipset
You can add another ipset to block, this time of type hash:net, and add 197.192.0.0/16 to that ipset. Or replace your ipset with one of type hash:net since hash:net can store IP addresses as well (netmask 32).To convert from hash:ip to hash:net: ipset save myIpset > myIpset &&   ipset destroy myIpset &&   sed s/:ip/:net/ myIpset | ipset restore &&   ipset add myIpset 197.192.0.0/16