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=httpfirewall-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 |
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 --permanentNote : it's required to reload the firewall
firewall-cmd --zone=linuxtopic --add-service=https --permanent
To verify added http and https service in firewall
firewall-cmd --list-all
Thanks