Firewall - How to open a port in Linux

Firewall - How to open a port in Linux

Colleagues hello to all.

In today's article, we will talk about how to open a port in Linux on the Firewall. If anyone does not know, then Firewall is software built into the Linux operating system to control access to applications by filtering traffic on network interfaces. By default Firewall is always on and I don't recommend turning it off, especially in a productive environment.

Today we will open port 1521, this port is used to connect to the oracle database.

 

Related articles:

  1. How to disable Firewall in Linux.

 

Article content:

  1. Check if port 1521 is open.
  2. Open the port.
  3. Checking the result.

 

STEP 1. Check if port 1521 is open.

The first step we need to make sure that port 1521 is actually closed on Firewall, for this let's see all the rules that are written in Firewall.

$. firewall-cmd --list-all

firewall open port

As you can see, our list does not contain any information on port 1521, which means that it is closed.


 

STEP 2. Open the port.

In order to open port 1521, we need to use the command:

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

firewall open port

If the result is success, then everything is fine.

 

The main thing is not to forget after adding the rule, restart the Firewall service itself, to do this, run the command:

$. sudo firewall-cmd --reload

firewall open port

If the result is success, then everything is fine.


 

STEP 3. Checking the result.

After adding the rule to the Firewall, we now need to make sure everything was successfully applied, for this we will use the command to view all rules in Firewall back.

$. firewall-cmd --list-all

firewall open port

As you can see, as a result, in the ports field, we have data on the open port 1521/tcp


 

Thank you all, I hope that my article helped you in some way.

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