Prepared by: Anwer Sadath Abdhul Muttaliff
firewalld is a dynamic firewall management tool for Linux systems. It provides a flexible and user-friendly interface to manage network traffic using zones, services, and rules. This project demonstrates how to configure and manage firewalld to secure your system effectively.
firewalld organizes packet filtering into three main structures:
Tables determine how packets are processed:
Chains are sets of rules applied to packets:
Targets define the action for matched packets:
Install firewalld using yum
:
sudo yum install firewalld
Start and enable firewalld:
sudo systemctl start firewalld
sudo systemctl enable firewalld
List current rules:
sudo firewall-cmd --list-all
List all predefined services:
sudo firewall-cmd --get-services
Reload firewalld to apply changes:
sudo firewall-cmd --reload
Make changes permanent:
sudo firewall-cmd --permanent [command]
List all available zones:
sudo firewall-cmd --get-zones
List active zones:
sudo firewall-cmd --get-active-zones
View rules for a specific zone (e.g., public):
sudo firewall-cmd --zone=public --list-all
Add a service (e.g., HTTP):
sudo firewall-cmd --add-service=http --permanent
sudo firewall-cmd --reload
Remove a service:
sudo firewall-cmd --remove-service=http --permanent
sudo firewall-cmd --reload
Block traffic from a specific IP:
sudo firewall-cmd --add-rich-rule='rule family="ipv4" source address="192.168.1.88" reject' --permanent
sudo firewall-cmd --reload
Block incoming ICMP traffic:
sudo firewall-cmd --add-icmp-block-inversion --permanent
sudo firewall-cmd --reload
Remove the block:
sudo firewall-cmd --remove-icmp-block-inversion --permanent
sudo firewall-cmd --reload
Block traffic to a specific IP (e.g., Facebook):
sudo firewall-cmd --direct --add-rule ipv4 filter OUTPUT 0 -d 157.240.214.35 -j REJECT
sudo firewall-cmd --reload
firewalld is a powerful tool for managing network security on Linux systems. By following these steps, you can configure firewalld to meet your specific security requirements.
Back to Top Back to Home