跳到主要内容

Define firewall zones

Scenario

You want a stateful firewall whose default behaviour is "WAN cannot reach LAN, LAN can reach WAN, management can reach everything." That is the matrix every home or SOHO router needs, and writing it as individual accept / drop rules is repetitive and error-prone.

How routerd solves it

FirewallZone maps interfaces to a role. routerd has a built-in role matrix that derives the directional default actions, so you usually do not need any explicit FirewallRule for the common case.

roleTypical use
untrustWAN-facing interfaces (uplink, DSLite tunnel, PPPoE pseudo-interface)
trustNormal LAN segments
mgmtOut-of-band management network

The implicit matrix is:

from \ toselftrustmgmtuntrust
mgmtacceptacceptn/aaccept
trustacceptacceptdropaccept
untrustdropdropdropn/a
selfacceptacceptacceptaccept

Established/related connections are always allowed.

Example

- apiVersion: firewall.routerd.net/v1alpha1
kind: FirewallZone
metadata:
name: wan
spec:
role: untrust
interfaces:
- Interface/wan
- DSLiteTunnel/ds-lite-primary

- apiVersion: firewall.routerd.net/v1alpha1
kind: FirewallZone
metadata:
name: lan
spec:
role: trust
interfaces:
- Interface/lan

- apiVersion: firewall.routerd.net/v1alpha1
kind: FirewallZone
metadata:
name: management
spec:
role: mgmt
interfaces:
- Interface/mgmt

This is enough for a typical home router. The role matrix supplies the defaults; you only add explicit FirewallRule resources to express exceptions.

See also