On CentOS 8, the default firewall is firewalld, which is used to manage iptables rules on the server. To enable and start the firewalld service on the server, run the following commands.

# systemctl enable firewalld
# systemctl start firewalld
# systemctl status firewalld

To open an incoming connection to a specific service such as SSH, you need to verify that the service is present in the firewalld rules and, then, add the rule for the service by adding --permanent switch to commands as below

# firewall-cmd --add-service=[tab]  #List services
# firewall-cmd --add-service=ssh
# firewall-cmd --add-service=ssh --permanent

If you wish to open incoming connections to other network services such as HTTP or SMTP, just add the rules as shown by specifying the service name.

# firewall-cmd --permanent --add-service=http
# firewall-cmd --permanent --add-service=https
# firewall-cmd --permanent --add-service=smtp

To view all firewall rules on the server, run the following command.

# firewall-cmd --permanent --list-all