Skip to content

Linux: Firewalld

Marcos Aurélio Silvério edited this page Jan 20, 2021 · 8 revisions

Check if the firewall is running:

firewall-cmd --state

list zones:

firewall-cmd --list-all-zones

show open ports:

firewall-cmd --list-ports

Allow traffic to a port/protocol:

firewall-cmd --add-port=<port>/<protocol>

allow traffic to a service:

firewall-cmd --zone=public --add-service=<service_name>

Reload the configuration:

firewall-cmd –reload

Allow traffic to a specific IP address (or network)

Create a zone:

firewall-cmd --new-zone=http_access --permanent

firewall-cmd --reload

Add a source to the zone:

firewall-cmd --zone=http_access --add-source=192.168.3.1/32 --permanent

Allow a port/protocol to a zone:

firewall-cmd --zone=http_access --add-port=443/tcp --permanent

firewall-cmd --reload

Clone this wiki locally