In this article we will see how to add a port in firewall configuration on centos 7.
We will be using the firewalld package for firewall configuration.
Firewall is a network security tool that provides network level security based on a set of rules. It has controls on incoming and outgoing traffic.
Follow the article How To Install Firewalld on CentOS 7 if the package is not already installed.
Overview of Steps:
- Install the firewalld package
- Check the service status
- Adding the required ports
- Reloading the Service
- Validate the Configuration
Detailed Steps:
Step 1. Install the firewalld package[root@localhost ~]# yum install firewalld
Step 2. Check the Service Status: Run the following command to check firewall running status:
[root@localhost ~]# firewall-cmd --stat
running
[root@localhost ~]#
Step 3. Adding Port: Run the following command to allow port in firewall:
[root@localhost ~]# firewall-cmd --permanent --zone=public --add-port=80/tcp
success
[root@localhost ~]#
Change the port and protocol (tcp/udp) as desired.
Step 4. Reloading the Service: Run the following command for soft reloading firewall service to reflect the changes:
Step 4. Reloading the Service: Run the following command for soft reloading firewall service to reflect the changes:
[root@localhost ~]# firewall-cmd --reload
success
[root@localhost ~]#
Step 5. Validate the Configuration: Run the following command to verify the configuration:
[root@localhost ~]# firewall-cmd --list-ports | grep 80
80/tcp
[root@localhost ~]#
Done!!! Port 80 is successfully allowed from Linux Firewall.
Note: Same process will be repeated whenever you want to add new ports to the firewall.
Note: Same process will be repeated whenever you want to add new ports to the firewall.
Written by follow him on the social web or sign up for the email newsletter for your daily dose of how-to guides and video tutorials.
, personal technology columnist and founder of Logical Bee. You canlinux
0 Comments:
Post a Comment