03 Create New Firewalld Zone and Add Service | How to Add Service in Zone ?

Allow apache service in firewalld, how to  allowed service permanent in firewall
Allow apache service in firewalld, how to  allowed service permanent in firewall

Question : How to create a new zone in firewalld, running on CentOS 7 or RHEL 7 Or higher version of  Operating System

To Create New zone in Firewall

firewall-cmd --new-zone=linuxtopic --permanent

Here my zone name is linuxtopic, you can use any name of zone according to you.

After creating a zone it require a reload firewall to reflect zone. So we will reload firewalld
firewall-cmd --reload

We successfully created a  linuxtopic zone now  we will set this zone as default zone

To set default in firewall
firewall-cmd --set-default-zone=linuxtopic

Question : How to add Apache service in zone ?

Now we will allow Apache service in our active zone, before we do first we know about which service / port used by Apache

To Print information about a service
firewall-cmd --info-service=http
firewall-cmd --info-service=https


To Add or Allow http and https service in firewall zone
firewall-cmd --zone=linuxtopic --add-service=http
firewall-cmd --zone=linuxtopic --add-service=https
To Add or Allow http and https service in firewall zone
To Add or Allow http and https service in firewall zone

We can use   --permanent parameter for permanently with any each command,  this will update xml. locate in firewall directory
firewall-cmd --zone=linuxtopic --add-service=http --permanent
firewall-cmd --zone=linuxtopic --add-service=https --permanent
Note : it's required to reload the firewall


To verify added http and https service in firewall
firewall-cmd --list-all


Thanks

No comments

Powered by Blogger.