-
Notifications
You must be signed in to change notification settings - Fork 2
firewall
Pre-Alpha. This page describes behavior that may change.
Ze manages nftables packet filter and NAT rules from a single firewall { } YANG section. The abstract data model describes matches (from) and actions (then); the backend lowers them to kernel expressions.
| Backend | Platform | Mechanism |
|---|---|---|
nft |
Linux | google/nftables netlink library |
vpp |
Linux + VPP | GoVPP ACL classify pipeline |
firewall {
backend nft;
}
The ze:backend YANG extension provides commit-time rejection of unsupported features. If a feature is not supported by the configured backend, the commit fails with a descriptive error.
Ze owns all tables whose kernel name starts with ze_. A table contains one or more chains; a base chain has a type, hook, priority, and default policy.
firewall {
backend nft;
table wan {
family inet;
chain input {
type filter;
hook input;
priority 0;
policy drop;
term allow-ssh {
from {
destination-port 22;
protocol tcp;
}
then {
accept;
}
}
term allow-established {
from {
connection-state established,related;
}
then {
accept;
}
}
}
}
}
inet (dual-stack), ip, ip6, arp, bridge, netdev.
filter, nat, route.
input, output, forward, prerouting, postrouting, ingress, egress.
| Config key | Match | Example |
|---|---|---|
source-address |
IP prefix | source-address 10.0.0.0/8; |
destination-address |
IP prefix | destination-address 192.168.1.0/24; |
source-port |
Port or range | source-port 1024-65535; |
destination-port |
Port, range, or list | destination-port 80,443; |
protocol |
L4 protocol | protocol tcp; |
input-interface |
Interface name | input-interface eth0; |
output-interface |
Interface name | output-interface "l2tp*"; |
icmp-type |
ICMP type (name or number) | icmp-type echo-request; |
icmpv6-type |
ICMPv6 type | icmpv6-type nd-neighbor-solicit; |
connection-state |
Conntrack states | connection-state established,related; |
connection-mark |
Mark value/mask | connection-mark 0x10/0xff; |
mark |
Packet mark value/mask | mark 0x10/0xff; |
dscp |
DSCP value | dscp ef; |
tcp-flags |
TCP header flags | tcp-flags syn; |
match-set |
Named set lookup | match-set blocked source-address; |
A trailing * on an interface name produces a prefix match ("l2tp*" matches l2tp0, l2tp1, etc.).
| Config key | Action | Example |
|---|---|---|
accept |
Accept packet | accept; |
drop |
Drop packet | drop; |
reject |
Reject with ICMP | reject { with icmp; code 3; } |
jump / goto
|
Chain transfer | jump helper; |
return |
Return from chain | return; |
snat |
Source NAT | snat { to "10.0.0.1"; } |
dnat |
Destination NAT | dnat { to "10.1.1.1:8080"; } |
masquerade |
Masquerade | masquerade; |
redirect |
Redirect to port | redirect { port 8080; } |
notrack |
Disable conntrack | notrack; |
flow-offload |
Hardware offload | flow-offload ft0; |
mark |
Set packet mark | mark { value 0x10; } |
connection-mark |
Set connmark | connection-mark { value 0x20; mask 0xff; } |
dscp |
Set DSCP | dscp { value 46; } |
tcp-mss |
Clamp TCP MSS | tcp-mss { size 1400; } |
counter |
Count packets/bytes | counter my-counter; |
log |
Log packet | log { prefix "DROPPED"; } |
limit |
Rate limit | limit { rate 10/second; burst 5; } |
exclude |
Skip NAT (Return) | exclude; |
SNAT, DNAT, masquerade, and redirect are available in nat chains. exclude emits a Return verdict so matched traffic skips NAT translation. SNAT and DNAT accept address ranges for pool-based NAT: snat { to "10.0.0.1-10.0.0.10"; }.
When backend vpp is configured and VPP is running, the firewall uses VPP's ACL classify pipeline instead of nftables:
- NAT44-ED: SNAT, DNAT, and masquerade via VPP's NAT44-ED plugin.
- ACL classify: SetMark and Limit actions through VPP classify tables.
- Hardened: patterns discovered in VyOS VPP integration are handled defensively.
The VPP backend supports the same YANG config surface. Features not yet supported by VPP are rejected at commit time via the backend gate.
firewall {
backend nft;
table wan {
family inet;
set blocked {
type ipv4_addr;
element 10.0.0.1;
element 10.0.0.2 { timeout 3600; }
}
chain input {
type filter;
hook input;
priority 0;
policy drop;
term block-list {
from {
match-set blocked source-address;
}
then {
drop;
}
}
}
}
}
Set elements support optional per-element timeouts for dynamic blocklists.
| Command | Description |
|---|---|
show firewall |
Display all firewall tables and rules. |
show firewall counters |
Per-term packet and byte counters. |
clear firewall counters |
Reset match counters. |
- Traffic Control for per-interface queueing disciplines.
- Policy Routing for nftables-based PBR.
- VPP Data Plane for the VPP integration.
- Plugins for the plugin list.
Adapted from main/docs/guide/firewall.md.
Unreviewed draft. This wiki was authored in bulk and has not been reviewed. File corrections on the issue tracker.
- Overview
- YANG Model
- Editor Workflow
- Archive and Rollback
- System
- Interfaces
- VRRP
- BFD
- FIB
- OSPF
- IS-IS
- MPLS / LDP / RSVP-TE
- RSVP-TE
- SRv6
- Static Routes
- Policy Routing
- Firewall
- Traffic Control
- Class of Service
- L2TP/PPP
- PPPoE
- VPP Data Plane
- RPKI
- IPsec VPN
- TACACS+ AAA
- RADIUS AAA
- AS112 DNS
- Authorization
- Fleet
- BGP
- Starting and Stopping
- Show Commands
- Monitoring
- Flow Export
- DDoS Mitigation
- Anomaly Detection
- Health Checks
- Audit Trail
- Production Diagnostics
- Logging
- Operational Reports
- Healthcheck
- Self-Update
- Zero-Touch Provisioning
- MRT Analysis
- Upgrade and Restart
- Storage
- Policy
- Core
- Resilience
- Validation
- Capabilities
- Address Families
- Protocol
- Subsystems
- Infrastructure
- Route Server at an IXP
- Transit Edge with RPKI
- Public Looking Glass
- ExaBGP Migration Walkthrough
- FlowSpec Injection
- Chaos-Tested Peering
- AS Path Topology