02 Working With Firewall Zone | How to Get Firewalld Services List

firewalld zones define the level of trust for network connection, firewalld get zones, list all zones, firewall-cmd,  Add Interface in firewalld zone
firewalld zones info, list all zones, firewall-cmd,  add interface and port in firewalld zone

What is Firewall Zone ?


zones define the level of trust for network connection. Its work as one to many relation

One zone can be used for multiple connections.


To Print predefined Firewall Zone

firewall-cmd --get-zones


To  List everything added for or enabled in all zones
firewall-cmd --list-all-zones

To get info of default zone
firewall-cmd --get-default-zone

To set default zone
firewall-cmd --set-default-zone=work

To get active Zone info
firewall-cmd --get-active-zone

We have two interface available in my Server and Work zone is using both enp0s3 and enp0s8 interface

To check all interface list
firewall-cmd --list-interfaces
To check Interface, Used by which zone is used
firewall-cmd --get-zone-of-interface=enp0s8

To remove interface from zone

In this example work zone is using enp0s8 so we will remove it form work zone
firewall-cmd --zone=work --remove-interface=enp0s8

To add Interface in zone
firewall-cmd --zone=work --add-interface=enp0s8

To Print predefined services, It will provide all list of services
firewall-cmd   --get-services

To List everything added for or enabled in a zone
firewall-cmd --list-all

To List everything added for or enabled in all zones
firewall-cmd --list-all-zones

To Print information about a service
firewall-cmd --info-service=bacula

To add service in Zone
firewall-cmd   --add-service=bacula

Here we add "bacula" service in active zone

To remove service from zone
firewall-cmd   --remove-service=bacula

Note - We can use   --permanent  to    set an option permanently with any each commnad,  this will update xml. locate in firewall directory
firewall-cmd   --add-service=bacula --permanent
To know about more :

5 -  Allow Custom Ports in Firewall

Thanks,






1 comment

IT said...

Great Article
Cyber Security Projects

projects for cse

Networking Projects

JavaScript Training in Chennai

JavaScript Training in Chennai

The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

Powered by Blogger.