FirewallD is a firewall management tool available by default on CentOS 7 servers. Basically, it is a wrapper around iptables and it comes with graphical configuration tool firewall-config and command line tool firewall-cmd. With the iptables service, every change requires flushing of the old rules and reading the new rules from the `/etc/sysconfig/iptables` file, while with firewalld only differences are applied.
### FirewallD zones
FirewallD uses services and zones instead of iptables rules and chains. By default the following zones are available:
* drop– Drop all incoming network packets with no reply, only outgoing network connections are available.
* block– Reject all incoming network packets with an icmp-host-prohibited message, only outgoing network connections are available.
* public– Only selected incoming connections are accepted, for use in public areas
* externalFor external networks with masquerading enabled, only selected incoming connections are accepted.
* dmz– DMZ demilitarized zone, publicly-accessible with limited access to the internal network, only selected incoming connections are accepted.
* work– For computers in your home area, only selected incoming connections are accepted.
* home– For computers in your home area, only selected incoming connections are accepted.
* internal-For computers in your internal network, only selected incoming connections are accepted.
* trusted– All network connections are accepted.
To list all available zones run:
```
# firewall-cmd --get-zones
work drop internal external trusted home dmz public block
```
To list the default zone:
```
# firewall-cmd --get-default-zone
public
```
To change the default zone:
```
# firewall-cmd --set-default-zone=dmz
# firewall-cmd --get-default-zone
dmz
```
### FirewallD services
FirewallD services are xml configuration files, with information of a service entry for firewalld. TO list all available services run:
xml configuration files are stored in the`/usr/lib/firewalld/services/`and`/etc/firewalld/services/`directories.
### Configuring your firewall with FirewallD
As an example, here is how you can configure your[RoseHosting VPS][6]firewall with FirewallD if you were running a web server, SSH on port 7022 and mail server.
First we will set the default zone to dmz.
```
# firewall-cmd --set-default-zone=dmz
# firewall-cmd --get-default-zone
dmz
```
To add permanent service rules for HTTP and HTTPS to the dmz zone, run:
Ofcourse, you don’t have to do any of this if you use one of our[CentOS VPS hosting][7]services, in which case you can simply ask our expert Linux admins to setup this for you. They are available 24×7 and will take care of your request immediately.
PS. If you liked this post please share it with your friends on the social networks using the sharing buttons or simply leave a reply below. Thanks.