Open port using Firewalld

How to open port using firewalld command

To open specific port say 101 use following command

firewall-cmd --permanent --add-port=101/tcp

Then execute following command to reload firewalld service.

firewall-cmd reload

To remove opened port –remove-port as given below

firewall-cmd --permanent --remove-port==101/tcp
firewall-cmd --reload

Command to list ports opened in firewalld.

firewall-cmd --list-ports

How to open port range say 300-400 in firewalld

firewall-cmd --permanent --add-port=300-400/tcp
firewall-cmd --reload

Following command will list services whose ports are open

firewall-cmd --list-services

To open port of specific service command would be

firewall-cmd --permanent --add-service=http

To remove port of specific service command would be

firewall-cmd --permanent --remove-service=http

Leave a Reply

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