port adding

Sometimes we need to block some unnecessary port to block or disable as of security. It’s a good practice to keep only required port open and block all other port which are not in used. First of all I will show you how to open/add port in firewall.

Step 1: Add Port in firewall

As you can see there is only one port is added in my machine which is for postgresql

Let’s suppose, we have to add port 80 in firewall using firewalld command in redhat 7 version and you can use iptables in redhat version 6.

firewall-cmd –permanent –zone=public –add-port=80/tcp

We have added port 80 of httpd in firewall it will work until you do not reload the firewall

firewall-cmd –reload

Step 2 : Check port has been added in firewall

firewall-cmd –list-ports

Step 3 : Now restart the service of firewall.

Systemctl restart firewalld

You’re done.



Please enter your comment!
Please enter your name here