fbpx

How to block an IP address using FirewallD

Background

FirewallD (Firewall Daemon) is a nice alternative to iptables. It’s simpler and easier to understand and configure than iptables. It’s also the default firewall application with CentOS, RHEL, and Fedora. Please note that it is not the default firewall for Ubuntu.

How to Block an IP Address in CentOS Using FirewallD

To block an IP address using FirewallD, do the following:

sudo firewall-cmd --add-rich-rule='rule family=ipv4 source address=10.x.x.x reject' --permanent

Then reload the firewalld commands:

sudo firewall-cmd --reload

To check if the rule is there:

sudo firewall-cmd --list-all

For more in-depth information, follow the references.

References

https://www.tecmint.com/install-configure-firewalld-in-centos-ubuntu/
https://firewalld.org/
https://www.digitalocean.com/community/tutorials/how-to-set-up-a-firewall-using-firewalld-on-centos-7
http://www.linuxeveryday.com/2016/12/block-unblock-ip-address-firewalld

Share this article

Share on facebook
Share on twitter
Share on linkedin

Leave a Reply

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

Scroll to Top