Centos – How to block an ip range in Firewalld

centosfirewalld

I know I can use the below command to block a single ip:

firewall-cmd --permanent --add-rich-rule="rule family='ipv4' source address='115.239.228.12' reject"

but I need to block all ips starting from 115.239.x.x

I am having Cent os 7.

Thanks

Best Answer

I am not a user of firewalld myself, but for most firewall implementations, particularly linux-based ones, whenever you see the option for a source or destination address you can simply provide a CIDR style network specification. So 115.239.0.0/16.

Related Topic