From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 234FF1FF0DA for ; Thu, 19 Nov 2026 20:47:08 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 90BD02189D; Thu, 19 Nov 2026 20:46:23 +0100 (CET) From: Stefan Hanreich 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 Message-ID: <20261119194547.674512-1-s.hanreich@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1795117556709 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.182 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_CSS_A 0.1 Contains URL's A record listed in the Spamhaus CSS blocklist [23.95.107.30] Message-ID-Hash: FHXXO7EY4U57FC3ZDPJYSSEP6BDMJZPB X-Message-ID-Hash: FHXXO7EY4U57FC3ZDPJYSSEP6BDMJZPB X-MailFrom: s.hanreich@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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