From: Stefan Hanreich <s.hanreich@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH docs/manager/network/proxmox{,-ve-rs,-firewall} 00/14] sdn: conntrack zones and SNAT for simple zones with a dedicated VRF
Date: Thu, 19 Nov 2026 20:45:32 +0100 [thread overview]
Message-ID: <20261119194547.674512-1-s.hanreich@proxmox.com> (raw)
The subnets of simple zones with a dedicated VRF may overlap, but all
VRFs share conntrack zone 0. A connection in one VRF could then match
the conntrack entry of an identical connection in another VRF, so the
stateful firewall accepts a new connection as established. Conntrack
state migration also overwrites the entries of other guests when
loading entries with identical tuples on the target node. NAT stores
its mappings in the same conntrack entries, so it is affected as well.
This series gives every simple zone with a dedicated VRF its own
conntrack zone and makes SNAT work through the uplinks of the zone VRF.
Conntrack zones:
* The conntrack zones 16384 to 32767 (0x4000 to 0x7fff) are considered
reserved for Proxmox VE from now on. These are exactly the zones whose
two most significant bits are 01, so the whole area is an aligned
block that can be matched with a single bitmask
(ct zone & 0xc000 == 0x4000). It should stay clear of the lower zone
ids that custom rules typically use, including zone 1, which the SNAT
rules of pve-network use for the firewall bridges of pve-firewall.
This does not affect existing users until they actually utilize the
new feature.
* Each simple zone with a dedicated VRF gets a conntrack zone from the
first 1024 zones of this area (16384 to 17407). It is stored with the
zone as ct-zone, assigned automatically by the zone API in
pve-network, and stays the same as long as the zone has a dedicated
VRF, so it is the same on all nodes. This ensures that conntrack
state migration works inside the cluster. Remote migrations do not
support conntrack state migration.
* The zone is set at the following hook points:
Always:
- inet PREROUTING (for traffic arriving at an interface in the VRF)
- inet OUTPUT (for host traffic originated in the VRF)
Only while proxmox-firewall is active:
- bridge PREROUTING (for guest traffic)
The chains run at priority raw - 10, before conntrack and before the
iptables raw table, so the zone takes effect independent of the order
in which rules are loaded. It doesn't affect the existing pve-network
rules that set CT zone 1 for the firewall bridges of pve-firewall,
because the firewall bridges are never members of a VRF.
* pve-manager runs the proxmox-firewall command after ifreload when
applying the network configuration and in pve-sdn-commit at boot,
before starting guests.
With pve-firewall, connections of guests with the firewall enabled on
a network device are tracked on their firewall bridge in a conntrack
zone shared by all VRFs, so they are not isolated. Applying the
network configuration warns about this.
SNAT:
Subnets with SNAT enabled are masquerading outgoing traffic on every
interface that /etc/network/interfaces puts into the zone VRF, i.e. the
uplinks of the zone, with one rule per uplink.
The routing table of the VRF still decides which uplink a connection
leaves through, e.g. via the gateway of an uplink, which ifupdown2
installs into the VRF routing table, or a default route of the zone.
So this works with several uplinks and ECMP, and with uplinks
configured via DHCP or SLAAC, as no address is needed when generating
the configuration.
Neither vnets nor fabric interfaces are uplinks. This means that
traffic between the vnets of a zone and routed traffic over fabrics
keeps the guest addresses.
Without an uplink in the VRF, SNAT is skipped with a warning. Zones
without a dedicated VRF and EVPN zones are unchanged. As NAT uses the
conntrack zones of the VRFs, SNAT needs no conntrack zones of its own.
The host-bridge-input chain in proxmox-firewall now additionally looks
up the slave device when inspecting traffic. This allows also matching
traffic originating from a VRF, as the bridges there are enslaved to
VRFs and the input interface is the VRF interface. For bridges inside
VRFs we need to match on the enslaved interface instead.
Dependencies:
This series depends on v3 of Gabriel's VRF series [1].
proxmox-firewall needs proxmox-network-api and proxmox-ve-config
pve-manager needs proxmox-firewall and pve-network
[1] https://lore.proxmox.com/pve-devel/20261119194116.575520-1-g.goller@proxmox.com/
proxmox:
Stefan Hanreich (1):
network-api: expose the master device of a link
proxmox-network-api/src/config/helper.rs | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
proxmox-ve-rs:
Stefan Hanreich (2):
sdn: config: read the conntrack zone of zones with a dedicated VRF
sdn: conntrack: map the interfaces of zone VRFs to their conntrack
zone
proxmox-ve-config/src/sdn/config.rs | 38 ++++-
proxmox-ve-config/src/sdn/conntrack.rs | 225 +++++++++++++++++++++++++
proxmox-ve-config/src/sdn/mod.rs | 1 +
proxmox-ve-config/tests/sdn/main.rs | 47 ++++++
4 files changed, 304 insertions(+), 7 deletions(-)
create mode 100644 proxmox-ve-config/src/sdn/conntrack.rs
pve-network:
Stefan Hanreich (2):
sdn: simple: SNAT via the uplinks of zone VRFs
sdn: zones: assign a conntrack zone to zones with a dedicated VRF
src/PVE/API2/Network/SDN/Zones.pm | 13 +++
src/PVE/Network/SDN/Zones.pm | 42 +++++++
src/PVE/Network/SDN/Zones/Plugin.pm | 13 +++
src/PVE/Network/SDN/Zones/SimplePlugin.pm | 27 ++++-
src/test/Makefile | 5 +-
src/test/run_test_ct_zones.pl | 103 ++++++++++++++++++
.../simple/vrf_snat/expected_sdn_interfaces | 81 ++++++++++++++
src/test/zones/simple/vrf_snat/interfaces | 29 +++++
src/test/zones/simple/vrf_snat/sdn_config | 53 +++++++++
9 files changed, 364 insertions(+), 2 deletions(-)
create mode 100755 src/test/run_test_ct_zones.pl
create mode 100644 src/test/zones/simple/vrf_snat/expected_sdn_interfaces
create mode 100644 src/test/zones/simple/vrf_snat/interfaces
create mode 100644 src/test/zones/simple/vrf_snat/sdn_config
proxmox-firewall:
Stefan Hanreich (6):
firewall: apply vnet rules to host traffic from vnets in a VRF
nftables: expression: add a constructor for map lookups
nftables: statement: add a helper for setting the conntrack zone
nftables: expression: convert the conntrack zones of zone VRFs
firewall: add a command applying the conntrack zones of zone VRFs
firewall: put guest traffic of zone VRFs into their conntrack zone
.../resources/proxmox-firewall.nft | 16 ++
proxmox-firewall/src/bin/proxmox-firewall.rs | 30 ++-
proxmox-firewall/src/config.rs | 23 +-
proxmox-firewall/src/firewall.rs | 30 +++
proxmox-firewall/src/lib.rs | 1 +
proxmox-firewall/src/sdn.rs | 235 ++++++++++++++++++
.../tests/input/.running-config.json | 4 +-
.../integration_tests__firewall.snap | 24 ++
proxmox-nftables/src/expression.rs | 69 +++++
proxmox-nftables/src/statement.rs | 7 +
10 files changed, 430 insertions(+), 9 deletions(-)
create mode 100644 proxmox-firewall/src/sdn.rs
pve-manager:
Stefan Hanreich (2):
network: apply the conntrack zones of zone VRFs
network: warn if pve-firewall cannot isolate guests in zone VRFs
PVE/API2/Network.pm | 35 +++++++++++++++++++++++++++++++++
bin/pve-sdn-commit | 20 +++++++++++++++++++
services/pve-sdn-commit.service | 2 ++
3 files changed, 57 insertions(+)
pve-docs:
Stefan Hanreich (1):
pvesdn: simple zones: document dedicated VRFs
pvesdn.adoc | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 100 insertions(+)
Summary over all repositories:
28 files changed, 1265 insertions(+), 20 deletions(-)
--
Generated by murpp 0.12.0
next reply other threads:[~2026-11-19 19:47 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 19:45 Stefan Hanreich [this message]
2026-11-19 19:45 ` [PATCH proxmox 01/14] network-api: expose the master device of a link Stefan Hanreich
2026-11-19 19:45 ` [PATCH proxmox-ve-rs 02/14] sdn: config: read the conntrack zone of zones with a dedicated VRF Stefan Hanreich
2026-11-19 19:45 ` [PATCH proxmox-ve-rs 03/14] sdn: conntrack: map the interfaces of zone VRFs to their conntrack zone Stefan Hanreich
2026-11-19 19:45 ` [PATCH pve-network 04/14] sdn: simple: SNAT via the uplinks of zone VRFs Stefan Hanreich
2026-11-19 19:45 ` [PATCH pve-network 05/14] sdn: zones: assign a conntrack zone to zones with a dedicated VRF Stefan Hanreich
2026-11-19 19:45 ` [PATCH proxmox-firewall 06/14] firewall: apply vnet rules to host traffic from vnets in a VRF Stefan Hanreich
2026-11-19 19:45 ` [PATCH proxmox-firewall 07/14] nftables: expression: add a constructor for map lookups Stefan Hanreich
2026-11-19 19:45 ` [PATCH proxmox-firewall 08/14] nftables: statement: add a helper for setting the conntrack zone Stefan Hanreich
2026-11-19 19:45 ` [PATCH proxmox-firewall 09/14] nftables: expression: convert the conntrack zones of zone VRFs Stefan Hanreich
2026-11-19 19:45 ` [PATCH proxmox-firewall 10/14] firewall: add a command applying " Stefan Hanreich
2026-11-19 19:45 ` [PATCH proxmox-firewall 11/14] firewall: put guest traffic of zone VRFs into their conntrack zone Stefan Hanreich
2026-11-19 19:45 ` [PATCH pve-manager 12/14] network: apply the conntrack zones of zone VRFs Stefan Hanreich
2026-11-19 19:45 ` [PATCH pve-manager 13/14] network: warn if pve-firewall cannot isolate guests in " Stefan Hanreich
2026-11-19 19:45 ` [PATCH pve-docs 14/14] pvesdn: simple zones: document dedicated VRFs Stefan Hanreich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261119194547.674512-1-s.hanreich@proxmox.com \
--to=s.hanreich@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.