How to block ip address in centOS 7

There is two option:

1.rich rule –

firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="192.168.X.X" reject’

2.First in the chain –

firewall-cmd --direct --add-rule ipv4 filter INPUT_direct 0 -s 192.168.X.X/32 -j DROP

Leave a Reply

Your email address will not be published. Required fields are marked *