Block IP trough Firewall

You are here:
Table of contents

I had recent attacks on my server and so I was searching on how to add an IP drop with my firewall.

On my Sites I have a security system that blocks already many things but unfortunately not all.

And so here I show you an example on how to do it (at least how I did it).

#add the ip 91.92.252.176 to the connection reject list
firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="91.92.252.176" reject'

#reload the firewall with the new settings
firewall-cmd --reload

#see the state of the firewall engine
firewall-cmd --state

#see the current settings
firewall-cmd --list-all

Example – You want to add an IP that is already exisiting

Reload firewall – if all is ok you’ll get a success

Checking the state will show you if it’s running or it’s stopped

With list-all you gonna see the current settings – so also what is allowed (here logicaly obfuscated)

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.