Allow ports in firewalld on CentOS8

CentOS comes with firewalld by default. It allows you to manage your firewall rules based on zones. This short tutorial will cover only the basic setup with the default ‘public’ zone and how to allow ports in it.

You can manage your ‘firewalld’ using the ‘firewall-cmd’ command. To allow a port, you simply do:

firewall-cmd --permanent --add-port=80/tcp --add-port=443/tcp
firewall-cmd --reload

Keep in mind that you need to reload the ‘firewalld’ configuration when you make changes. This command has added TCP ports 80 and 443, for HTTP and HTTPS.

To list your current configuration, you can use the ‘list-all’:

firewall-cmd --list-all

Comment (1)

  • Install Apache, PHP, MySQL on CentOS8 - CloudBalkan| September 30, 2019

    […] At this point you a fully running Apache2 web server and a MySQL server. Don’t forget to Allow the HTTP and HTTPS ports in the firewalld. […]