Friday 6 December 2019

How to Add a Service in Firewall Configuration on CentOS 7 (firewall-cmd)



Firewall is a network security tool that provide network level security based on a set of rules. It has controls on incoming and outgoing traffic.

This article describes How to Add a Service in Firewall Configuration on CentOS7 (firewall-cmd).

Follow the article How toInstall Firewalld on CentOS 7 if already not installed.

Step 1. Check the Service Status: Run the following command to check firewall running status:

[root@linuxcnf ~]# firewall-cmd --stat
running
[root@linuxcnf ~]#

Step 2. Adding Service: Run the following command to allow services in firewall:

[root@linuxcnf ~]# firewall-cmd --permanent --zone=public --add-service=http
success
[root@linuxcnf ~]#

Change the service/daemon name as desire.

Step 3. Reloading the Service: Run the following command for soft reloading firewall service to reflect the changes:

[root@linuxcnf ~]# firewall-cmd --reload
success
[root@linuxcnf ~]#

Step 4. Validate the Configuration: Run the following command to verify the configuration:

[root@linuxcnf ~]# firewall-cmd --list-service | grep http
dhcpv6-client http ssh
[root@linuxcnf ~]#

Done!!! http Service is successfully allowed in Linux Firewall.

No comments:

Post a Comment