{{define "content"}} {{with .Data}} {{$e := .Errors}}

Every LAN and tunnel belongs to a zone. Traffic inside a zone is allowed; between zones it is denied unless a rule allows it. A rule works in one direction (replies are always allowed), so letting two zones talk to each other takes two rules.

Zones {{range $i, $m := .Members}} {{with index $e (printf "member[%d]" $i)}}{{end}} {{end}}
InterfaceDeviceZone
{{if eq $m.Kind "lan"}}LAN{{else}}Tunnel{{end}} {{$m.Name}} {{$m.Device}}
{{.}}

Several interfaces can share a zone. The uplink is the zone wan; rules from it publish services.

{{range .Empty}}

Zone {{.}} has no interface. {{with index $e (printf "zone.%s" .)}}{{.}}{{end}}

{{end}} {{with index $e "newzone"}}{{.}}{{end}}

A new zone can be picked above (and in the rules) after saving.

Rules
{{range $i, $r := .Rows}} {{range $f := list "from" "sources" "sourcePorts" "to" "destination" "ports" "protocol" "ratelimit"}}{{with index $e (printf "rule[%d].%s" $i $f)}}{{end}}{{end}} {{end}}
From zoneFrom addressFrom portTo zoneTo addressTo portProtocolForwarded onlyLogRate limitRemove
{{if or $r.From $r.To}}{{end}}
{{$f}}: {{.}}

Fill in the last row to add a rule. Addresses (several separated by commas) are IPv4 or IPv6, single or CIDR; to address is one address or network. Ports (tcp and udp only): 22, 443, 5000-5100. From wan (the internet) a rule must name the address inside, the protocol and the ports, and only lets traffic through; a port forward is set up below. Forwarded only limits a rule to connections that a port forward translated. Rate limit caps new connections per sender, like 10/minute.

Address translation (NAT)
{{range $i, $r := .NATs}} {{range $f := list "type" "from" "sources" "destination" "protocol" "ports" "to" "toaddress" "toport" "hairpin"}}{{with index $e (printf "nat[%d].%s" $i $f)}}{{end}}{{end}} {{end}}
TypeFrom zoneFrom addressSent toProtocolPortTo zoneTranslate toTo portHairpinAlso allowRemove
{{if or $r.ToAddress $r.Ports}}{{if $r.Allow}}{{else}}{{end}}{{end}} {{if or $r.ToAddress $r.Ports $r.To}}{{end}}
{{$f}}: {{.}}

Port forward: traffic from the zone (wan is the internet) addressed to the router (or to the address in Sent to) on these ports goes to the host in Translate to, in zone To zone; the sender's address is kept. Also allow adds the filter rule that lets it through (without it the firewall still blocks it). Hairpin lets your LANs use a forward from the internet through the router's public address.
Masquerade and source NAT rewrite where traffic from the zone (or any zone) leaves through To zone: masquerade with the outgoing interface's address, source NAT with the address in Translate to. Internet-enabled LANs are already masqueraded out the uplink. Fill in the last row to add one.

{{if .Other}}

Other rules

Rules with options this page does not edit are kept as they are; change them in settings.json.

{{end}} {{end}} {{end}}