How to open ports on Centos 8 /RHEL 8 Linux
Linx has a tool called firewalld which is very easy to use but powerful enough to handle most of the tasks about firewalls. How to open on RHEL 8 / CentOS 8 Linux using filewalld.
What is Firewalld
firewalld is a firewall management tool for Linux operating systems. It provides firewall features by acting as a front-end for the Linux kernel’s netfilter framework via the nftables userspace utility (before v0.6.0 iptables backend),[2] acting as an alternative to the nft command line program. The name firewalld adheres to the Unix convention of naming system daemons by appending the letter “d”.
https://en.wikipedia.org/wiki/Firewalld
there is official website of firewalld you can visit the site by clicking this link go to firewalld official website
Requirements
Type | Requirements |
OS | RHEL 8/CentOs 8 |
Programme | firewall-cmd 0.6.3 or higher |
access | must need to have root access to your OS using sudo command or you must logged in as root |
How to open ports on RHEL 8 / CentOS 8 Linux steps
now we are going to open ports on RHEL 8 / CentOS with commands.
Step 1 List already opened Ports
Before opening some port we need to check which port is already opened. To check already opened port you copy and paste the following command on your terminal.
firewall-cmd --list-all
Step 2 check The Service
Now we are going to check the service we want to use is available as a preconfigured feature or not to check the service copy and paste the following command on your terminal
firewall-cmd --get-services
Step 3 Check the Zones
There are more than one type of zones on firewalld but in most cases, in real-time we are interested on public zone or block zone, to check available zone you can run following command on your terminal.
firewall-cmd --get-zones
Step 4 Open Port service
If your desired service is available on step 2 then open the port by following the command in this article I am going to use HTTP service and zone public
for the test purpose, you can use other services as per your desire.
Let’s open service first
For example I am opening zone with public and service HTTP.
firewall-cmd --zone=public --permanent --add-service=http
Let’s open desired post
generally, the port 80 is already opened as a part of preconfigured service so am opening 8080 for test purpose.
for example I am opening the port 8080
firewall-cmd --zone=public --permanent --add-port 8080/tcp
Step 5 Reload Firewall
After you opened the port need to reload the firewall to affect and smooth use of the port and its functionality to reload firewall copy and past the following command on your terminal.
firewall-cmd --reload
Step 6 Confirm opened port
Run the following command on your terminal, if you found the port you have just opened then you are ready to use the port for your desired task.
firewall-cmd --list-all
this is How you How to open ports on Centos 8 /RHEL 8 Linux we hope you have learned something here if you want to set up your web development environment on LAMP stack then please visit our LAMP stack setup on Linux article here
GOOD LUCK !!!!!