The firewall on CentOS 8 Linux system is enabled by default allowing for only few services to receive incoming traffic. Firewalld is a powerful and yet simple to use tool to manage a firewall on CentOS 8 Server . Firewalld allows to manage open or close ports using predefined services as well as open and close user custom ports.
In this article, we will guide you through how to open and close ports on CentOS 8.
Prerequisite
an active KVM VPS
root user
I. How to open port on CentOS 8
1. First of all, check for already opened ports or enabled systemd service. It might be that the port you are trying to open is already available in which case there is nothing to do:
firewall-cmd --list-all
2. Check whether the service you are trying to configure your firewall with is available as a preconfigured feature. The below command will list all ready to use services:
firewall-cmd --get-services
3. To get a list of the available zones, type:
firewall-cmd --get-zones
We can see the specific configuration associated with a zone by including the --zone= parameter in our --list-all command:
4. Open port or service.
If the service you wish to configure your firewall with is available as a preconfigured feature as retrieved in step 2 use its name to open the port.