Zones¶
Zones define a part of network topology.
They are usually defined as a list of subnets or by a list of interfaces, though custom rules for matching traffic are possible.
There exists an implicit all
Zone, that matches all traffic.
Traffic originating or targeting the local machine are matched by a predefined zone called fw
(short for firewall) by default.
There exists inheritance for zones. Each zone will automatically get the rules of its parent zone applied, after the more specific rules get applied.
Options¶
networking.nftables.firewall.zones¶
networking.nftables.firewall.zones
This option has no description.
attribute set of (submodule)
networking.nftables.firewall.zones.<name>.after¶
networking.nftables.firewall.zones.<name>.after
This option has no description.
non-empty (list of string)
networking.nftables.firewall.zones.<name>.before¶
networking.nftables.firewall.zones.<name>.before
This option has no description.
non-empty (list of string)
networking.nftables.firewall.zones.<name>.early¶
networking.nftables.firewall.zones.<name>.early
This option has no description.
boolean
false
networking.nftables.firewall.zones.<name>.egressExpression¶
networking.nftables.firewall.zones.<name>.egressExpression
ingressExpression
and egressExpression
contain nft-espressions
to match traffic, that defines the zone. Traffic matched by the
ingressExpression
is considered originating in the zone, while
traffic matched by the egressExpression
is considered targeting
the zone.
If multiple expressions are given, any one of them matching traffic suffices to consider the traffic as part of the zone. This is used eg. when defining a zone as an ipv4 and ipv6 subnet. No Traffic will ever match both, so one matching expression is considered sufficient.
ingressExpression
and egressExpression
must be balanced, i.e.
both lists need to contain the same number of expressions.
ingressExpression
and egressExpression
are mandatory for all
zones except the local zone.
list of string
[ ]
networking.nftables.firewall.zones.<name>.enable¶
networking.nftables.firewall.zones.<name>.enable
This option has no description.
boolean
true
networking.nftables.firewall.zones.<name>.ingressExpression¶
networking.nftables.firewall.zones.<name>.ingressExpression
ingressExpression
and egressExpression
contain nft-espressions
to match traffic, that defines the zone. Traffic matched by the
ingressExpression
is considered originating in the zone, while
traffic matched by the egressExpression
is considered targeting
the zone.
If multiple expressions are given, any one of them matching traffic suffices to consider the traffic as part of the zone. This is used eg. when defining a zone as an ipv4 and ipv6 subnet. No Traffic will ever match both, so one matching expression is considered sufficient.
ingressExpression
and egressExpression
must be balanced, i.e.
both lists need to contain the same number of expressions.
ingressExpression
and egressExpression
are mandatory for all
zones except the local zone.
list of string
[ ]
networking.nftables.firewall.zones.<name>.interfaces¶
networking.nftables.firewall.zones.<name>.interfaces
Shorthand for defining ingressExpression
and egressExpression
using iifname
and oifname
respectively.
This defines the zone as a list of network interfaces.
list of string
[ ]
[ "eth0" ]
networking.nftables.firewall.zones.<name>.ipv4Addresses¶
networking.nftables.firewall.zones.<name>.ipv4Addresses
Shorthand for defining ingressExpression
and egressExpression
using ip saddr
and ip daddr
respectively.
This defines the zone as a list of ipv4 hosts or subnets.
list of string
[ ]
[ "192.168.0.0/24" ]
networking.nftables.firewall.zones.<name>.ipv6Addresses¶
networking.nftables.firewall.zones.<name>.ipv6Addresses
Shorthand for defining ingressExpression
and egressExpression
using ip6 saddr
and ip6 daddr
respectively.
This defines the zone as a list of ipv6 hosts or subnets.
list of string
[ ]
[ "2042::/16" ]
networking.nftables.firewall.zones.<name>.late¶
networking.nftables.firewall.zones.<name>.late
This option has no description.
boolean
false
networking.nftables.firewall.zones.<name>.parent¶
networking.nftables.firewall.zones.<name>.parent
Additionally to ingressExpression
and egressExpression
zones
can also be defined as a subzone of another zone. If so, traffic
is matched only against the ingressExpression
and
egressExpression
, if the traffic is already considered to be
part of the parent zone.
If traffic matches a zone, it will first be tested, if it also matches some of its subzones. If so, the logic of the subzones will be called. If not, or if the subzones did not terminate the rule processing with a verdict, the rules of the parent zone will be applied.
null or string
null
config.networking.nftables.firewall.localZoneName