Centos 7 – firewall-cmd usefull commands

A short post to save some of the useful options for firewall-cmd:

List all the port opened by firewall-cmd

firewall-cmd --zone=public --list-ports

List all information

firewall-cmd --list-all

List services (be careful some services are opened but not listed in list-ports)

firewall-cmd --list-services

Add a port or service

firewall-cmd --permanent --zone=public --add-port=2200/tcp

Remove a port or service

firewall-cmd --permanent --remove-port=8000/tcp
firewall-cmd --permanent --remove-service=http/tcp

Reload & commit change

firewall-cmd --reload

One thought on “Centos 7 – firewall-cmd usefull commands

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.