Skip to content

Commit 170869e

Browse files
authored
firewall: improve zone-based firewall docs (#1622)
1 parent f2c96f1 commit 170869e

File tree

1 file changed

+67
-34
lines changed

1 file changed

+67
-34
lines changed

docs/configuration/firewall/zone.rst

Lines changed: 67 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -65,60 +65,94 @@ Configuration
6565
As an alternative to applying policy to an interface directly, a zone-based
6666
firewall can be created to simplify configuration when multiple interfaces
6767
belong to the same security zone. Instead of applying rule-sets to interfaces,
68-
they are applied to source zone-destination zone pairs.
68+
they are applied to source-destination zone pairs.
6969

7070
A basic introduction to zone-based firewalls can be found `here
7171
<https://support.vyos.io/en/kb/articles/a-primer-to-zone-based-firewall>`_,
7272
and an example at :ref:`examples-zone-policy`.
7373

74+
The following steps are required to create a zone-based firewall:
75+
76+
1. Define both the source and destination zones
77+
2. Define the rule-set
78+
3. Apply the rule-set to the zones
79+
7480
Define a Zone
7581
=============
7682

77-
To define a zone setup either one with interfaces or a local zone.
83+
To define a zone setup either one with interfaces or the local zone.
7884

7985
.. cfgcmd:: set firewall zone <name> interface <interface>
8086

81-
Set interfaces to a zone. A zone can have multiple interfaces.
82-
But an interface can only be a member in one zone.
87+
Assign interfaces as a member of a zone.
88+
89+
.. note::
90+
91+
* An interface can only be a member of one zone.
92+
* A zone can have multiple interfaces, with traffic between interfaces in
93+
the same zone subject to the intra-zone-filtering policy (allowed by
94+
default).
8395

8496
.. cfgcmd:: set firewall zone <name> local-zone
8597

86-
Define the zone as a local zone. A local zone has no interfaces and
87-
will be applied to the router itself.
98+
Define the zone as the local zone, for traffic originating from and destined
99+
to the router itself.
100+
101+
.. note::
102+
103+
* A local zone cannot have any member interfaces
104+
* There cannot be multiple local zones
88105

89106
.. cfgcmd:: set firewall zone <name> default-action [drop | reject]
90107

91-
Change the default-action with this setting.
108+
Change the zone default-action, which applies to traffic destined to this
109+
zone that doesn't match any of the source zone rulesets applied.
110+
111+
.. cfgcmd:: set firewall zone <name> default-log
112+
113+
Enable logging of packets that hit this zone's default-action (disabled by
114+
default).
92115

93116
.. cfgcmd:: set firewall zone <name> description
94117

95118
Set a meaningful description.
96119

97-
Applying a Rule-Set to a Zone
120+
Defining a Rule-Set
98121
=============================
99122

100-
Before you are able to apply a rule-set to a zone you have to create the zones
101-
first.
123+
Zone-based firewall rule-sets are for traffic from a *Source Zone* to a
124+
*Destination Zone*.
102125

103-
It helps to think of the syntax as: (see below). The 'rule-set' should be
104-
written from the perspective of: *Source Zone*-to->*Destination Zone*
126+
The rule-sets are created as a custom firewall chain using the commands below
127+
(refer to the firewall IPv4/IPv6 sections for the full syntax):
105128

106-
.. cfgcmd:: set firewall zone <Destination Zone> from <Source Zone>
107-
firewall name <rule-set>
129+
* For :ref:`IPv4<configuration/firewall/ipv4:Firewall - IPv4 Rules>`:
130+
``set firewall ipv4 name <name> ...``
131+
* For :ref:`IPv6<configuration/firewall/ipv6:Firewall - IPv6 Rules>`:
132+
``set firewall ipv6 name <name> ...``
108133

109-
.. cfgcmd:: set firewall zone <name> from <name> firewall name
110-
<rule-set>
134+
It can be helpful to name the rule-sets in the format
135+
``<Sourze Zone>-<Destination Zone>-<v4 | v6>`` to make them easily identifiable.
111136

112-
.. cfgcmd:: set firewall zone <name> from <name> firewall ipv6-name
113-
<rule-set>
137+
Applying a Rule-Set to a Zone
138+
=============================
114139

115-
You apply a rule-set always to a zone from an other zone, it is recommended
116-
to create one rule-set for each zone pair.
140+
Once a rule-set has been defined, it can then be applied to the source and
141+
destination zones. The configuration syntax is anchored on the destination
142+
zone, with each of the source zone rulesets listed against the destination.
117143

118-
.. code-block:: none
144+
.. cfgcmd:: set firewall zone <Destination Zone> from <Source Zone>
145+
firewall name <ipv4-rule-set-name>
146+
147+
.. cfgcmd:: set firewall zone <Destination Zone> from <Source Zone>
148+
firewall ipv6-name <ipv6-rule-set-name>
149+
150+
It is recommended to create two rule-sets for each source-destination zone pair.
119151

120-
set firewall zone DMZ from LAN firewall name LANv4-to-DMZv4
121-
set firewall zone LAN from DMZ firewall name DMZv4-to-LANv4
152+
.. code-block:: none
153+
154+
set firewall zone DMZ from LAN firewall name LAN-DMZ-v4
155+
set firewall zone LAN from DMZ firewall name DMZ-LAN-v4
122156
123157
**************
124158
Operation-mode
@@ -133,13 +167,12 @@ Operation-mode
133167
vyos@vyos:~$ show firewall zone-policy
134168
Zone Interfaces From Zone Firewall IPv4 Firewall IPv6
135169
------ ------------ ----------- --------------- ---------------
136-
LAN eth1 WAN WAN_to_LAN
170+
LAN eth1 WAN WAN-LAN-v4
137171
eth2
138-
LOCAL LOCAL LAN LAN_to_LOCAL
139-
WAN WAN_to_LOCAL WAN_to_LOCAL_v6
140-
WAN eth3 LAN LAN_to_WAN
141-
eth0 LOCAL LOCAL_to_WAN
142-
vyos@vyos:~$
172+
LOCAL LOCAL LAN LAN-LOCAL-v4
173+
WAN WAN-LOCAL-v4 WAN-LOCAL-v6
174+
WAN eth3 LAN LAN-WAN-v4
175+
eth0 LOCAL LOCAL-WAN-v4
143176
144177
.. opcmd:: show firewall zone-policy zone <zone>
145178

@@ -150,11 +183,11 @@ Operation-mode
150183
vyos@vyos:~$ show firewall zone-policy zone WAN
151184
Zone Interfaces From Zone Firewall IPv4 Firewall IPv6
152185
------ ------------ ----------- --------------- ---------------
153-
WAN eth3 LAN LAN_to_WAN
154-
eth0 LOCAL LOCAL_to_WAN
186+
WAN eth3 LAN LAN-WAN-v4
187+
eth0 LOCAL LOCAL-WAN-v4
188+
155189
vyos@vyos:~$ show firewall zone-policy zone LOCAL
156190
Zone Interfaces From Zone Firewall IPv4 Firewall IPv6
157191
------ ------------ ----------- --------------- ---------------
158-
LOCAL LOCAL LAN LAN_to_LOCAL
159-
WAN WAN_to_LOCAL WAN_to_LOCAL_v6
160-
vyos@vyos:~$
192+
LOCAL LOCAL LAN LAN-LOCAL-v4
193+
WAN WAN-LOCAL-v4 WAN-LOCAL-v6

0 commit comments

Comments
 (0)