@@ -65,60 +65,94 @@ Configuration
65
65
As an alternative to applying policy to an interface directly, a zone-based
66
66
firewall can be created to simplify configuration when multiple interfaces
67
67
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.
69
69
70
70
A basic introduction to zone-based firewalls can be found `here
71
71
<https://support.vyos.io/en/kb/articles/a-primer-to-zone-based-firewall> `_,
72
72
and an example at :ref: `examples-zone-policy `.
73
73
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
+
74
80
Define a Zone
75
81
=============
76
82
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.
78
84
79
85
.. cfgcmd :: set firewall zone <name> interface <interface>
80
86
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).
83
95
84
96
.. cfgcmd :: set firewall zone <name> local-zone
85
97
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
88
105
89
106
.. cfgcmd :: set firewall zone <name> default-action [drop | reject]
90
107
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).
92
115
93
116
.. cfgcmd :: set firewall zone <name> description
94
117
95
118
Set a meaningful description.
96
119
97
- Applying a Rule-Set to a Zone
120
+ Defining a Rule-Set
98
121
=============================
99
122
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 * .
102
125
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):
105
128
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> ... ``
108
133
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.
111
136
112
- .. cfgcmd :: set firewall zone <name> from <name> firewall ipv6-name
113
- <rule-set>
137
+ Applying a Rule-Set to a Zone
138
+ =============================
114
139
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.
117
143
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.
119
151
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
122
156
123
157
**************
124
158
Operation-mode
@@ -133,13 +167,12 @@ Operation-mode
133
167
vyos@vyos:~$ show firewall zone-policy
134
168
Zone Interfaces From Zone Firewall IPv4 Firewall IPv6
135
169
------ ------------ ----------- --------------- ---------------
136
- LAN eth1 WAN WAN_to_LAN
170
+ LAN eth1 WAN WAN-LAN-v4
137
171
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
143
176
144
177
.. opcmd :: show firewall zone-policy zone <zone>
145
178
@@ -150,11 +183,11 @@ Operation-mode
150
183
vyos@vyos:~$ show firewall zone-policy zone WAN
151
184
Zone Interfaces From Zone Firewall IPv4 Firewall IPv6
152
185
------ ------------ ----------- --------------- ---------------
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
+
155
189
vyos@vyos:~$ show firewall zone-policy zone LOCAL
156
190
Zone Interfaces From Zone Firewall IPv4 Firewall IPv6
157
191
------ ------------ ----------- --------------- ---------------
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