Firewall open port 80 443 on Linux CentOS/RHEL 8/7

Firewall open port 80 443 on Linux CentOS/RHEL 8/7

Hello colleagues.

In today's article, I will tell you how to open port 80, 443 on Firewalld.

Firewalld is a firewall management software used on CentOS and RHEL systems.

By default, Firewalld is enabled, but it can be disabled temporarily or permanently, but you should not do this, as the server's security will drop significantly. Firewalld is designed to filter incoming and outgoing traffic on interfaces. Today we will open the most requested ports 80 and 443, they are intended for web servers.

The content of the article:

  1. Checking the status of Firewalld.
  2. Checking if port 80, 443 is open.
  3. Open port 80, 443.

 

STEP 1. Check the status of Firewalld.

To check the status, use the command:

$. sudo service firewalld status

or

$. sudo systemctl status firewalld

open port 80, 443 on Firewalld

open port 80, 443 on Firewalld


 

STEP 2. Checking if port 80, 443 is open.

The port on Firewalld may already be open. In order to check this, use the command:

$. sudo netstat -an | grep 80 | grep -i listen

$. sudo netstat -an | grep 443 | grep -i listen

 open port 80, 443 on Firewalld

open port 80, 443 on Firewalld

As you can see in the pictures, port 80 is already open, and 443 is closed, since the list is empty.


 

STEP 3. Open port 80, 443.

To open the port, use the command:

$. sudo firewall-cmd --zone=public --add-port=80/tcp --permanent

$. sudo firewall-cmd --zone=public --add-port=443/tcp --permanent

$. sudo firewall-cmd --reload

open port 80, 443 on Firewalld

As you can see from the snapshot, we tried to open port 80, but it is already in the Firewall rules, and we managed to open port 443 from 443. Be sure to restart the Firewall service itself after adding melted to the Firewall.


 

READY! We have successfully opened ports 80, 443.

Thank you all, I hope my article was of some help to you.

SIMILAR ARTICLES

Linux - How to change the connection port number for SSH
Linux - How to change the connection port number for SSH
SAFETY
Read more
Firewall - How to see open ports in Linux
Firewall - How to see open ports in Linux
SAFETY
Read more
Firewall - How to find and close a port in Linux
Firewall - How to find and close a port in Linux
SAFETY
Read more