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.
To manage your ‘firewalld’ using the ‘firewall-cmd’ command:
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.
List your current configuration, using the ‘list-all’: