How to open ports with firewalld on CentOS

  1. Install with the yum install firewalld command
  2. Then enable with the systemctl enable firewalld command 
  3. Start the service with the systemctl start firewalld command 
  4. To check whether it is running or not, you can use the systemctl status firewalld or firewall-cmd --state command. 
  5. After that, check, the default zone used with the firewall-cmd --get-default-zone command and the active zones with the firewall-cmd --get-active-zones command. 
  6. Then to add a port to be opened, you can use the firewall-cmd command --zone=public --permanent --add-port=8288/tcp 
  7. After adding the service, it needs to be restarted with the firewall-cmd --reload command or systemctl restart firewalld. 
  8. To check the results of the configuration / rule that has just been added, you can use the command firewall-cmd --list-all 
  9. Furthermore, you can test from outside the server with the telnet command to the server port

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.