<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
[
<!ENTITY authors SYSTEM "authors.xml">
<!ENTITY seealso SYSTEM "seealso.xml">
<!ENTITY notes SYSTEM "notes.xml">
]>

<!--
  SPDX-License-Identifier: GPL-2.0-or-later

  This file is part of firewalld.

  Copyright (C) 2010-2013 Red Hat, Inc.

  Authors:
  Thomas Woerner <twoerner@redhat.com>
-->

<refentry id="firewalld.zones">

  <refentryinfo>
    <title>firewalld.zones</title>
    <productname>firewalld</productname>
    &authors;
  </refentryinfo>

  <refmeta>
    <refentrytitle>firewalld.zones</refentrytitle>
    <manvolnum>5</manvolnum>
  </refmeta>

  <refnamediv>
    <refname>firewalld.zones</refname>
    <refpurpose>firewalld zones</refpurpose>
  </refnamediv>

  <refsect1 id="description">
    <title>Description</title>

    <refsect2 id="whatisazone">
      <title>What is a zone?</title>

      <para>
	A network zone defines the level of trust for network connections. This is a one to many relation, which means that a connection can only be part of one zone, but a zone can be used for many network connections.
      </para>

      <para>
	The zone defines the firewall features that are enabled in this zone:
      </para>

      <refsect3>
	<title>Intra Zone Forwarding</title>
	<para>
	  Allows packets received by a zone to be forwarded to other interfaces or sources within the same zone, even if the zone's target is not <literal>ACCEPT</literal>.
	</para>
      </refsect3>

      <refsect3>
	<title>Predefined services</title>
	<para>
	  A service is a combination of port and/or protocol entries. Optionally netfilter helper modules can be added and also a IPv4 and IPv6 destination address.
	</para>
      </refsect3>

      <refsect3>
	<title>Ports and protocols</title>
	<para>
	  Definition of <literal>tcp</literal>, <literal>udp</literal>, <literal>sctp</literal> or <literal>dccp</literal> ports, where ports can be a single port or a port range.
	</para>
      </refsect3>

      <refsect3>
	<title>ICMP blocks</title>
	<para>
	  Blocks selected Internet Control Message Protocol (ICMP) messages. These messages are either information requests or created as a reply to information requests or in error conditions.
	</para>
      </refsect3>

      <refsect3>
	<title>ICMP block inversion</title>
	<para>
	  Changes how ICMP messages are handled. When enabled, all ICMP message types are blocked, <emphasis>except</emphasis> for those in the ICMP block list.
	</para>
      </refsect3>

      <refsect3>
	<title>Masquerading</title>
	<para>
	  The addresses of a private network are mapped to and hidden behind a public IP address. This is a form of address translation.
	</para>
      </refsect3>

      <refsect3>
	<title>Forward ports</title>
	<para>
	  A forward port is either mapped to the same port on another host or to another port on the same host or to another port on another host.
	</para>
      </refsect3>

      <refsect3>
	<title>Rich language rules</title>
	<para>
	  The rich language extends the elements (service, port, icmp-block, masquerade, forward-port and source-port) with additional source and destination addresses, logging, actions and limits for logs and actions. It can also be used for host or network white and black listing (for more information, please have a look at <citerefentry><refentrytitle>firewalld.richlanguage</refentrytitle><manvolnum>5</manvolnum></citerefentry>).
	</para>
      </refsect3>

      <para>
	For more information on the zone file format, please have a look at <citerefentry><refentrytitle>firewalld.zone</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
      </para>
    </refsect2>

    <refsect2 id="whichzonesareavailable">
      <title>Which zones are available?</title>

      <para>
	Here are the zones provided by firewalld sorted according to the default trust level of the zones from untrusted to trusted:
      </para>

	<variablelist>
	  <varlistentry>
	    <term>drop</term>
            <listitem>
	      <para>
		Any incoming network packets are dropped, there is no reply. Only outgoing network connections are possible.
	      </para>
	    </listitem>
	  </varlistentry>

	  <varlistentry>
	    <term>block</term>
            <listitem>
	      <para>
		Any incoming network connections are rejected with an <literal>icmp-host-prohibited</literal> message for IPv4 and <literal>icmp6-adm-prohibited</literal> for IPv6. Only network connections initiated within this system are possible.
	      </para>
	    </listitem>
	  </varlistentry>

	  <varlistentry>
	    <term>public</term>
            <listitem>
	      <para>
		For use in public areas. You do not trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.
	      </para>
	    </listitem>
	  </varlistentry>

	  <varlistentry>
	    <term>external</term>
            <listitem>
	      <para>
		For use on external networks with masquerading enabled especially for routers. You do not trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.
	      </para>
	    </listitem>
	  </varlistentry>

	  <varlistentry>
	    <term>dmz</term>
            <listitem>
	      <para>
		For computers in your demilitarized zone that are publicly-accessible with limited access to your internal network. Only selected incoming connections are accepted.
	      </para>
	    </listitem>
	  </varlistentry>

	  <varlistentry>
	    <term>work</term>
            <listitem>
	      <para>
		For use in work areas. You mostly trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.
	      </para>
	    </listitem>
	  </varlistentry>

	  <varlistentry>
	    <term>home</term>
            <listitem>
	      <para>
		For use in home areas. You mostly trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.
	      </para>
	    </listitem>
	  </varlistentry>

	  <varlistentry>
	    <term>internal</term>
            <listitem>
	      <para>
		For use on internal networks. You mostly trust the other computers on the networks to not harm your computer. Only selected incoming connections are accepted.
	      </para>
	    </listitem>
	  </varlistentry>

	  <varlistentry>
	    <term>trusted</term>
            <listitem>
	      <para>
		All network connections are accepted.
	      </para>
	    </listitem>
	  </varlistentry>
	</variablelist>

    </refsect2>

    <refsect2 id="whichzonesshouldbeused">
      <title>Which zone should be used?</title>

      <para>
	A public WIFI network connection for example should be mainly untrusted, a wired home network connection should be fairly trusted. Select the zone that best matches the network you are using.
      </para>
    </refsect2>

    <refsect2 id="howtoconfigureoraddzones">
      <title>How to configure or add zones?</title>

      <para>
	To configure or add zones you can either use one of the firewalld interfaces to handle and change the configuration: These are the graphical configuration tool firewall-config, the command line tool <command>firewall-cmd</command> or the D-Bus interface. Or you can create or copy a zone file in one of the configuration directories. <filename class="directory"><config.prefix/>/lib/firewalld/zones</filename> is used for default and fallback configurations and <filename class="directory"><config.sysconfdir/>/firewalld/zones</filename> is used for user created and customized configuration files.
      </para>
    </refsect2>

    <refsect2 id="howtosetorchangeazone">
      <title>How to set or change a zone for a connection?</title>

      <para>
	The zone is stored into the ifcfg of the connection with <option>ZONE=</option> option. If the option is missing or empty, the default zone set in firewalld is used.
      </para>
      <para>
       If the connection is controlled by NetworkManager, you can also use <command>nm-connection-editor</command> to change the zone.
      </para>
      <para>
	For the addition or change of interfaces that are not under control of NetworkManager: firewalld tries to change the ZONE setting in the ifcfg file, if an ifcfg file exists that is using the interface.
      </para>
      <para>
	Only for the removal of interfaces that are not under control of NetworkManager: firewalld is not trying to change the ZONE setting in the ifcfg file. This is needed to make sure that an ifdown of the interface will not result in a reset of the zone setting to the default zone. Only the zone binding is then removed in firewalld then.
      </para>
    </refsect2>

  </refsect1>

  &seealso;

  &notes;

</refentry>
