all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH common/manager/network/proxmox{-ve-rs,-perl-rs,-widget-toolkit} v3 00/32] SDN VRF support
@ 2026-11-16 16:11 Gabriel Goller
  2026-11-16 16:11 ` [PATCH pve-common v3 01/32] interfaces: preserve VRF membership across address family changes Gabriel Goller
                   ` (33 more replies)
  0 siblings, 34 replies; 65+ messages in thread
From: Gabriel Goller @ 2026-11-16 16:11 UTC (permalink / raw)
  To: pve-devel

This series adds VRF support to SDN zones and fabrics.

A simple zone can now use either the default VRF or a dedicated VRF. The
simple zone dialog has a checkbox for this and uses the default VRF by
default. If the checkbox is disabled, the zone creates a dedicated VRF named
`vrf_<zone-name>`. EVPN zones always create a dedicated VRF. BGP and OSPF
fabrics can select a zone and run inside its VRF.

This is the second iteration. The first iteration added VRFs as a separate
SDN object with a distinct GUI subdirectory. This was scrapped because VRFs
are an implementation detail and should not be exposed on their own in the
GUI. Zones already provide a logical L3 building block and should map to VRFs
instead.

Route leaking between VRFs partly depends on the following FRR change, so it
will come a bit later: https://github.com/FRRouting/frr/pull/22426

This version fixes DHCP (moving dnsmasq daemon to vrf) and the SNAT (adding
iptable rules with a zone id). Mostly I'd like these two things to be looked
at, as I'm not sure about the design.

As always, thanks to Stefan Hanreich for his help.

Changelog:
v2: (thanks @Stefan)
 * allow interfaces to be added to vrfs
 * allow static routes to be configured on vrfs
 * fix ospf vrf statistics
 * fix dhcp
 * fix snat

RFC (v1):
 * rebase


pve-common:

Gabriel Goller (1):
  interfaces: preserve VRF membership across address family changes

 src/PVE/Network/Interfaces.pm | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)


proxmox-ve-rs:

Gabriel Goller (7):
  frr: add VRF-aware OSPF rendering
  sdn: add zone references to OSPF and BGP fabrics
  sdn: generate fabric routing configuration in zone VRFs
  sdn: fix VRF route-map scoping and zone ID validation
  tests: fabrics: add test for fabrics in VRFs
  sdn: allow static routes in simple zone VRFs
  sdn: support static routes in EVPN zone VRFs

 proxmox-frr-templates/templates/bgpd.jinja    |   7 +-
 proxmox-frr-templates/templates/fabricd.jinja |   2 +-
 .../templates/frr.conf.jinja                  |   3 +-
 .../templates/interface.jinja                 |   6 +-
 .../templates/ip_routes.jinja                 |  13 +-
 proxmox-frr-templates/templates/isisd.jinja   |   2 +-
 proxmox-frr-templates/templates/ospfd.jinja   |  12 +-
 .../templates/protocol_routemaps.jinja        |  13 +
 proxmox-frr/src/ser/mod.rs                    |  33 ++-
 proxmox-ve-config/src/sdn/fabric/frr.rs       | 146 +++++++----
 proxmox-ve-config/src/sdn/fabric/mod.rs       |  40 ++-
 .../src/sdn/fabric/section_config/fabric.rs   |  29 ++-
 .../sdn/fabric/section_config/protocol/bgp.rs |  11 +-
 .../fabric/section_config/protocol/ospf.rs    |  11 +-
 proxmox-ve-config/src/sdn/mod.rs              |   1 +
 proxmox-ve-config/src/sdn/static_route.rs     | 147 +++++++++++
 .../tests/fabric/cfg/vrf/fabrics.cfg          |  43 ++++
 .../tests/fabric/cfg/vrf/route-maps.cfg       |  15 ++
 proxmox-ve-config/tests/fabric/helper.rs      |  20 ++
 proxmox-ve-config/tests/fabric/main.rs        | 233 +++++++++++++++++-
 .../fabric/snapshots/fabric__vrf_pve.snap     | 134 ++++++++++
 .../tests/static_routes/cfg/fabrics.cfg       |  19 ++
 .../tests/static_routes/cfg/zones.json        |  20 ++
 proxmox-ve-config/tests/static_routes/main.rs | 203 +++++++++++++++
 ...tatic_routes__evpn_zone_routes_to_frr.snap |  12 +
 ...c_routes__preserve_legacy_evpn_routes.snap |  12 +
 ...tatic_routes__simple_zone_routes_pve1.snap |  20 ++
 ...tatic_routes__simple_zone_routes_pve2.snap |  10 +
 ...outes__vrf_fabrics_with_static_routes.snap |  70 ++++++
 29 files changed, 1215 insertions(+), 72 deletions(-)
 create mode 100644 proxmox-ve-config/src/sdn/static_route.rs
 create mode 100644 proxmox-ve-config/tests/fabric/cfg/vrf/fabrics.cfg
 create mode 100644 proxmox-ve-config/tests/fabric/cfg/vrf/route-maps.cfg
 create mode 100644 proxmox-ve-config/tests/fabric/snapshots/fabric__vrf_pve.snap
 create mode 100644 proxmox-ve-config/tests/static_routes/cfg/fabrics.cfg
 create mode 100644 proxmox-ve-config/tests/static_routes/cfg/zones.json
 create mode 100644 proxmox-ve-config/tests/static_routes/main.rs
 create mode 100644 proxmox-ve-config/tests/static_routes/snapshots/static_routes__evpn_zone_routes_to_frr.snap
 create mode 100644 proxmox-ve-config/tests/static_routes/snapshots/static_routes__preserve_legacy_evpn_routes.snap
 create mode 100644 proxmox-ve-config/tests/static_routes/snapshots/static_routes__simple_zone_routes_pve1.snap
 create mode 100644 proxmox-ve-config/tests/static_routes/snapshots/static_routes__simple_zone_routes_pve2.snap
 create mode 100644 proxmox-ve-config/tests/static_routes/snapshots/static_routes__vrf_fabrics_with_static_routes.snap


proxmox-perl-rs:

Gabriel Goller (5):
  pve-rs: fabrics: assign network interfaces to configured VRFs
  pve-rs: fabrics: make per-fabric status queries VRF-aware
  pve-rs: fabrics: include VRF routes in aggregate status
  pve-rs: fabrics: expose host interface membership
  sdn: expose static routes for simple zone uplinks

 pve-rs/src/bindings/sdn/fabrics.rs | 369 +++++++++++++++++++----------
 pve-rs/src/bindings/sdn/mod.rs     |  19 +-
 pve-rs/src/sdn/status.rs           | 149 +++++++++---
 3 files changed, 389 insertions(+), 148 deletions(-)


pve-network:

Gabriel Goller (12):
  sdn: evpn: add unreachable IPv6 default route to zone VRFs
  sdn: add optional VRFs for simple zones
  sdn: allow fabrics to use simple zone VRFs
  sdn: require underlay fabrics to use the default VRF
  sdn: always generate EVPN zone VRFs
  api: sdn: allow EVPN zones as fabric VRFs
  api: sdn: disallow BGP fabrics in EVPN zone VRFs
  sdn: simple: support static routes in zone routing tables
  sdn: evpn: allow static routes
  sdn: zones: SNAT via dedicated uplinks in zone VRFs
  sdn: dhcp: only configure DHCP for zones on the local node
  sdn: dhcp: run dnsmasq in the zone VRF

 src/PVE/API2/Network/SDN/Fabrics/Fabric.pm    |  59 ++++-
 .../API2/Network/SDN/Fabrics/FabricNode.pm    |  18 ++
 src/PVE/API2/Network/SDN/Zones.pm             |  43 ++++
 src/PVE/Network/SDN.pm                        |  23 +-
 src/PVE/Network/SDN/Controllers/BgpPlugin.pm  |   2 +-
 src/PVE/Network/SDN/Controllers/EvpnPlugin.pm |   2 +
 src/PVE/Network/SDN/Dhcp.pm                   |  14 +-
 src/PVE/Network/SDN/Dhcp/Dnsmasq.pm           |  59 ++++-
 src/PVE/Network/SDN/Fabrics.pm                |  36 +++
 src/PVE/Network/SDN/Zones.pm                  |  20 +-
 src/PVE/Network/SDN/Zones/EvpnPlugin.pm       |  89 ++++---
 src/PVE/Network/SDN/Zones/Plugin.pm           | 229 +++++++++++++++++-
 src/PVE/Network/SDN/Zones/SimplePlugin.pm     |  79 ++++--
 src/PVE/Network/SDN/Zones/VxlanPlugin.pm      |   5 +
 src/test/Makefile                             |   5 +-
 src/test/run_test_static_routes.pl            | 217 +++++++++++++++++
 src/test/run_test_zones.pl                    |   4 +-
 .../expected_controller_config                |   6 +
 .../advertise_subnets/expected_sdn_interfaces |   1 +
 .../zones/evpn/advertise_subnets/sdn_config   |   8 +-
 .../evpn/auto_mode/expected_sdn_interfaces    |   1 +
 .../evpn/bgp_ebgp/expected_sdn_interfaces     |   1 +
 .../bgp_ebgp_multihop/expected_sdn_interfaces |   1 +
 .../expected_sdn_interfaces                   |   1 +
 .../expected_sdn_interfaces                   |   1 +
 .../evpn/bgp_fabric/expected_sdn_interfaces   |   1 +
 .../evpn/bgp_loopback/expected_sdn_interfaces |   1 +
 .../expected_sdn_interfaces                   |   1 +
 .../combined_bgp_isis/expected_sdn_interfaces |   1 +
 .../expected_sdn_interfaces                   |   1 +
 .../zones/evpn/ebgp/expected_sdn_interfaces   |   1 +
 .../expected_sdn_interfaces                   |   1 +
 .../expected_sdn_interfaces                   |   1 +
 .../expected_sdn_interfaces                   |   2 +
 .../ebgp_loopback/expected_sdn_interfaces     |   1 +
 .../expected_sdn_interfaces                   |   1 +
 .../expected_sdn_interfaces                   |   2 +
 .../evpn/exitnode/expected_sdn_interfaces     |   1 +
 .../expected_sdn_interfaces                   |   1 +
 .../expected_sdn_interfaces                   |   1 +
 .../exitnode_primary/expected_sdn_interfaces  |   1 +
 .../exitnode_snat/expected_sdn_interfaces     |   1 +
 .../expected_controller_config                |  79 ++++++
 .../expected_sdn_interfaces                   |  73 ++++++
 .../evpn/exitnode_snat_vrf_uplink/interfaces  |  16 ++
 .../evpn/exitnode_snat_vrf_uplink/sdn_config  |  42 ++++
 .../exitnodenullroute/expected_sdn_interfaces |   2 +
 .../frr_local_merge/expected_sdn_interfaces   |   1 +
 .../expected_sdn_interfaces                   |   1 +
 .../zones/evpn/ipv4/expected_sdn_interfaces   |   1 +
 .../evpn/ipv4ipv6/expected_sdn_interfaces     |   1 +
 .../ipv4ipv6nogateway/expected_sdn_interfaces |   1 +
 .../zones/evpn/ipv6/expected_sdn_interfaces   |   1 +
 .../evpn/ipv6underlay/expected_sdn_interfaces |   1 +
 .../zones/evpn/isis/expected_sdn_interfaces   |   1 +
 .../isis_loopback/expected_sdn_interfaces     |   1 +
 .../multipath_relax/expected_sdn_interfaces   |   1 +
 .../multiplezones/expected_sdn_interfaces     |   2 +
 .../openfabric_fabric/expected_sdn_interfaces |   1 +
 .../expected_sdn_interfaces                   |   1 +
 .../expected_sdn_interfaces                   |   1 +
 .../evpn/ospf_fabric/expected_sdn_interfaces  |   1 +
 .../evpn/routemap/expected_sdn_interfaces     |   1 +
 .../expected_sdn_interfaces                   |   1 +
 .../expected_sdn_interfaces                   |   1 +
 .../evpn/rt_import/expected_sdn_interfaces    |   1 +
 .../evpn/vrf-empty/expected_sdn_interfaces    |   7 +
 src/test/zones/evpn/vrf-empty/interfaces      |   2 +
 src/test/zones/evpn/vrf-empty/sdn_config      |  13 +
 .../evpn/vxlanport/expected_sdn_interfaces    |   1 +
 .../hetzner-vrf/expected_sdn_interfaces       |  27 +++
 src/test/zones/simple/hetzner-vrf/interfaces  |   6 +
 src/test/zones/simple/hetzner-vrf/sdn_config  |  34 +++
 .../simple/vrf-empty/expected_sdn_interfaces  |   7 +
 src/test/zones/simple/vrf-empty/interfaces    |   2 +
 src/test/zones/simple/vrf-empty/sdn_config    |  12 +
 .../zones/simple/vrf/expected_sdn_interfaces  |  14 ++
 src/test/zones/simple/vrf/interfaces          |   2 +
 src/test/zones/simple/vrf/sdn_config          |  17 ++
 .../vrf_snat_uplink/expected_sdn_interfaces   |  92 +++++++
 .../zones/simple/vrf_snat_uplink/interfaces   |  26 ++
 .../zones/simple/vrf_snat_uplink/sdn_config   |  84 +++++++
 82 files changed, 1443 insertions(+), 78 deletions(-)
 create mode 100644 src/test/run_test_static_routes.pl
 create mode 100644 src/test/zones/evpn/exitnode_snat_vrf_uplink/expected_controller_config
 create mode 100644 src/test/zones/evpn/exitnode_snat_vrf_uplink/expected_sdn_interfaces
 create mode 100644 src/test/zones/evpn/exitnode_snat_vrf_uplink/interfaces
 create mode 100644 src/test/zones/evpn/exitnode_snat_vrf_uplink/sdn_config
 create mode 100644 src/test/zones/evpn/vrf-empty/expected_sdn_interfaces
 create mode 100644 src/test/zones/evpn/vrf-empty/interfaces
 create mode 100644 src/test/zones/evpn/vrf-empty/sdn_config
 create mode 100644 src/test/zones/simple/hetzner-vrf/expected_sdn_interfaces
 create mode 100644 src/test/zones/simple/hetzner-vrf/interfaces
 create mode 100644 src/test/zones/simple/hetzner-vrf/sdn_config
 create mode 100644 src/test/zones/simple/vrf-empty/expected_sdn_interfaces
 create mode 100644 src/test/zones/simple/vrf-empty/interfaces
 create mode 100644 src/test/zones/simple/vrf-empty/sdn_config
 create mode 100644 src/test/zones/simple/vrf/expected_sdn_interfaces
 create mode 100644 src/test/zones/simple/vrf/interfaces
 create mode 100644 src/test/zones/simple/vrf/sdn_config
 create mode 100644 src/test/zones/simple/vrf_snat_uplink/expected_sdn_interfaces
 create mode 100644 src/test/zones/simple/vrf_snat_uplink/interfaces
 create mode 100644 src/test/zones/simple/vrf_snat_uplink/sdn_config


proxmox-widget-toolkit:

Gabriel Goller (1):
  ui: network: allow selecting a VRF for host interfaces

 src/node/NetworkEdit.js | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)


pve-manager:

Gabriel Goller (6):
  ui: sdn: add VRF zone selection for fabrics
  ui: sdn: expose EVPN zones as fabric VRFs
  network: allow setting the VRF of host interfaces
  ui: sdn: allow static routes for Simple zone VRFs
  ui: sdn: allow static routes in EVPN zones
  network: generate SDN DHCP config after ifreload

 PVE/API2/Network.pm                    |  46 +++--
 bin/pve-sdn-commit                     |   5 +-
 www/manager6/Makefile                  |   1 +
 www/manager6/Toolkit.js                |   2 +-
 www/manager6/form/SDNZoneSelector.js   |  64 ++++++-
 www/manager6/node/Config.js            |  12 ++
 www/manager6/sdn/StaticRoutes.js       | 246 +++++++++++++++++++++++++
 www/manager6/sdn/fabrics/FabricEdit.js |  18 ++
 www/manager6/sdn/zones/Base.js         |  40 +++-
 www/manager6/sdn/zones/EvpnEdit.js     |   2 +
 www/manager6/sdn/zones/SimpleEdit.js   |  11 ++
 11 files changed, 429 insertions(+), 18 deletions(-)
 create mode 100644 www/manager6/sdn/StaticRoutes.js


Summary over all repositories:
  127 files changed, 3499 insertions(+), 317 deletions(-)

-- 
Generated by murpp 0.11.0




^ permalink raw reply	[flat|nested] 65+ messages in thread

* [PATCH pve-common v3 01/32] interfaces: preserve VRF membership across address family changes
  2026-11-16 16:11 [PATCH common/manager/network/proxmox{-ve-rs,-perl-rs,-widget-toolkit} v3 00/32] SDN VRF support Gabriel Goller
@ 2026-11-16 16:11 ` Gabriel Goller
  2026-11-18 14:13   ` Stefan Hanreich
  2026-11-16 16:11 ` [PATCH proxmox-ve-rs v3 02/32] frr: add VRF-aware OSPF rendering Gabriel Goller
                   ` (32 subsequent siblings)
  33 siblings, 1 reply; 65+ messages in thread
From: Gabriel Goller @ 2026-11-16 16:11 UTC (permalink / raw)
  To: pve-devel

Store VRF membership as an interface option, not an address family
option. Otherwise, switching from IPv4 to IPv6-only can drop the VRF
assignment when the IPv4 stanza is removed.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
 src/PVE/Network/Interfaces.pm | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/PVE/Network/Interfaces.pm b/src/PVE/Network/Interfaces.pm
index 8aed1ab3c473..bfaab278d556 100644
--- a/src/PVE/Network/Interfaces.pm
+++ b/src/PVE/Network/Interfaces.pm
@@ -134,7 +134,7 @@ my $check_mtu = sub($ifaces, $parent, $child) {
 #       gateway6 => IP,
 #       comments6 => [ "..." ],
 #
-#       <known options>, # like bridge_ports, ovs_*
+#       <known options>, # interface-wide (shared by inet/inet6): bridge_ports, ovs_*, vrf
 #
 #       # extra/unknown options stored by-family:
 #       options => { <inet options>... }
@@ -226,6 +226,7 @@ sub __read_etc_network_interfaces($fh, $ip_links = undef, $active_ifaces = undef
 
                     my $simple_options = {
                         'mtu' => 1,
+                        'vrf' => 1,
                         'ovs_type' => 1,
                         'ovs_options' => 1,
                         'ovs_bridge' => 1,
@@ -904,6 +905,7 @@ sub __write_etc_network_interfaces($config, $ifupdown2 = undef) {
             $n->{autostart} = 1;
 
             die "bond '$iface' - unable to find slave '$p'\n" if !$n;
+            die "bond '$iface' - slave '$p' cannot have a VRF master\n" if $n->{vrf};
             die
                 "bond '$iface' - wrong interface type on slave '$p' ('$n->{type}' != 'eth or bond')\n"
                 if ($n->{type} ne 'eth' && $n->{type} ne 'bond');
@@ -1027,6 +1029,7 @@ sub __write_etc_network_interfaces($config, $ifupdown2 = undef) {
                 }
                 my $n = $ifaces_copy->{$p};
                 die "bridge '$iface' - unable to find bridge port '$p'\n" if !$n;
+                die "bridge '$iface' - port '$p' cannot have a VRF master\n" if $n->{vrf};
                 die "iface $p - ip address can't be set on interface if bridged in $iface\n"
                     if ($n->{method} && $n->{method} eq 'static' && $n->{address} ne '0.0.0.0')
                     || ($n->{method6} && $n->{method6} eq 'static' && $n->{address6} ne '::');
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 65+ messages in thread

* [PATCH proxmox-ve-rs v3 02/32] frr: add VRF-aware OSPF rendering
  2026-11-16 16:11 [PATCH common/manager/network/proxmox{-ve-rs,-perl-rs,-widget-toolkit} v3 00/32] SDN VRF support Gabriel Goller
  2026-11-16 16:11 ` [PATCH pve-common v3 01/32] interfaces: preserve VRF membership across address family changes Gabriel Goller
@ 2026-11-16 16:11 ` Gabriel Goller
  2026-11-18 14:41   ` Stefan Hanreich
  2026-11-16 16:11 ` [PATCH proxmox-ve-rs v3 03/32] sdn: add zone references to OSPF and BGP fabrics Gabriel Goller
                   ` (31 subsequent siblings)
  33 siblings, 1 reply; 65+ messages in thread
From: Gabriel Goller @ 2026-11-16 16:11 UTC (permalink / raw)
  To: pve-devel

Add an optional VRF name and render it in the FRR interface declaration.
Keep OSPF router configuration for custom VRFs separately from the
router in the default routing table (like we do with BGP).

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
 proxmox-frr-templates/templates/fabricd.jinja   |  2 +-
 proxmox-frr-templates/templates/interface.jinja |  6 +++++-
 proxmox-frr-templates/templates/isisd.jinja     |  2 +-
 proxmox-frr-templates/templates/ospfd.jinja     | 12 +++++++++++-
 proxmox-frr/src/ser/mod.rs                      |  6 ++++++
 5 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/proxmox-frr-templates/templates/fabricd.jinja b/proxmox-frr-templates/templates/fabricd.jinja
index 068959a97e0e..04283180679e 100644
--- a/proxmox-frr-templates/templates/fabricd.jinja
+++ b/proxmox-frr-templates/templates/fabricd.jinja
@@ -6,7 +6,7 @@ router openfabric {{ router_name }}
 exit
 {% endfor %}
 {% for interface_name, interface_config in openfabric.interfaces|items %}
-{% call interface(interface_name, interface_config.addresses_v4, interface_config.addresses_v6) %}
+{% call interface(interface_name, interface_config.addresses_v4, interface_config.addresses_v6, interface_config.vrf) %}
 {% if interface_config.fabric_id and interface_config.is_ipv4 %}
  ip router openfabric {{ interface_config.fabric_id }}
 {% endif %}
diff --git a/proxmox-frr-templates/templates/interface.jinja b/proxmox-frr-templates/templates/interface.jinja
index 4c5014844fc8..e52b05681bb8 100644
--- a/proxmox-frr-templates/templates/interface.jinja
+++ b/proxmox-frr-templates/templates/interface.jinja
@@ -1,6 +1,10 @@
-{% macro interface(name, addresses_v4, addresses_v6) %}
+{% macro interface(name, addresses_v4, addresses_v6, vrf) %}
 !
+{% if vrf %}
+interface {{ name }} vrf {{ vrf }}
+{% else %}
 interface {{ name }}
+{% endif %}
 {% for address in addresses_v6 %}
  ipv6 address {{address}}
 {% endfor %}
diff --git a/proxmox-frr-templates/templates/isisd.jinja b/proxmox-frr-templates/templates/isisd.jinja
index e3c9292d575c..2d369d75eee6 100644
--- a/proxmox-frr-templates/templates/isisd.jinja
+++ b/proxmox-frr-templates/templates/isisd.jinja
@@ -20,7 +20,7 @@ router isis {{ router_name }}
 exit
 {% endfor %}
 {% for interface_name, interface_config in isis.interfaces|items %}
-{% call interface(interface_name, interface_config.addresses_v4, interface_config.addresses_v6) %}
+{% call interface(interface_name, interface_config.addresses_v4, interface_config.addresses_v6, interface_config.vrf) %}
 {% if interface_config.domain and interface_config.is_ipv4 %}
  ip router isis {{ interface_config.domain }}
 {% endif %}
diff --git a/proxmox-frr-templates/templates/ospfd.jinja b/proxmox-frr-templates/templates/ospfd.jinja
index 427ed7f9ddb4..5d440f2ff663 100644
--- a/proxmox-frr-templates/templates/ospfd.jinja
+++ b/proxmox-frr-templates/templates/ospfd.jinja
@@ -9,8 +9,18 @@ router ospf
 {% endfor %}
 exit
 {% endif %}
+{% for vrf_name, router in ospf.vrf_router|items %}
+!
+router ospf vrf {{ vrf_name }}
+ ospf router-id {{ router.router_id }}
+{% for redistribution in router.redistribute %}
+ redistribute {{ redistribution.source }}{% if redistribution.metric is defined %} metric {{ redistribution.metric }}{% endif %}{% if redistribution.route_map is defined %} route-map {{ redistribution.route_map }}{% endif %}
+
+{% endfor %}
+exit
+{% endfor %}
 {% for interface_name, interface_config in ospf.interfaces|items %}
-{% call interface(interface_name, interface_config.addresses_v4, interface_config.addresses_v6) %}
+{% call interface(interface_name, interface_config.addresses_v4, interface_config.addresses_v6, interface_config.vrf) %}
  ip ospf area {{ interface_config.area }}
 {% if interface_config.passive %}
  ip ospf passive
diff --git a/proxmox-frr/src/ser/mod.rs b/proxmox-frr/src/ser/mod.rs
index 0f2b52138cf3..cd3025213fb9 100644
--- a/proxmox-frr/src/ser/mod.rs
+++ b/proxmox-frr/src/ser/mod.rs
@@ -135,6 +135,8 @@ pub struct Interface<T> {
     pub addresses_v4: Vec<Ipv4Cidr>,
     #[serde(default)]
     pub addresses_v6: Vec<Ipv6Cidr>,
+    #[serde(default)]
+    pub vrf: Option<VrfName>,
 
     #[serde(flatten)]
     pub properties: T,
@@ -144,6 +146,7 @@ impl From<openfabric::OpenfabricInterface> for Interface<openfabric::OpenfabricI
         Interface {
             addresses_v4: Vec::new(),
             addresses_v6: Vec::new(),
+            vrf: None,
             properties: value,
         }
     }
@@ -154,6 +157,7 @@ impl From<ospf::OspfInterface> for Interface<ospf::OspfInterface> {
         Interface {
             addresses_v4: Vec::new(),
             addresses_v6: Vec::new(),
+            vrf: None,
             properties: value,
         }
     }
@@ -248,6 +252,8 @@ pub struct OspfFrrConfig {
     #[serde(default)]
     pub router: Option<ospf::OspfRouter>,
     #[serde(default)]
+    pub vrf_router: BTreeMap<VrfName, ospf::OspfRouter>,
+    #[serde(default)]
     pub interfaces: BTreeMap<InterfaceName, Interface<ospf::OspfInterface>>,
 }
 
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 65+ messages in thread

* [PATCH proxmox-ve-rs v3 03/32] sdn: add zone references to OSPF and BGP fabrics
  2026-11-16 16:11 [PATCH common/manager/network/proxmox{-ve-rs,-perl-rs,-widget-toolkit} v3 00/32] SDN VRF support Gabriel Goller
  2026-11-16 16:11 ` [PATCH pve-common v3 01/32] interfaces: preserve VRF membership across address family changes Gabriel Goller
  2026-11-16 16:11 ` [PATCH proxmox-ve-rs v3 02/32] frr: add VRF-aware OSPF rendering Gabriel Goller
@ 2026-11-16 16:11 ` Gabriel Goller
  2026-11-18 14:10   ` Stefan Hanreich
  2026-11-16 16:11 ` [PATCH proxmox-ve-rs v3 04/32] sdn: generate fabric routing configuration in zone VRFs Gabriel Goller
                   ` (30 subsequent siblings)
  33 siblings, 1 reply; 65+ messages in thread
From: Gabriel Goller @ 2026-11-16 16:11 UTC (permalink / raw)
  To: pve-devel

Allow OSPF and BGP fabrics to refer to an SDN zone. The zone provides
the VRF in which the fabric routing protocol will run. Support setting
and deleting the reference through the fabric update API.

Scope prefix overlap checks and OSPF area uniqueness by zone. Different
VRFs have independent routing tables, so they can reuse addresses and
OSPF areaas.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
 proxmox-ve-config/src/sdn/fabric/mod.rs       | 30 ++++++-
 .../src/sdn/fabric/section_config/fabric.rs   | 29 ++++++-
 .../sdn/fabric/section_config/protocol/bgp.rs | 11 ++-
 .../fabric/section_config/protocol/ospf.rs    | 11 ++-
 proxmox-ve-config/tests/fabric/main.rs        | 85 ++++++++++++++++++-
 5 files changed, 158 insertions(+), 8 deletions(-)

diff --git a/proxmox-ve-config/src/sdn/fabric/mod.rs b/proxmox-ve-config/src/sdn/fabric/mod.rs
index 79bb1fd91651..7c00a7b27a65 100644
--- a/proxmox-ve-config/src/sdn/fabric/mod.rs
+++ b/proxmox-ve-config/src/sdn/fabric/mod.rs
@@ -773,8 +773,8 @@ impl Validatable for FabricConfig {
     /// Ensures that:
     /// - (node, interface) combinations exist only once across all fabrics
     /// - every entry (fabric) validates
-    /// - all the ospf fabrics have different areas
-    /// - IP prefixes of fabrics do not overlap
+    /// - OSPF areas are unique within each VRF
+    /// - IP prefixes do not overlap within the same VRF
     fn validate(&self) -> Result<(), FabricConfigError> {
         let mut wireguard_interfaces = HashSet::new();
         let mut wireguard_listen_ports = HashSet::new();
@@ -789,6 +789,11 @@ impl Validatable for FabricConfig {
             .flat_map(|(i, f1)| fabrics.iter().skip(i + 1).map(move |f2| (f1, f2)));
 
         for (fabric1, fabric2) in cartesian_product {
+            // Separate VRFs have independent routing tables and may use overlapping address space.
+            if fabric1.zone() != fabric2.zone() {
+                continue;
+            }
+
             if let (Some(prefix1), Some(prefix2)) = (fabric1.ip_prefix(), fabric2.ip_prefix()) {
                 if prefix1.overlaps(&prefix2) {
                     return Err(FabricConfigError::OverlappingIp4Prefix(
@@ -815,13 +820,14 @@ impl Validatable for FabricConfig {
         // additionally, for wireguard check the listen ports of the interfaces as well
         for entry in self.fabrics.values() {
             if let FabricEntry::Ospf(entry) = entry {
-                if !ospf_area.insert(
+                if !ospf_area.insert((
+                    entry.fabric_section().properties().zone().cloned(),
                     entry
                         .fabric_section()
                         .properties()
                         .area()
                         .get_ipv4_representation(),
-                ) {
+                )) {
                     return Err(FabricConfigError::DuplicateOspfArea);
                 }
             }
@@ -1002,6 +1008,7 @@ impl FabricConfig {
                     ip6_prefix,
                     properties:
                         OspfPropertiesUpdater {
+                            zone,
                             area,
                             route_filter,
                             redistribute,
@@ -1017,6 +1024,10 @@ impl FabricConfig {
                     fabric_section.ip6_prefix = Some(prefix);
                 }
 
+                if let Some(zone) = zone {
+                    fabric_section.properties.zone = Some(zone);
+                }
+
                 if let Some(area) = area {
                     fabric_section.properties.area = area;
                 }
@@ -1037,6 +1048,9 @@ impl FabricConfig {
                         FabricDeletableProperties::Ip6Prefix => {
                             fabric_section.ip6_prefix = None;
                         }
+                        FabricDeletableProperties::Protocol(OspfDeletableProperties::Zone) => {
+                            fabric_section.properties.zone = None;
+                        }
                         FabricDeletableProperties::Protocol(
                             OspfDeletableProperties::RouteFilter,
                         ) => {
@@ -1100,6 +1114,7 @@ impl FabricConfig {
                     ip6_prefix,
                     properties:
                         BgpPropertiesUpdater {
+                            zone,
                             bfd,
                             redistribute,
                             route_map_in,
@@ -1117,6 +1132,10 @@ impl FabricConfig {
                     fabric_section.ip6_prefix = Some(prefix);
                 }
 
+                if let Some(zone) = zone {
+                    fabric_section.properties.zone = Some(zone);
+                }
+
                 if let Some(bfd) = bfd {
                     fabric_section.properties.bfd = bfd;
                 }
@@ -1145,6 +1164,9 @@ impl FabricConfig {
                         FabricDeletableProperties::Ip6Prefix => {
                             fabric_section.ip6_prefix = None;
                         }
+                        FabricDeletableProperties::Protocol(BgpDeletableProperties::Zone) => {
+                            fabric_section.properties.zone = None;
+                        }
                         FabricDeletableProperties::Protocol(
                             BgpDeletableProperties::Redistribute,
                         ) => {
diff --git a/proxmox-ve-config/src/sdn/fabric/section_config/fabric.rs b/proxmox-ve-config/src/sdn/fabric/section_config/fabric.rs
index 7e39e46a9341..a17bc8fd7cb2 100644
--- a/proxmox-ve-config/src/sdn/fabric/section_config/fabric.rs
+++ b/proxmox-ve-config/src/sdn/fabric/section_config/fabric.rs
@@ -41,6 +41,24 @@ api_string_type! {
 proxmox_serde::forward_serialize_to_display!(FabricId);
 proxmox_serde::forward_deserialize_to_from_str!(FabricId);
 
+pub const ZONE_ID_REGEX_STR: &str = r"(?:[a-zA-Z])(?:[a-zA-Z0-9]){0,7}";
+
+const_regex! {
+    pub ZONE_ID_REGEX = concatcp!(r"^", ZONE_ID_REGEX_STR, r"$");
+}
+
+pub const ZONE_ID_FORMAT: ApiStringFormat = ApiStringFormat::Pattern(&ZONE_ID_REGEX);
+
+api_string_type! {
+    /// ID of the SDN zone providing a VRF for a fabric.
+    #[api(format: &ZONE_ID_FORMAT)]
+    #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, UpdaterType)]
+    pub struct ZoneId(String);
+}
+
+proxmox_serde::forward_serialize_to_display!(ZoneId);
+proxmox_serde::forward_deserialize_to_from_str!(ZoneId);
+
 /// A fabric section in an SDN fabric config.
 ///
 /// This struct contains all the properties that are required for any fabric, regardless of
@@ -203,6 +221,15 @@ impl Fabric {
         }
     }
 
+    /// Get the SDN zone whose VRF contains this fabric.
+    pub fn zone(&self) -> Option<&ZoneId> {
+        match self {
+            Fabric::Ospf(fabric_section) => fabric_section.properties().zone(),
+            Fabric::Bgp(fabric_section) => fabric_section.properties().zone(),
+            Fabric::Openfabric(_) | Fabric::WireGuard(_) => None,
+        }
+    }
+
     /// Get the ip-prefix (IPv4 CIDR) of the [`Fabric`].
     ///
     /// This is a common property for all protocols.
@@ -260,7 +287,7 @@ impl Validatable for Fabric {
         match self {
             Fabric::Openfabric(fabric_section) => fabric_section.validate(),
             Fabric::Ospf(fabric_section) => fabric_section.validate(),
-            Fabric::WireGuard(_fabric_section) => Ok(()),
+            Fabric::WireGuard(_) => Ok(()),
             Fabric::Bgp(fabric_section) => fabric_section.validate(),
         }
     }
diff --git a/proxmox-ve-config/src/sdn/fabric/section_config/protocol/bgp.rs b/proxmox-ve-config/src/sdn/fabric/section_config/protocol/bgp.rs
index 9623730ab97d..3d300ff328a9 100644
--- a/proxmox-ve-config/src/sdn/fabric/section_config/protocol/bgp.rs
+++ b/proxmox-ve-config/src/sdn/fabric/section_config/protocol/bgp.rs
@@ -11,7 +11,7 @@ use proxmox_schema::{ApiStringFormat, Updater, api, property_string::PropertyStr
 
 use crate::common::valid::Validatable;
 use crate::sdn::fabric::FabricConfigError;
-use crate::sdn::fabric::section_config::fabric::FabricSection;
+use crate::sdn::fabric::section_config::fabric::{FabricSection, ZoneId};
 use crate::sdn::fabric::section_config::interface::InterfaceName;
 use crate::sdn::fabric::section_config::node::NodeSection;
 
@@ -94,6 +94,10 @@ impl ASN {
 #[derive(Debug, Clone, Serialize, Deserialize, Updater, Hash)]
 /// Properties for a BGP fabric.
 pub struct BgpProperties {
+    /// SDN zone whose VRF contains this fabric.
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub(crate) zone: Option<ZoneId>,
+
     /// enable BFD for this fabric
     #[serde(default, deserialize_with = "proxmox_serde::perl::deserialize_bool")]
     pub(crate) bfd: bool,
@@ -119,6 +123,10 @@ pub struct BgpProperties {
 }
 
 impl BgpProperties {
+    pub fn zone(&self) -> Option<&ZoneId> {
+        self.zone.as_ref()
+    }
+
     pub fn bfd(&self) -> bool {
         self.bfd
     }
@@ -140,6 +148,7 @@ impl Validatable for FabricSection<BgpProperties> {
 #[derive(Debug, Clone, Serialize, Deserialize)]
 #[serde(rename_all = "snake_case")]
 pub enum BgpDeletableProperties {
+    Zone,
     Redistribute,
     RouteFilter,
     RouteMapIn,
diff --git a/proxmox-ve-config/src/sdn/fabric/section_config/protocol/ospf.rs b/proxmox-ve-config/src/sdn/fabric/section_config/protocol/ospf.rs
index 26be07546964..0c84adb5b732 100644
--- a/proxmox-ve-config/src/sdn/fabric/section_config/protocol/ospf.rs
+++ b/proxmox-ve-config/src/sdn/fabric/section_config/protocol/ospf.rs
@@ -10,7 +10,7 @@ use proxmox_schema::{ApiStringFormat, Updater, api, property_string::PropertyStr
 
 use crate::common::valid::Validatable;
 use crate::sdn::fabric::FabricConfigError;
-use crate::sdn::fabric::section_config::fabric::FabricSection;
+use crate::sdn::fabric::section_config::fabric::{FabricSection, ZoneId};
 use crate::sdn::fabric::section_config::interface::InterfaceName;
 use crate::sdn::fabric::section_config::node::NodeSection;
 
@@ -99,6 +99,10 @@ mod frr {
 #[derive(Debug, Clone, Serialize, Deserialize, Updater, Hash)]
 /// Properties for an Ospf fabric.
 pub struct OspfProperties {
+    /// SDN zone whose VRF contains this fabric.
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub(crate) zone: Option<ZoneId>,
+
     /// OSPF area
     pub(crate) area: Area,
 
@@ -115,6 +119,10 @@ pub struct OspfProperties {
 }
 
 impl OspfProperties {
+    pub fn zone(&self) -> Option<&ZoneId> {
+        self.zone.as_ref()
+    }
+
     pub fn set_area(&mut self, value: Area) {
         self.area = value;
     }
@@ -151,6 +159,7 @@ impl Validatable for FabricSection<OspfProperties> {
 #[derive(Debug, Clone, Serialize, Deserialize)]
 #[serde(rename_all = "snake_case")]
 pub enum OspfDeletableProperties {
+    Zone,
     RouteFilter,
     Redistribute,
 }
diff --git a/proxmox-ve-config/tests/fabric/main.rs b/proxmox-ve-config/tests/fabric/main.rs
index ee59e9a2ea44..aa76adb9819f 100644
--- a/proxmox-ve-config/tests/fabric/main.rs
+++ b/proxmox-ve-config/tests/fabric/main.rs
@@ -5,7 +5,12 @@ use std::str::FromStr;
 use proxmox_frr::ser::bgp::{AddressFamilies, BgpRouter, CommonAddressFamilyOptions, L2vpnEvpnAF};
 use proxmox_frr::ser::{FrrConfig, VrfName, serializer::dump};
 use proxmox_ve_config::sdn::fabric::{
-    FabricConfig, frr::build_fabric, section_config::node::NodeId,
+    FabricConfig,
+    frr::build_fabric,
+    section_config::{
+        fabric::{FabricId, FabricUpdater},
+        node::NodeId,
+    },
 };
 
 mod helper;
@@ -165,6 +170,84 @@ fn openfabric_ipv6_only() {
     insta::assert_snapshot!(helper::reference_name!("pve"), output);
 }
 
+#[test]
+fn vrf_prefix_overlap_is_scoped_by_zone() {
+    let raw = r#"
+ospf_fabric: first
+        area 0
+        ip_prefix 10.0.0.0/24
+        zone zoneone
+
+ospf_fabric: second
+        area 1
+        ip_prefix 10.0.0.0/24
+        zone zonetwo
+
+ospf_node: first_pve
+        interfaces name=eth0
+        ip 10.0.0.1
+
+ospf_node: second_pve
+        interfaces name=eth1
+        ip 10.0.0.1
+"#;
+
+    assert!(FabricConfig::parse_section_config(raw).is_ok());
+    assert!(
+        FabricConfig::parse_section_config(&raw.replace("zone zonetwo", "zone zoneone")).is_err()
+    );
+}
+
+#[test]
+fn update_protocol_zone() {
+    for (protocol, raw) in [
+        (
+            "ospf",
+            r#"
+ospf_fabric: test
+        area 0
+        ip_prefix 10.0.0.0/24
+"#,
+        ),
+        (
+            "bgp",
+            r#"
+bgp_fabric: test
+        bfd 0
+        ip_prefix 10.0.0.0/24
+"#,
+        ),
+    ] {
+        let mut config = FabricConfig::parse_section_config(raw)
+            .unwrap()
+            .into_inner();
+        let updater: FabricUpdater =
+            serde_json::from_value(serde_json::json!({ "protocol": protocol, "zone": "myzone" }))
+                .unwrap();
+        let id = FabricId::from_str("test").unwrap();
+
+        config.update_fabric(&id, updater).unwrap();
+        assert_eq!(
+            config
+                .get_fabric(&id)
+                .unwrap()
+                .fabric()
+                .zone()
+                .unwrap()
+                .as_str(),
+            "myzone"
+        );
+
+        let updater: FabricUpdater = serde_json::from_value(serde_json::json!({
+            "protocol": protocol,
+            "delete": ["zone"],
+        }))
+        .unwrap();
+        config.update_fabric(&id, updater).unwrap();
+        assert!(config.get_fabric(&id).unwrap().fabric().zone().is_none());
+    }
+}
+
 #[test]
 fn bgp_default() {
     let config = FabricConfig::parse_section_config(helper::get_fabrics_config!()).unwrap();
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 65+ messages in thread

* [PATCH proxmox-ve-rs v3 04/32] sdn: generate fabric routing configuration in zone VRFs
  2026-11-16 16:11 [PATCH common/manager/network/proxmox{-ve-rs,-perl-rs,-widget-toolkit} v3 00/32] SDN VRF support Gabriel Goller
                   ` (2 preceding siblings ...)
  2026-11-16 16:11 ` [PATCH proxmox-ve-rs v3 03/32] sdn: add zone references to OSPF and BGP fabrics Gabriel Goller
@ 2026-11-16 16:11 ` Gabriel Goller
  2026-11-18 14:53   ` Stefan Hanreich
  2026-11-16 16:11 ` [PATCH proxmox-ve-rs v3 05/32] sdn: fix VRF route-map scoping and zone ID validation Gabriel Goller
                   ` (29 subsequent siblings)
  33 siblings, 1 reply; 65+ messages in thread
From: Gabriel Goller @ 2026-11-16 16:11 UTC (permalink / raw)
  To: pve-devel

Map a fabric zone to the corresponding vrf_<zone> FRR instance. Generate
OSPF routers and interfaces in that VRF, and store BGP routers under the
same VRF name. Keep fabrics without a zone in the default routing table.

Collect OSPF redistribution rules on the router for the selected VRF so
that several fabrics in one VRF contribute to the same OSPF instance.
This keeps protocol configuration and interface configuration in the
routing table selected by the zone.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
 proxmox-ve-config/src/sdn/fabric/frr.rs | 89 ++++++++++++++++++-------
 proxmox-ve-config/src/sdn/fabric/mod.rs | 10 +++
 2 files changed, 74 insertions(+), 25 deletions(-)

diff --git a/proxmox-ve-config/src/sdn/fabric/frr.rs b/proxmox-ve-config/src/sdn/fabric/frr.rs
index d13cfbdf2e03..170ae38d38e5 100644
--- a/proxmox-ve-config/src/sdn/fabric/frr.rs
+++ b/proxmox-ve-config/src/sdn/fabric/frr.rs
@@ -1,3 +1,4 @@
+use std::collections::{BTreeMap, btree_map};
 use std::net::{IpAddr, Ipv4Addr};
 
 use tracing;
@@ -24,10 +25,13 @@ use crate::sdn::fabric::section_config::protocol::{
     openfabric::{OpenfabricInterfaceProperties, OpenfabricProperties},
     ospf::OspfInterfaceProperties,
 };
-use crate::sdn::fabric::section_config::{fabric::FabricId, node::NodeId};
+use crate::sdn::fabric::section_config::{
+    fabric::{FabricId, ZoneId},
+    node::NodeId,
+};
 use crate::sdn::fabric::{FabricConfig, FabricEntry};
 
-/// Constructs the FRR config from the the passed [`Valid<FabricConfig>`].
+/// Constructs the FRR config from the passed [`Valid<FabricConfig>`].
 ///
 /// Iterates over the [`FabricConfig`] and constructs all the FRR routers, interfaces, route-maps,
 /// etc.
@@ -37,7 +41,9 @@ pub fn build_fabric(
     frr_config: &mut FrrConfig,
 ) -> Result<(), anyhow::Error> {
     let mut routemap_seq = 100;
-    let mut current_router_id: Option<Ipv4Addr> = None;
+    // OSPF router IDs only need to be unique within a VRF, and node addresses are only unique
+    // within a VRF, so pick the router ID per VRF.
+    let mut ospf_router_ids: BTreeMap<VrfName, Ipv4Addr> = BTreeMap::new();
     let mut current_net: Option<Net> = None;
 
     for (fabric_id, entry) in config.into_inner().iter() {
@@ -199,31 +205,50 @@ pub fn build_fabric(
                     continue;
                 };
 
-                let router_id = current_router_id
-                    .get_or_insert(node.ip().expect("node must have an ipv4 address"));
-
                 let fabric = ospf_entry.fabric_section();
+                let vrf_name = fabric_vrf_name(fabric.properties().zone())?;
+
+                let router_id = ospf_router_ids
+                    .entry(vrf_name.clone())
+                    .or_insert(node.ip().expect("node must have an ipv4 address"));
 
                 let frr_word_area = ser::FrrWord::new(fabric.properties().area.to_string())?;
                 let frr_area = ser::ospf::Area::new(frr_word_area)?;
 
-                if frr_config.ospf.router.is_none() {
-                    let mut ospf_router = build_ospf_router(*router_id)?;
-
-                    ospf_router.redistribute = fabric
-                        .properties()
-                        .redistributions()
-                        .into_iter()
-                        .cloned()
-                        .map(OspfRedistribution::from)
-                        .collect();
+                let redistributions = fabric
+                    .properties()
+                    .redistributions()
+                    .into_iter()
+                    .cloned()
+                    .map(OspfRedistribution::from);
+
+                let ospf_router = if vrf_name == VrfName::Default {
+                    if frr_config.ospf.router.is_none() {
+                        frr_config.ospf.router = Some(build_ospf_router(*router_id)?);
+                    }
+                    frr_config
+                        .ospf
+                        .router
+                        .as_mut()
+                        .expect("router was inserted")
+                } else {
+                    match frr_config.ospf.vrf_router.entry(vrf_name.clone()) {
+                        btree_map::Entry::Occupied(entry) => entry.into_mut(),
+                        btree_map::Entry::Vacant(entry) => {
+                            entry.insert(build_ospf_router(*router_id)?)
+                        }
+                    }
+                };
+                ospf_router.redistribute.extend(redistributions);
 
-                    frr_config.ospf.router = Some(ospf_router);
-                }
+                let interface_vrf = match &vrf_name {
+                    VrfName::Default => None,
+                    custom => Some(custom.clone()),
+                };
 
                 // Add dummy interface
                 let (interface, interface_name) =
-                    build_ospf_dummy_interface(fabric_id, frr_area.clone())?;
+                    build_ospf_dummy_interface(fabric_id, frr_area.clone(), interface_vrf.clone())?;
 
                 if frr_config
                     .ospf
@@ -238,7 +263,7 @@ pub fn build_fabric(
 
                 for interface in node.properties().interfaces.iter() {
                     let (interface, interface_name) =
-                        build_ospf_interface(frr_area.clone(), interface)?;
+                        build_ospf_interface(frr_area.clone(), interface, interface_vrf.clone())?;
 
                     if frr_config
                         .ospf
@@ -305,6 +330,7 @@ pub fn build_fabric(
                 };
 
                 let fabric = bgp_entry.fabric_section();
+                let vrf_name = fabric_vrf_name(fabric.properties().zone())?;
 
                 let local_asn = properties.asn().as_u32();
 
@@ -319,7 +345,7 @@ pub fn build_fabric(
                 let local_as = frr_config
                     .bgp
                     .vrf_router
-                    .get(&VrfName::Default)
+                    .get(&vrf_name)
                     .filter(|existing| existing.asn != local_asn)
                     .map(|_| LocalAsSettings {
                         asn: local_asn,
@@ -554,10 +580,10 @@ pub fn build_fabric(
                     custom_frr_config: Default::default(),
                 };
 
-                if let Some(existing) = frr_config.bgp.vrf_router.get_mut(&VrfName::Default) {
+                if let Some(existing) = frr_config.bgp.vrf_router.get_mut(&vrf_name) {
                     existing.merge_fabric(router);
                 } else {
-                    frr_config.bgp.vrf_router.insert(VrfName::Default, router);
+                    frr_config.bgp.vrf_router.insert(vrf_name, router);
                 }
             }
         }
@@ -587,6 +613,13 @@ pub fn build_fabric(
     Ok(())
 }
 
+fn fabric_vrf_name(zone: Option<&ZoneId>) -> Result<VrfName, ser::FrrWordError> {
+    Ok(match zone {
+        Some(zone) => VrfName::Custom(FrrWord::new(format!("vrf_{zone}"))?),
+        None => VrfName::Default,
+    })
+}
+
 /// Helper that builds a OSPF router with a the router_id.
 fn build_ospf_router(router_id: Ipv4Addr) -> Result<OspfRouter, anyhow::Error> {
     Ok(OspfRouter::new(router_id))
@@ -607,6 +640,7 @@ fn build_openfabric_router(
 fn build_ospf_interface(
     area: ser::ospf::Area,
     interface: &OspfInterfaceProperties,
+    vrf: Option<VrfName>,
 ) -> Result<(Interface<OspfInterface>, InterfaceName), anyhow::Error> {
     let frr_interface = ser::ospf::OspfInterface {
         area,
@@ -625,13 +659,16 @@ fn build_ospf_interface(
     };
 
     let interface_name = interface.name.as_ref().try_into()?;
-    Ok((frr_interface.into(), interface_name))
+    let mut interface: Interface<OspfInterface> = frr_interface.into();
+    interface.vrf = vrf;
+    Ok((interface, interface_name))
 }
 
 /// Helper that builds the OSPF dummy interface using the [`FabricId`] and the [`ospf::Area`].
 fn build_ospf_dummy_interface(
     fabric_id: &FabricId,
     area: ospf::Area,
+    vrf: Option<VrfName>,
 ) -> Result<(Interface<OspfInterface>, InterfaceName), anyhow::Error> {
     let frr_interface = ser::ospf::OspfInterface {
         area,
@@ -639,7 +676,9 @@ fn build_ospf_dummy_interface(
         network_type: None,
     };
     let interface_name = format!("dummy_{}", fabric_id).try_into()?;
-    Ok((frr_interface.into(), interface_name))
+    let mut interface: Interface<OspfInterface> = frr_interface.into();
+    interface.vrf = vrf;
+    Ok((interface, interface_name))
 }
 
 /// Helper that builds the OpenFabric interface.
diff --git a/proxmox-ve-config/src/sdn/fabric/mod.rs b/proxmox-ve-config/src/sdn/fabric/mod.rs
index 7c00a7b27a65..dec9661ee4aa 100644
--- a/proxmox-ve-config/src/sdn/fabric/mod.rs
+++ b/proxmox-ve-config/src/sdn/fabric/mod.rs
@@ -541,6 +541,16 @@ impl FabricEntry {
             FabricEntry::Bgp(entry) => &mut entry.fabric,
         }
     }
+
+    pub fn fabric_vrf_name(&self) -> Option<String> {
+        let zone = match self {
+            FabricEntry::Ospf(entry) => entry.fabric_section().properties().zone(),
+            FabricEntry::Bgp(entry) => entry.fabric_section().properties().zone(),
+            FabricEntry::Openfabric(_) | FabricEntry::WireGuard(_) => None,
+        };
+
+        zone.map(|zone| format!("vrf_{zone}"))
+    }
 }
 
 impl From<Fabric> for FabricEntry {
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 65+ messages in thread

* [PATCH proxmox-ve-rs v3 05/32] sdn: fix VRF route-map scoping and zone ID validation
  2026-11-16 16:11 [PATCH common/manager/network/proxmox{-ve-rs,-perl-rs,-widget-toolkit} v3 00/32] SDN VRF support Gabriel Goller
                   ` (3 preceding siblings ...)
  2026-11-16 16:11 ` [PATCH proxmox-ve-rs v3 04/32] sdn: generate fabric routing configuration in zone VRFs Gabriel Goller
@ 2026-11-16 16:11 ` Gabriel Goller
  2026-11-16 16:11 ` [PATCH proxmox-ve-rs v3 06/32] tests: fabrics: add test for fabrics in VRFs Gabriel Goller
                   ` (28 subsequent siblings)
  33 siblings, 0 replies; 65+ messages in thread
From: Gabriel Goller @ 2026-11-16 16:11 UTC (permalink / raw)
  To: pve-devel

Attach protocol route-maps inside the VRF where the protocol runs. Give
VRF route-maps distinct names so fabrics in separate routing tables do
not overwrite or refer to each other. Keep the existing global route-map
handling for protocols in the default routing table.

Add the final BGP permit entry to both global and VRF-specific route-maps
so unrelated routes are not dropped by the implicit deny.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
 .../templates/protocol_routemaps.jinja        | 13 ++++
 proxmox-frr/src/ser/mod.rs                    |  2 +
 proxmox-ve-config/src/sdn/fabric/frr.rs       | 59 ++++++++++++-------
 proxmox-ve-config/tests/fabric/main.rs        | 57 +++++++++++++++++-
 4 files changed, 110 insertions(+), 21 deletions(-)

diff --git a/proxmox-frr-templates/templates/protocol_routemaps.jinja b/proxmox-frr-templates/templates/protocol_routemaps.jinja
index 38c00b6407ee..0f4ca5fdbe0c 100644
--- a/proxmox-frr-templates/templates/protocol_routemaps.jinja
+++ b/proxmox-frr-templates/templates/protocol_routemaps.jinja
@@ -8,3 +8,16 @@ ip protocol {{ protocol_name }} route-map {{ protocol_routemap.v4 }}
 ipv6 protocol {{ protocol_name }} route-map {{ protocol_routemap.v6 }}
 {% endif %}
 {% endfor %}
+{% for vrf_name, protocol_routemaps in vrf_protocol_routemaps | items %}
+!
+vrf {{ vrf_name }}
+{% for protocol_name, protocol_routemap in protocol_routemaps | items %}
+{% if protocol_routemap.v4 %}
+ ip protocol {{ protocol_name }} route-map {{ protocol_routemap.v4 }}
+{% endif %}
+{% if protocol_routemap.v6 %}
+ ipv6 protocol {{ protocol_name }} route-map {{ protocol_routemap.v6 }}
+{% endif %}
+{% endfor %}
+exit-vrf
+{% endfor %}
diff --git a/proxmox-frr/src/ser/mod.rs b/proxmox-frr/src/ser/mod.rs
index cd3025213fb9..b234365f07d8 100644
--- a/proxmox-frr/src/ser/mod.rs
+++ b/proxmox-frr/src/ser/mod.rs
@@ -221,6 +221,8 @@ pub struct FrrConfig {
     #[serde(default)]
     pub protocol_routemaps: BTreeMap<FrrProtocol, IpProtocolRouteMap>,
     #[serde(default)]
+    pub vrf_protocol_routemaps: BTreeMap<VrfName, BTreeMap<FrrProtocol, IpProtocolRouteMap>>,
+    #[serde(default)]
     pub routemaps: BTreeMap<RouteMapName, Vec<RouteMapEntry>>,
     #[serde(default)]
     pub access_lists: BTreeMap<AccessListName, Vec<AccessListRule>>,
diff --git a/proxmox-ve-config/src/sdn/fabric/frr.rs b/proxmox-ve-config/src/sdn/fabric/frr.rs
index 170ae38d38e5..e7df49b46a20 100644
--- a/proxmox-ve-config/src/sdn/fabric/frr.rs
+++ b/proxmox-ve-config/src/sdn/fabric/frr.rs
@@ -1,4 +1,4 @@
-use std::collections::{BTreeMap, btree_map};
+use std::collections::{BTreeMap, BTreeSet, btree_map};
 use std::net::{IpAddr, Ipv4Addr};
 
 use tracing;
@@ -41,6 +41,7 @@ pub fn build_fabric(
     frr_config: &mut FrrConfig,
 ) -> Result<(), anyhow::Error> {
     let mut routemap_seq = 100;
+    let mut fabric_bgp_routemaps = BTreeSet::new();
     // OSPF router IDs only need to be unique within a VRF, and node addresses are only unique
     // within a VRF, so pick the router ID per VRF.
     let mut ospf_router_ids: BTreeMap<VrfName, Ipv4Addr> = BTreeMap::new();
@@ -275,7 +276,7 @@ pub fn build_fabric(
                     }
                 }
 
-                let routemap_name = ser::route_map::RouteMapName::new("pve_ospf")?;
+                let routemap_name = protocol_routemap_name("pve_ospf", &vrf_name)?;
                 let routemap = frr_config
                     .routemaps
                     .entry(routemap_name.clone())
@@ -312,10 +313,7 @@ pub fn build_fabric(
 
                 routemap.push(routemap_entry);
 
-                let protocol_routemap = frr_config
-                    .protocol_routemaps
-                    .entry(FrrProtocol::Ospf)
-                    .or_default();
+                let protocol_routemap = protocol_routemap(frr_config, &vrf_name, FrrProtocol::Ospf);
 
                 protocol_routemap.v4 = Some(routemap_name);
             }
@@ -458,7 +456,7 @@ pub fn build_fabric(
                         networks: vec![Ipv4Cidr::from(ip)],
                     });
 
-                    let routemap_name = ser::route_map::RouteMapName::new("pve_bgp")?;
+                    let routemap_name = protocol_routemap_name("pve_bgp", &vrf_name)?;
                     let routemap = frr_config
                         .routemaps
                         .entry(routemap_name.clone())
@@ -470,11 +468,10 @@ pub fn build_fabric(
 
                     routemap.push(routemap_entry);
 
-                    let protocol_routemap = frr_config
-                        .protocol_routemaps
-                        .entry(FrrProtocol::Bgp)
-                        .or_default();
+                    let protocol_routemap =
+                        protocol_routemap(frr_config, &vrf_name, FrrProtocol::Bgp);
 
+                    fabric_bgp_routemaps.insert(routemap_name.clone());
                     protocol_routemap.v4 = Some(routemap_name);
                 }
 
@@ -543,7 +540,7 @@ pub fn build_fabric(
                         redistribute,
                     });
 
-                    let routemap_name = ser::route_map::RouteMapName::new("pve_bgp6")?;
+                    let routemap_name = protocol_routemap_name("pve_bgp6", &vrf_name)?;
                     let routemap = frr_config
                         .routemaps
                         .entry(routemap_name.clone())
@@ -555,11 +552,10 @@ pub fn build_fabric(
 
                     routemap.push(routemap_entry);
 
-                    let protocol_routemap = frr_config
-                        .protocol_routemaps
-                        .entry(FrrProtocol::Bgp)
-                        .or_default();
+                    let protocol_routemap =
+                        protocol_routemap(frr_config, &vrf_name, FrrProtocol::Bgp);
 
+                    fabric_bgp_routemaps.insert(routemap_name.clone());
                     protocol_routemap.v6 = Some(routemap_name);
                 };
 
@@ -593,10 +589,7 @@ pub fn build_fabric(
     // routes (e.g. EVPN-imported VRF routes) reach the kernel unchanged.
     // Without this, the implicit deny at the end of the route-map would drop
     // them.
-    for routemap_name in [
-        ser::route_map::RouteMapName::new("pve_bgp")?,
-        ser::route_map::RouteMapName::new("pve_bgp6")?,
-    ] {
+    for routemap_name in fabric_bgp_routemaps {
         if let Some(routemap) = frr_config.routemaps.get_mut(&routemap_name) {
             routemap.push(RouteMapEntry {
                 seq: 65535,
@@ -620,6 +613,32 @@ fn fabric_vrf_name(zone: Option<&ZoneId>) -> Result<VrfName, ser::FrrWordError>
     })
 }
 
+fn protocol_routemap_name(
+    prefix: &str,
+    vrf_name: &VrfName,
+) -> Result<RouteMapName, ser::FrrWordError> {
+    match vrf_name {
+        VrfName::Default => RouteMapName::new(prefix),
+        VrfName::Custom(vrf_name) => RouteMapName::new(format!("{prefix}_{vrf_name}")),
+    }
+}
+
+fn protocol_routemap<'a>(
+    frr_config: &'a mut FrrConfig,
+    vrf_name: &VrfName,
+    protocol: FrrProtocol,
+) -> &'a mut ser::IpProtocolRouteMap {
+    match vrf_name {
+        VrfName::Default => frr_config.protocol_routemaps.entry(protocol).or_default(),
+        custom => frr_config
+            .vrf_protocol_routemaps
+            .entry(custom.clone())
+            .or_default()
+            .entry(protocol)
+            .or_default(),
+    }
+}
+
 /// Helper that builds a OSPF router with a the router_id.
 fn build_ospf_router(router_id: Ipv4Addr) -> Result<OspfRouter, anyhow::Error> {
     Ok(OspfRouter::new(router_id))
diff --git a/proxmox-ve-config/tests/fabric/main.rs b/proxmox-ve-config/tests/fabric/main.rs
index aa76adb9819f..05210000adf5 100644
--- a/proxmox-ve-config/tests/fabric/main.rs
+++ b/proxmox-ve-config/tests/fabric/main.rs
@@ -3,7 +3,8 @@ use std::net::Ipv4Addr;
 use std::str::FromStr;
 
 use proxmox_frr::ser::bgp::{AddressFamilies, BgpRouter, CommonAddressFamilyOptions, L2vpnEvpnAF};
-use proxmox_frr::ser::{FrrConfig, VrfName, serializer::dump};
+use proxmox_frr::ser::route_map::RouteMapName;
+use proxmox_frr::ser::{FrrConfig, FrrProtocol, FrrWord, VrfName, serializer::dump};
 use proxmox_ve_config::sdn::fabric::{
     FabricConfig,
     frr::build_fabric,
@@ -248,6 +249,60 @@ bgp_fabric: test
     }
 }
 
+#[test]
+fn protocol_routemaps_are_scoped_by_vrf() {
+    let raw = r#"
+ospf_fabric: ospf
+        area 0
+        ip_prefix 10.0.0.0/24
+        zone zoneone
+
+ospf_node: ospf_pve
+        interfaces name=eth0
+        ip 10.0.0.1
+
+bgp_fabric: bgp
+        bfd 0
+        ip_prefix 10.0.1.0/24
+        zone zonetwo
+
+bgp_node: bgp_pve
+        asn 65001
+        interfaces name=eth1
+        ip 10.0.1.1
+        role internal
+"#;
+    let config = FabricConfig::parse_section_config(raw).unwrap();
+    let mut frr_config = FrrConfig::default();
+
+    build_fabric(NodeId::from_str("pve").unwrap(), config, &mut frr_config).unwrap();
+
+    let ospf_routemap = &frr_config.vrf_protocol_routemaps
+        [&VrfName::Custom(FrrWord::new("vrf_zoneone").unwrap())][&FrrProtocol::Ospf];
+    assert_eq!(
+        ospf_routemap.v4.as_ref().unwrap(),
+        &RouteMapName::new("pve_ospf_vrf_zoneone").unwrap()
+    );
+    let bgp_routemap = &frr_config.vrf_protocol_routemaps
+        [&VrfName::Custom(FrrWord::new("vrf_zonetwo").unwrap())][&FrrProtocol::Bgp];
+    assert_eq!(
+        bgp_routemap.v4.as_ref().unwrap(),
+        &RouteMapName::new("pve_bgp_vrf_zonetwo").unwrap()
+    );
+    assert!(
+        frr_config
+            .protocol_routemaps
+            .get(&FrrProtocol::Ospf)
+            .is_none()
+    );
+    assert!(
+        frr_config
+            .protocol_routemaps
+            .get(&FrrProtocol::Bgp)
+            .is_none()
+    );
+}
+
 #[test]
 fn bgp_default() {
     let config = FabricConfig::parse_section_config(helper::get_fabrics_config!()).unwrap();
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 65+ messages in thread

* [PATCH proxmox-ve-rs v3 06/32] tests: fabrics: add test for fabrics in VRFs
  2026-11-16 16:11 [PATCH common/manager/network/proxmox{-ve-rs,-perl-rs,-widget-toolkit} v3 00/32] SDN VRF support Gabriel Goller
                   ` (4 preceding siblings ...)
  2026-11-16 16:11 ` [PATCH proxmox-ve-rs v3 05/32] sdn: fix VRF route-map scoping and zone ID validation Gabriel Goller
@ 2026-11-16 16:11 ` Gabriel Goller
  2026-11-18 15:01   ` Stefan Hanreich
  2026-11-16 16:11 ` [PATCH proxmox-ve-rs v3 07/32] sdn: allow static routes in simple zone VRFs Gabriel Goller
                   ` (27 subsequent siblings)
  33 siblings, 1 reply; 65+ messages in thread
From: Gabriel Goller @ 2026-11-16 16:11 UTC (permalink / raw)
  To: pve-devel

Add an integration test covering OSPF and BGP fabrics assigned to
multiple SDN zone VRFs.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
 .../tests/fabric/cfg/vrf/fabrics.cfg          |  43 ++++++
 .../tests/fabric/cfg/vrf/route-maps.cfg       |  15 ++
 proxmox-ve-config/tests/fabric/helper.rs      |  20 +++
 proxmox-ve-config/tests/fabric/main.rs        | 115 +++++++++++++--
 .../fabric/snapshots/fabric__vrf_pve.snap     | 134 ++++++++++++++++++
 5 files changed, 314 insertions(+), 13 deletions(-)
 create mode 100644 proxmox-ve-config/tests/fabric/cfg/vrf/fabrics.cfg
 create mode 100644 proxmox-ve-config/tests/fabric/cfg/vrf/route-maps.cfg
 create mode 100644 proxmox-ve-config/tests/fabric/snapshots/fabric__vrf_pve.snap

diff --git a/proxmox-ve-config/tests/fabric/cfg/vrf/fabrics.cfg b/proxmox-ve-config/tests/fabric/cfg/vrf/fabrics.cfg
new file mode 100644
index 000000000000..05a1cb57642a
--- /dev/null
+++ b/proxmox-ve-config/tests/fabric/cfg/vrf/fabrics.cfg
@@ -0,0 +1,43 @@
+ospf_fabric: ospfred
+        area 0
+        ip_prefix 10.0.0.0/24
+        zone red
+
+ospf_fabric: ospfblue
+        area 0
+        ip_prefix 10.0.0.0/24
+        zone blue
+
+ospf_node: ospfred_pve
+        interfaces name=ens18
+        ip 10.0.0.1
+
+ospf_node: ospfblue_pve
+        interfaces name=ens19
+        ip 10.0.0.1
+
+bgp_fabric: bgpred
+        bfd 0
+        ip_prefix 10.1.0.0/24
+        route_map_in red-in
+        route_map_out red-out
+        zone red
+
+bgp_fabric: bgpblue
+        bfd 0
+        ip_prefix 10.1.0.0/24
+        route_map_in blue-in
+        route_map_out blue-out
+        zone blue
+
+bgp_node: bgpred_pve
+        asn 65001
+        interfaces name=ens20
+        ip 10.1.0.1
+        role internal
+
+bgp_node: bgpblue_pve
+        asn 65002
+        interfaces name=ens21
+        ip 10.1.0.1
+        role internal
diff --git a/proxmox-ve-config/tests/fabric/cfg/vrf/route-maps.cfg b/proxmox-ve-config/tests/fabric/cfg/vrf/route-maps.cfg
new file mode 100644
index 000000000000..b382fc369b51
--- /dev/null
+++ b/proxmox-ve-config/tests/fabric/cfg/vrf/route-maps.cfg
@@ -0,0 +1,15 @@
+route-map-entry: blue-in_10
+        action permit
+        set key=local-preference,value=200
+
+route-map-entry: blue-out_10
+        action permit
+        set key=metric,value=20
+
+route-map-entry: red-in_10
+        action permit
+        set key=local-preference,value=100
+
+route-map-entry: red-out_10
+        action permit
+        set key=metric,value=10
diff --git a/proxmox-ve-config/tests/fabric/helper.rs b/proxmox-ve-config/tests/fabric/helper.rs
index 93404b8eb7af..ec464d334a4c 100644
--- a/proxmox-ve-config/tests/fabric/helper.rs
+++ b/proxmox-ve-config/tests/fabric/helper.rs
@@ -18,6 +18,24 @@ macro_rules! get_fabrics_config {
     }};
 }
 
+#[allow(unused_macros)]
+macro_rules! get_route_maps_config {
+    () => {{
+        fn f() {}
+        fn type_name_of<T>(_: T) -> &'static str {
+            std::any::type_name::<T>()
+        }
+        let mut name = type_name_of(f);
+
+        name = match &name[..name.len() - 3].rfind(':') {
+            Some(pos) => &name[pos + 1..name.len() - 3],
+            None => &name[..name.len() - 3],
+        };
+        let real_filename = format!("tests/fabric/cfg/{name}/route-maps.cfg");
+        &std::fs::read_to_string(real_filename).expect("cannot find route-map config file")
+    }};
+}
+
 #[allow(unused_macros)]
 macro_rules! reference_name {
     ($suffix:expr) => {{
@@ -40,4 +58,6 @@ macro_rules! reference_name {
 #[allow(unused_imports)]
 pub(crate) use get_fabrics_config;
 #[allow(unused_imports)]
+pub(crate) use get_route_maps_config;
+#[allow(unused_imports)]
 pub(crate) use reference_name;
diff --git a/proxmox-ve-config/tests/fabric/main.rs b/proxmox-ve-config/tests/fabric/main.rs
index 05210000adf5..de83eb3425a7 100644
--- a/proxmox-ve-config/tests/fabric/main.rs
+++ b/proxmox-ve-config/tests/fabric/main.rs
@@ -3,15 +3,21 @@ use std::net::Ipv4Addr;
 use std::str::FromStr;
 
 use proxmox_frr::ser::bgp::{AddressFamilies, BgpRouter, CommonAddressFamilyOptions, L2vpnEvpnAF};
-use proxmox_frr::ser::route_map::RouteMapName;
-use proxmox_frr::ser::{FrrConfig, FrrProtocol, FrrWord, VrfName, serializer::dump};
-use proxmox_ve_config::sdn::fabric::{
-    FabricConfig,
-    frr::build_fabric,
-    section_config::{
-        fabric::{FabricId, FabricUpdater},
-        node::NodeId,
+use proxmox_frr::ser::route_map::{AccessAction, RouteMapEntry, RouteMapName};
+use proxmox_frr::ser::{
+    FrrConfig, FrrProtocol, FrrWord, IpProtocolRouteMap, VrfName, serializer::dump,
+};
+use proxmox_section_config::typed::ApiSectionDataEntry;
+use proxmox_ve_config::sdn::{
+    fabric::{
+        FabricConfig,
+        frr::build_fabric,
+        section_config::{
+            fabric::{FabricId, FabricUpdater},
+            node::NodeId,
+        },
     },
+    route_map::{RouteMap, frr::build_frr_route_maps},
 };
 
 mod helper;
@@ -274,9 +280,31 @@ bgp_node: bgp_pve
 "#;
     let config = FabricConfig::parse_section_config(raw).unwrap();
     let mut frr_config = FrrConfig::default();
+    let correct_src = RouteMapName::new("correct_src").unwrap();
+    let correct_src_entry = RouteMapEntry {
+        seq: 1,
+        action: AccessAction::Permit,
+        matches: Vec::new(),
+        sets: Vec::new(),
+        custom_frr_config: Vec::new(),
+        call: None,
+        exit_action: None,
+    };
+    frr_config
+        .routemaps
+        .insert(correct_src.clone(), vec![correct_src_entry.clone()]);
+    frr_config.protocol_routemaps.insert(
+        FrrProtocol::Bgp,
+        IpProtocolRouteMap {
+            v4: Some(correct_src.clone()),
+            v6: None,
+        },
+    );
 
     build_fabric(NodeId::from_str("pve").unwrap(), config, &mut frr_config).unwrap();
 
+    assert_eq!(frr_config.routemaps[&correct_src], vec![correct_src_entry]);
+
     let ospf_routemap = &frr_config.vrf_protocol_routemaps
         [&VrfName::Custom(FrrWord::new("vrf_zoneone").unwrap())][&FrrProtocol::Ospf];
     assert_eq!(
@@ -295,14 +323,75 @@ bgp_node: bgp_pve
             .get(&FrrProtocol::Ospf)
             .is_none()
     );
-    assert!(
-        frr_config
-            .protocol_routemaps
-            .get(&FrrProtocol::Bgp)
-            .is_none()
+    assert_eq!(
+        frr_config.protocol_routemaps[&FrrProtocol::Bgp].v4,
+        Some(correct_src)
     );
 }
 
+#[test]
+fn ospf_router_id_is_selected_per_vrf() {
+    let raw = r#"
+ospf_fabric: red
+        area 0
+        ip_prefix 10.0.0.0/24
+        zone red
+
+ospf_node: red_pve
+        interfaces name=eth0
+        ip 10.0.0.1
+
+ospf_fabric: blue
+        area 0
+        ip_prefix 10.0.0.0/24
+        zone blue
+
+ospf_node: blue_pve
+        interfaces name=eth1
+        ip 10.0.0.2
+
+ospf_node: blue_pve2
+        interfaces name=eth1
+        ip 10.0.0.1
+"#;
+    let config = FabricConfig::parse_section_config(raw).unwrap();
+    let mut frr_config = FrrConfig::default();
+
+    build_fabric(NodeId::from_str("pve").unwrap(), config, &mut frr_config).unwrap();
+
+    let router_id = |vrf: &str| {
+        frr_config.ospf.vrf_router[&VrfName::Custom(FrrWord::new(vrf).unwrap())].router_id
+    };
+    assert_eq!(router_id("vrf_red"), Ipv4Addr::new(10, 0, 0, 1));
+    assert_eq!(router_id("vrf_blue"), Ipv4Addr::new(10, 0, 0, 2));
+}
+
+#[test]
+fn vrf() {
+    let config = FabricConfig::parse_section_config(helper::get_fabrics_config!()).unwrap();
+    let route_maps =
+        RouteMap::parse_section_config("route-maps.cfg", helper::get_route_maps_config!()).unwrap();
+    let mut frr_config = FrrConfig::default();
+
+    build_frr_route_maps(
+        route_maps
+            .into_iter()
+            .map(|(_, route_map_entry)| route_map_entry),
+        &mut frr_config,
+    )
+    .unwrap();
+    build_fabric(
+        NodeId::from_str("pve").expect("invalid nodeid"),
+        config,
+        &mut frr_config,
+    )
+    .unwrap();
+
+    let output = dump(&frr_config).expect("error dumping stuff");
+
+    insta::assert_snapshot!(helper::reference_name!("pve"), output);
+}
+
 #[test]
 fn bgp_default() {
     let config = FabricConfig::parse_section_config(helper::get_fabrics_config!()).unwrap();
diff --git a/proxmox-ve-config/tests/fabric/snapshots/fabric__vrf_pve.snap b/proxmox-ve-config/tests/fabric/snapshots/fabric__vrf_pve.snap
new file mode 100644
index 000000000000..84973240deb4
--- /dev/null
+++ b/proxmox-ve-config/tests/fabric/snapshots/fabric__vrf_pve.snap
@@ -0,0 +1,134 @@
+---
+source: proxmox-ve-config/tests/fabric/main.rs
+expression: output
+---
+!
+router bgp 65002 vrf vrf_blue
+ bgp router-id 10.1.0.1
+ no bgp default ipv4-unicast
+ neighbor bgpblue peer-group
+ neighbor bgpblue remote-as external
+ neighbor ens21 interface peer-group bgpblue
+ !
+ address-family ipv4 unicast
+  network 10.1.0.1/32
+  neighbor bgpblue activate
+  neighbor bgpblue soft-reconfiguration inbound
+  neighbor bgpblue route-map pve_bgp_bgpblue_in in
+  neighbor bgpblue route-map blue-out out
+ exit-address-family
+exit
+!
+router bgp 65001 vrf vrf_red
+ bgp router-id 10.1.0.1
+ no bgp default ipv4-unicast
+ neighbor bgpred peer-group
+ neighbor bgpred remote-as external
+ neighbor ens20 interface peer-group bgpred
+ !
+ address-family ipv4 unicast
+  network 10.1.0.1/32
+  neighbor bgpred activate
+  neighbor bgpred soft-reconfiguration inbound
+  neighbor bgpred route-map pve_bgp_bgpred_in in
+  neighbor bgpred route-map red-out out
+ exit-address-family
+exit
+!
+router ospf vrf vrf_blue
+ ospf router-id 10.0.0.1
+exit
+!
+router ospf vrf vrf_red
+ ospf router-id 10.0.0.1
+exit
+!
+interface dummy_ospfblue vrf vrf_blue
+ ip ospf area 0
+ ip ospf passive
+exit
+!
+interface dummy_ospfred vrf vrf_red
+ ip ospf area 0
+ ip ospf passive
+exit
+!
+interface ens18 vrf vrf_red
+ ip ospf area 0
+ ip ospf network point-to-point
+exit
+!
+interface ens19 vrf vrf_blue
+ ip ospf area 0
+ ip ospf network point-to-point
+exit
+!
+access-list pve_bgp_bgpblue_ips permit 10.1.0.0/24
+!
+access-list pve_bgp_bgpred_ips permit 10.1.0.0/24
+!
+access-list pve_ospf_ospfblue_ips permit 10.0.0.0/24
+!
+access-list pve_ospf_ospfred_ips permit 10.0.0.0/24
+!
+route-map blue-in permit 10
+ set local-preference 200
+exit
+!
+route-map blue-out permit 10
+ set metric 20
+exit
+!
+route-map pve_bgp_bgpblue_in permit 10
+ match ip address pve_bgp_bgpblue_ips
+ call blue-in
+exit
+!
+route-map pve_bgp_bgpred_in permit 10
+ match ip address pve_bgp_bgpred_ips
+ call red-in
+exit
+!
+route-map pve_bgp_vrf_blue permit 100
+ match ip address pve_bgp_bgpblue_ips
+ set src 10.1.0.1
+exit
+!
+route-map pve_bgp_vrf_blue permit 65535
+exit
+!
+route-map pve_bgp_vrf_red permit 110
+ match ip address pve_bgp_bgpred_ips
+ set src 10.1.0.1
+exit
+!
+route-map pve_bgp_vrf_red permit 65535
+exit
+!
+route-map pve_ospf_vrf_blue permit 120
+ match ip address pve_ospf_ospfblue_ips
+ set src 10.0.0.1
+exit
+!
+route-map pve_ospf_vrf_red permit 130
+ match ip address pve_ospf_ospfred_ips
+ set src 10.0.0.1
+exit
+!
+route-map red-in permit 10
+ set local-preference 100
+exit
+!
+route-map red-out permit 10
+ set metric 10
+exit
+!
+vrf vrf_blue
+ ip protocol bgp route-map pve_bgp_vrf_blue
+ ip protocol ospf route-map pve_ospf_vrf_blue
+exit-vrf
+!
+vrf vrf_red
+ ip protocol bgp route-map pve_bgp_vrf_red
+ ip protocol ospf route-map pve_ospf_vrf_red
+exit-vrf
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 65+ messages in thread

* [PATCH proxmox-ve-rs v3 07/32] sdn: allow static routes in simple zone VRFs
  2026-11-16 16:11 [PATCH common/manager/network/proxmox{-ve-rs,-perl-rs,-widget-toolkit} v3 00/32] SDN VRF support Gabriel Goller
                   ` (5 preceding siblings ...)
  2026-11-16 16:11 ` [PATCH proxmox-ve-rs v3 06/32] tests: fabrics: add test for fabrics in VRFs Gabriel Goller
@ 2026-11-16 16:11 ` Gabriel Goller
  2026-11-18 15:29   ` Stefan Hanreich
  2026-11-16 16:11 ` [PATCH proxmox-ve-rs v3 08/32] sdn: support static routes in EVPN " Gabriel Goller
                   ` (26 subsequent siblings)
  33 siblings, 1 reply; 65+ messages in thread
From: Gabriel Goller @ 2026-11-16 16:11 UTC (permalink / raw)
  To: pve-devel

Allow simple zones to reach upstream networks through zone-wide static
routes, without requiring node-local FRR overrides. Install routes in
vrf_<zone> when dedicated-vrf is enabled, or in the default routing table
otherwise. Only generate routes on nodes that belong to the zone.

Support IPv4 and IPv6 routes, with an optional outgoing interface,
administrative distance and next-hop VRF. The next-hop VRF only selects
where to resolve the gateway; the route still belongs to the zone.

Reject prefixes with host bits set, since staticd normalizes them and
frr-reload would otherwise replace them on every reload. Keep the perl
vrf field as the outgoing interface for existing EVPN routes, separate
from the VRF in which the route is installed.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
 proxmox-frr-templates/templates/bgpd.jinja    |   7 +-
 .../templates/frr.conf.jinja                  |   3 +-
 .../templates/ip_routes.jinja                 |  13 +-
 proxmox-frr/src/ser/mod.rs                    |  25 ++-
 proxmox-ve-config/src/sdn/mod.rs              |   1 +
 proxmox-ve-config/src/sdn/static_route.rs     | 148 ++++++++++++++++
 .../tests/static_routes/cfg/fabrics.cfg       |  19 ++
 .../tests/static_routes/cfg/zones.json        |  20 +++
 proxmox-ve-config/tests/static_routes/main.rs | 165 ++++++++++++++++++
 ...c_routes__preserve_legacy_evpn_routes.snap |  12 ++
 ...tatic_routes__simple_zone_routes_pve1.snap |  20 +++
 ...tatic_routes__simple_zone_routes_pve2.snap |  10 ++
 ...outes__vrf_fabrics_with_static_routes.snap |  70 ++++++++
 13 files changed, 499 insertions(+), 14 deletions(-)
 create mode 100644 proxmox-ve-config/src/sdn/static_route.rs
 create mode 100644 proxmox-ve-config/tests/static_routes/cfg/fabrics.cfg
 create mode 100644 proxmox-ve-config/tests/static_routes/cfg/zones.json
 create mode 100644 proxmox-ve-config/tests/static_routes/main.rs
 create mode 100644 proxmox-ve-config/tests/static_routes/snapshots/static_routes__preserve_legacy_evpn_routes.snap
 create mode 100644 proxmox-ve-config/tests/static_routes/snapshots/static_routes__simple_zone_routes_pve1.snap
 create mode 100644 proxmox-ve-config/tests/static_routes/snapshots/static_routes__simple_zone_routes_pve2.snap
 create mode 100644 proxmox-ve-config/tests/static_routes/snapshots/static_routes__vrf_fabrics_with_static_routes.snap

diff --git a/proxmox-frr-templates/templates/bgpd.jinja b/proxmox-frr-templates/templates/bgpd.jinja
index 61956bb0ef49..1fc950083ce5 100644
--- a/proxmox-frr-templates/templates/bgpd.jinja
+++ b/proxmox-frr-templates/templates/bgpd.jinja
@@ -1,4 +1,5 @@
 {% from "bgp_router.jinja" import bgp_router %}
+{% from "ip_routes.jinja" import static_route %}
 {% for vrf_name, vrf in bgp.vrfs|items %}
 !
 vrf {{ vrf_name }}
@@ -6,11 +7,7 @@ vrf {{ vrf_name }}
  vni {{ vrf.vni }}
 {% endif %}
 {% for ip_route in vrf.ip_routes %}
-{% if ip_route.vrf %}
- {{ "ipv6" if ip_route.is_ipv6 else "ip" }} route {{ ip_route.prefix }} {{ ip_route.via }} {{ ip_route.vrf }}
-{% else %}
- {{ "ipv6" if ip_route.is_ipv6 else "ip" }} route {{ ip_route.prefix }} {{ ip_route.via }}
-{% endif %}
+ {{ static_route(ip_route) }}
 {% endfor %}
 {% for line in vrf.custom_frr_config %}
 {{ line }}
diff --git a/proxmox-frr-templates/templates/frr.conf.jinja b/proxmox-frr-templates/templates/frr.conf.jinja
index 1f98489e09fb..a6cd2afd10cc 100644
--- a/proxmox-frr-templates/templates/frr.conf.jinja
+++ b/proxmox-frr-templates/templates/frr.conf.jinja
@@ -1,3 +1,4 @@
+{% from "ip_routes.jinja" import ip_routes as render_ip_routes %}
 {% include "bgpd.jinja" %}
 {% include "isisd.jinja" %}
 {% include "prefix_lists.jinja" %}
@@ -8,5 +9,5 @@
 {% include "ospfd.jinja" %}
 {% include "access_lists.jinja" %}
 {% include "route_maps.jinja" %}
-{% include "ip_routes.jinja" %}
+{{ render_ip_routes(ip_routes) -}}
 {% include "protocol_routemaps.jinja" %}
diff --git a/proxmox-frr-templates/templates/ip_routes.jinja b/proxmox-frr-templates/templates/ip_routes.jinja
index 3e33a709e821..c70b736bc518 100644
--- a/proxmox-frr-templates/templates/ip_routes.jinja
+++ b/proxmox-frr-templates/templates/ip_routes.jinja
@@ -1,8 +1,9 @@
-{% for ip_route in ip_routes %}
+{% macro static_route(route) -%}
+{{ "ipv6" if route.is_ipv6 else "ip" }} route {{ route.prefix }}{% if route.via %} {{ route.via }}{% endif %}{% if route.vrf %} {{ route.vrf }}{% endif %}{% if route.distance and route.distance != 1 %} {{ route.distance }}{% endif %}{% if route.nexthop_vrf %} nexthop-vrf {{ route.nexthop_vrf }}{% endif %}{% if route.destination_vrf %} vrf {{ route.destination_vrf }}{% endif %}
+{%- endmacro %}
+{% macro ip_routes(routes) -%}
+{% for ip_route in routes %}
 !
-{% if ip_route.vrf %}
-{{ "ipv6" if ip_route.is_ipv6 else "ip" }} route {{ ip_route.prefix }} {{ ip_route.via }} {{ ip_route.vrf }}
-{% else %}
-{{ "ipv6" if ip_route.is_ipv6 else "ip" }} route {{ ip_route.prefix }} {{ ip_route.via }}
-{% endif %}
+{{ static_route(ip_route) }}
 {% endfor %}
+{%- endmacro %}
diff --git a/proxmox-frr/src/ser/mod.rs b/proxmox-frr/src/ser/mod.rs
index b234365f07d8..574b929a0b85 100644
--- a/proxmox-frr/src/ser/mod.rs
+++ b/proxmox-frr/src/ser/mod.rs
@@ -175,8 +175,29 @@ pub struct IpRoute {
     #[serde(default, deserialize_with = "proxmox_serde::perl::deserialize_bool")]
     is_ipv6: bool,
     prefix: Cidr,
-    via: IpOrInterface,
-    vrf: Option<InterfaceName>,
+    pub via: Option<IpOrInterface>,
+    /// Outgoing interface (e.g. EVPN's xvrf_<zone> veth). Keep the "vrf" perl
+    /// key for backwards compat.
+    #[serde(rename = "vrf")]
+    pub iface: Option<InterfaceName>,
+    pub distance: Option<u8>,
+    pub nexthop_vrf: Option<InterfaceName>,
+    /// VRF in which to install the route -- None selects the default VRF.
+    pub destination_vrf: Option<InterfaceName>,
+}
+
+impl IpRoute {
+    pub fn new(prefix: Cidr, via: Option<IpOrInterface>) -> Self {
+        Self {
+            is_ipv6: prefix.is_ipv6(),
+            prefix,
+            via,
+            iface: None,
+            distance: None,
+            nexthop_vrf: None,
+            destination_vrf: None,
+        }
+    }
 }
 
 #[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize)]
diff --git a/proxmox-ve-config/src/sdn/mod.rs b/proxmox-ve-config/src/sdn/mod.rs
index 2133396145bd..9140179ef5d1 100644
--- a/proxmox-ve-config/src/sdn/mod.rs
+++ b/proxmox-ve-config/src/sdn/mod.rs
@@ -3,6 +3,7 @@ pub mod fabric;
 pub mod ipam;
 pub mod prefix_list;
 pub mod route_map;
+pub mod static_route;
 pub mod wireguard;
 
 use std::{error::Error, fmt::Display, str::FromStr};
diff --git a/proxmox-ve-config/src/sdn/static_route.rs b/proxmox-ve-config/src/sdn/static_route.rs
new file mode 100644
index 000000000000..eab6300374ff
--- /dev/null
+++ b/proxmox-ve-config/src/sdn/static_route.rs
@@ -0,0 +1,148 @@
+//! Static routes stored as repeatable property strings in simple SDN zones.
+
+use std::collections::BTreeMap;
+use std::net::IpAddr;
+
+use anyhow::{Error, bail};
+use proxmox_network_types::Cidr;
+use proxmox_schema::{api, property_string::PropertyString};
+use serde::{Deserialize, Serialize};
+
+use crate::common::valid::Validatable;
+use crate::sdn::ZoneName;
+use crate::sdn::fabric::section_config::interface::InterfaceName;
+
+#[api(
+    properties: {
+        via: { type: String, optional: true, format: &proxmox_schema::api_types::IP_FORMAT },
+        iface: { type: InterfaceName, optional: true },
+        distance: { type: Integer, optional: true, minimum: 1, maximum: 255 },
+        "nexthop-vrf": { type: InterfaceName, optional: true },
+    },
+)]
+#[derive(Clone, Debug, Serialize, Deserialize)]
+#[serde(rename_all = "kebab-case", deny_unknown_fields)]
+/// A static route in a simple zone. The destination VRF is determined by the zone.
+pub struct StaticRoute {
+    /// Destination prefix, including 0.0.0.0/0 or ::/0 for a default route.
+    pub prefix: Cidr,
+    /// Next-hop gateway address.
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub via: Option<IpAddr>,
+    /// Outgoing interface, required for IPv6 link-local gateways.
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub iface: Option<InterfaceName>,
+    /// Administrative distance. FRR's default is 1; 255 prevents installation.
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub distance: Option<u8>,
+    /// VRF in which to resolve the next hop, or 'default'.
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub nexthop_vrf: Option<InterfaceName>,
+}
+
+impl Validatable for StaticRoute {
+    type Error = Error;
+
+    fn validate(&self) -> Result<(), Error> {
+        // staticd stores the network address, so a prefix with host bits set would never match
+        // the running config and frr-reload would replace the route on every reload
+        let canonical = match self.prefix {
+            Cidr::Ipv4(cidr) => Cidr::Ipv4(cidr.canonical()),
+            Cidr::Ipv6(cidr) => Cidr::Ipv6(cidr.canonical()),
+        };
+        if self.prefix != canonical {
+            bail!(
+                "prefix '{}' has host bits set, use '{canonical}' instead",
+                self.prefix
+            );
+        }
+        if self.via.is_none() && self.iface.is_none() {
+            bail!("a static route requires a gateway (via) or an outgoing interface (iface)");
+        }
+        if let Some(via) = self.via {
+            if via.is_ipv6() != self.prefix.is_ipv6() {
+                bail!("gateway and destination prefix must use the same address family");
+            }
+            if let IpAddr::V6(via) = via {
+                if via.is_unicast_link_local() && self.iface.is_none() {
+                    bail!("an IPv6 link-local gateway requires an outgoing interface (iface)");
+                }
+            }
+        }
+        if let Some(iface) = &self.iface {
+            let iface = iface.as_str();
+            if ["null0", "blackhole", "reject"].contains(&iface.to_ascii_lowercase().as_str())
+                || iface.parse::<IpAddr>().is_ok()
+            {
+                bail!("'{iface}' is not an outgoing interface");
+            }
+        }
+        if self.distance == Some(0) {
+            bail!("administrative distance must be between 1 and 255");
+        }
+        Ok(())
+    }
+}
+
+/// The subset of zones.cfg needed to generate static routes, as represented by the perl parser.
+#[derive(Clone, Debug, Default, Deserialize)]
+pub struct ZoneRoutesConfig {
+    pub ids: BTreeMap<ZoneName, ZoneRoutes>,
+}
+
+/// Routing-related properties of a single SDN zone.
+#[derive(Clone, Debug, Deserialize)]
+pub struct ZoneRoutes {
+    #[serde(rename = "type")]
+    pub ty: String,
+    #[serde(
+        default,
+        rename = "dedicated-vrf",
+        deserialize_with = "proxmox_serde::perl::deserialize_bool"
+    )]
+    pub dedicated_vrf: bool,
+    pub nodes: Option<BTreeMap<String, serde_json::Value>>,
+    #[serde(default)]
+    pub route: Vec<PropertyString<StaticRoute>>,
+}
+
+#[cfg(feature = "frr")]
+impl ZoneRoutesConfig {
+    /// Generate routes only on nodes participating in the zone.
+    pub fn routes_for_node(&self, node: &str) -> Result<Vec<proxmox_frr::ser::IpRoute>, Error> {
+        use proxmox_frr::ser::{InterfaceName as FrrInterfaceName, IpOrInterface, IpRoute};
+
+        let to_frr = |name: &InterfaceName| FrrInterfaceName::try_from(name.as_str());
+
+        let mut routes = Vec::new();
+        for (zone, config) in &self.ids {
+            if config.route.is_empty() {
+                continue;
+            }
+            if config.ty != "simple" {
+                bail!("static routes are only supported in simple zones (zone '{zone}')");
+            }
+            if config
+                .nodes
+                .as_ref()
+                .is_some_and(|nodes| !nodes.contains_key(node))
+            {
+                continue;
+            }
+            let destination_vrf = config
+                .dedicated_vrf
+                .then(|| FrrInterfaceName::try_from(format!("vrf_{zone}")))
+                .transpose()?;
+            for route in &config.route {
+                route.validate()?;
+                let mut frr_route = IpRoute::new(route.prefix, route.via.map(IpOrInterface::Ip));
+                frr_route.iface = route.iface.as_ref().map(to_frr).transpose()?;
+                frr_route.distance = route.distance;
+                frr_route.nexthop_vrf = route.nexthop_vrf.as_ref().map(to_frr).transpose()?;
+                frr_route.destination_vrf = destination_vrf.clone();
+                routes.push(frr_route);
+            }
+        }
+        Ok(routes)
+    }
+}
diff --git a/proxmox-ve-config/tests/static_routes/cfg/fabrics.cfg b/proxmox-ve-config/tests/static_routes/cfg/fabrics.cfg
new file mode 100644
index 000000000000..7c34f1f8e9bd
--- /dev/null
+++ b/proxmox-ve-config/tests/static_routes/cfg/fabrics.cfg
@@ -0,0 +1,19 @@
+ospf_fabric: blue
+        area 0
+        ip_prefix 10.0.0.0/24
+        zone blue
+
+ospf_node: blue_pve1
+        interfaces name=ens18
+        ip 10.0.0.1
+
+bgp_fabric: red
+        bfd 0
+        ip_prefix 10.0.0.0/24
+        zone red
+
+bgp_node: red_pve1
+        asn 65001
+        interfaces name=ens19
+        ip 10.0.0.1
+        role internal
diff --git a/proxmox-ve-config/tests/static_routes/cfg/zones.json b/proxmox-ve-config/tests/static_routes/cfg/zones.json
new file mode 100644
index 000000000000..82c2cb2c14f9
--- /dev/null
+++ b/proxmox-ve-config/tests/static_routes/cfg/zones.json
@@ -0,0 +1,20 @@
+{
+    "ids": {
+        "blue": {
+            "type": "simple",
+            "dedicated-vrf": 1,
+            "route": [
+                "prefix=203.0.113.0/24,via=10.0.0.2",
+                "prefix=2001:db8:42::/64,via=fe80::2,iface=ens19,nexthop-vrf=vrf_red"
+            ]
+        },
+        "red": {
+            "type": "simple",
+            "dedicated-vrf": 1,
+            "route": [
+                "prefix=203.0.113.0/24,via=10.0.0.3,iface=ens19,distance=20",
+                "prefix=2001:db8:42::/64,iface=ens19,distance=30"
+            ]
+        }
+    }
+}
diff --git a/proxmox-ve-config/tests/static_routes/main.rs b/proxmox-ve-config/tests/static_routes/main.rs
new file mode 100644
index 000000000000..a0daf38449ff
--- /dev/null
+++ b/proxmox-ve-config/tests/static_routes/main.rs
@@ -0,0 +1,165 @@
+#![cfg(feature = "frr")]
+
+use anyhow::Error;
+use proxmox_frr::ser::{FrrConfig, IpRoute, serializer::dump};
+use proxmox_schema::property_string::PropertyString;
+use proxmox_ve_config::common::valid::Validatable;
+use proxmox_ve_config::sdn::fabric::{
+    FabricConfig, frr::build_fabric, section_config::node::NodeId,
+};
+use proxmox_ve_config::sdn::static_route::{StaticRoute, ZoneRoutesConfig};
+use serde_json::json;
+
+#[test]
+fn simple_zone_routes_to_frr() -> Result<(), Error> {
+    // This is the zones.cfg representation in the SDN running configuration. Repeated route
+    // properties remain an array, including routes with the same prefix for ECMP and failover.
+    let zones: ZoneRoutesConfig = serde_json::from_value(json!({"ids": {
+        "isolated": {
+            "type": "simple",
+            "dedicated-vrf": 1,
+            "nodes": {"pve1": 1},
+            "route": [
+                "prefix=0.0.0.0/0,via=192.0.2.1",
+                "prefix=0.0.0.0/0,via=192.0.2.2,distance=1",
+                "prefix=0.0.0.0/0,via=192.0.2.3,distance=200,nexthop-vrf=default",
+                "prefix=::/0,via=fe80::1,iface=uplink0",
+                "prefix=2001:db8:20::/64,iface=uplink1,distance=10,nexthop-vrf=vrf_other"
+            ]
+        },
+        "shared": {
+            "type": "simple",
+            "dedicated-vrf": 0,
+            "route": [
+                "prefix=0.0.0.0/0,via=198.51.100.1,iface=eth0,distance=5",
+                "prefix=::/0,via=2001:db8::1",
+                "prefix=203.0.113.0/24,iface=ppp0"
+            ]
+        },
+        "disabled": {
+            "type": "simple",
+            "nodes": {},
+            "route": ["prefix=192.0.2.0/24,iface=unused0"]
+        },
+        "unused": {"type": "vlan"}
+    }}))?;
+    let config = FrrConfig {
+        ip_routes: zones.routes_for_node("pve1")?,
+        ..Default::default()
+    };
+    let output = dump(&config)?;
+    insta::assert_snapshot!("simple_zone_routes_pve1", output);
+
+    let config = FrrConfig {
+        ip_routes: zones.routes_for_node("pve2")?,
+        ..Default::default()
+    };
+    let output = dump(&config)?;
+    insta::assert_snapshot!("simple_zone_routes_pve2", output);
+    Ok(())
+}
+
+#[test]
+fn validate_route_properties() {
+    for value in [
+        "prefix=0.0.0.0/0,via=192.0.2.1",
+        "prefix=::/0,via=fe80::1,iface=eth0",
+        "prefix=10.0.0.0/8,iface=eth0.100,distance=255",
+        "prefix=::/0,via=2001:db8::1,nexthop-vrf=default",
+    ] {
+        let route = value.parse::<PropertyString<StaticRoute>>().unwrap();
+        route.validate().unwrap();
+        let encoded = route.to_property_string().unwrap();
+        encoded
+            .parse::<PropertyString<StaticRoute>>()
+            .unwrap()
+            .validate()
+            .unwrap();
+    }
+
+    for value in [
+        "prefix=0.0.0.0/0",
+        "via=192.0.2.1",
+        "prefix=0.0.0.0/33,via=192.0.2.1",
+        "prefix=10.0.0.1/24,via=192.0.2.1",
+        "prefix=2001:db8::1/64,via=2001:db8::ffff",
+        "prefix=0.0.0.0/0,via=2001:db8::1",
+        "prefix=::/0,via=192.0.2.1",
+        "prefix=::/0,via=fe80::1",
+        "prefix=0.0.0.0/0,iface=",
+        "prefix=0.0.0.0/0,iface=interface-too-long",
+        "prefix=0.0.0.0/0,iface=eth0 vrf default",
+        "prefix=0.0.0.0/0,iface=eth0\nexit",
+        "prefix=0.0.0.0/0,iface=blackhole",
+        "prefix=0.0.0.0/0,iface=Null0",
+        "prefix=0.0.0.0/0,iface=192.0.2.1",
+        "prefix=0.0.0.0/0,via=192.0.2.1,distance=0",
+        "prefix=0.0.0.0/0,via=192.0.2.1,distance=256",
+        "prefix=0.0.0.0/0,via=192.0.2.1,vrf=vrf_other",
+        "prefix=0.0.0.0/0,via=192.0.2.1,nexthop-vrf=default vrf other",
+        "prefix=0.0.0.0/0,via=192.0.2.1,via=192.0.2.2",
+    ] {
+        let result = value
+            .parse::<PropertyString<StaticRoute>>()
+            .map_err(Error::from)
+            .and_then(|route| route.validate());
+        assert!(result.is_err(), "accepted invalid route: {value}");
+    }
+}
+
+#[test]
+fn reject_routes_in_other_zone_types() -> Result<(), Error> {
+    for ty in ["vlan", "qinq", "vxlan", "evpn", "faucet"] {
+        let zones: ZoneRoutesConfig = serde_json::from_value(json!({"ids": {
+            "zone1": {"type": ty, "route": ["prefix=0.0.0.0/0,via=192.0.2.1"]}
+        }}))?;
+        assert!(zones.routes_for_node("pve1").is_err());
+    }
+    Ok(())
+}
+
+#[test]
+fn preserve_legacy_evpn_routes() -> Result<(), Error> {
+    // The historical 'vrf' field is actually the outgoing interface, not a destination VRF.
+    let route: IpRoute = serde_json::from_value(json!({
+        "prefix": "203.0.113.0/24", "via": "10.255.255.2", "vrf": "xvrf_zone1"
+    }))?;
+    let mut config = FrrConfig::default();
+    config.ip_routes.push(route);
+    config.ip_routes.push(serde_json::from_value(json!({
+        "is_ipv6": 1, "prefix": "2001:db8::/64", "via": "fe80::2", "vrf": "xvrf_zone1"
+    }))?);
+    assert_eq!(
+        serde_json::to_value(&config.ip_routes[0])?["vrf"],
+        "xvrf_zone1"
+    );
+    config.bgp.vrfs.insert(
+        "vrf_zone1".try_into()?,
+        serde_json::from_value(json!({
+            "ip_routes": [{"prefix": "203.0.113.0/24", "via": "null0"}]
+        }))?,
+    );
+    let output = dump(&config)?;
+    insta::assert_snapshot!(output);
+    Ok(())
+}
+
+#[test]
+fn vrf_fabrics_with_static_routes() -> Result<(), Error> {
+    let fabrics = FabricConfig::parse_section_config(include_str!("cfg/fabrics.cfg"))?;
+    let zones: ZoneRoutesConfig = serde_json::from_str(include_str!("cfg/zones.json"))?;
+    let mut config = FrrConfig::default();
+
+    // Both fabrics use the same subnet, and both zones route the same IPv4 and IPv6 prefixes.
+    // Static routes must retain their installation VRF, even with a different next-hop VRF.
+    build_fabric(
+        NodeId::from_string("pve1".to_owned())?,
+        fabrics,
+        &mut config,
+    )?;
+    config.ip_routes.extend(zones.routes_for_node("pve1")?);
+
+    let output = dump(&config)?;
+    insta::assert_snapshot!(output);
+    Ok(())
+}
diff --git a/proxmox-ve-config/tests/static_routes/snapshots/static_routes__preserve_legacy_evpn_routes.snap b/proxmox-ve-config/tests/static_routes/snapshots/static_routes__preserve_legacy_evpn_routes.snap
new file mode 100644
index 000000000000..999c04522074
--- /dev/null
+++ b/proxmox-ve-config/tests/static_routes/snapshots/static_routes__preserve_legacy_evpn_routes.snap
@@ -0,0 +1,12 @@
+---
+source: proxmox-ve-config/tests/static_routes/main.rs
+expression: output
+---
+!
+vrf vrf_zone1
+ ip route 203.0.113.0/24 null0
+exit-vrf
+!
+ip route 203.0.113.0/24 10.255.255.2 xvrf_zone1
+!
+ipv6 route 2001:db8::/64 fe80::2 xvrf_zone1
diff --git a/proxmox-ve-config/tests/static_routes/snapshots/static_routes__simple_zone_routes_pve1.snap b/proxmox-ve-config/tests/static_routes/snapshots/static_routes__simple_zone_routes_pve1.snap
new file mode 100644
index 000000000000..e27dc5f49f8a
--- /dev/null
+++ b/proxmox-ve-config/tests/static_routes/snapshots/static_routes__simple_zone_routes_pve1.snap
@@ -0,0 +1,20 @@
+---
+source: proxmox-ve-config/tests/static_routes/main.rs
+expression: output
+---
+!
+ip route 0.0.0.0/0 192.0.2.1 vrf vrf_isolated
+!
+ip route 0.0.0.0/0 192.0.2.2 vrf vrf_isolated
+!
+ip route 0.0.0.0/0 192.0.2.3 200 nexthop-vrf default vrf vrf_isolated
+!
+ipv6 route ::/0 fe80::1 uplink0 vrf vrf_isolated
+!
+ipv6 route 2001:db8:20::/64 uplink1 10 nexthop-vrf vrf_other vrf vrf_isolated
+!
+ip route 0.0.0.0/0 198.51.100.1 eth0 5
+!
+ipv6 route ::/0 2001:db8::1
+!
+ip route 203.0.113.0/24 ppp0
diff --git a/proxmox-ve-config/tests/static_routes/snapshots/static_routes__simple_zone_routes_pve2.snap b/proxmox-ve-config/tests/static_routes/snapshots/static_routes__simple_zone_routes_pve2.snap
new file mode 100644
index 000000000000..ff327491d71a
--- /dev/null
+++ b/proxmox-ve-config/tests/static_routes/snapshots/static_routes__simple_zone_routes_pve2.snap
@@ -0,0 +1,10 @@
+---
+source: proxmox-ve-config/tests/static_routes/main.rs
+expression: output
+---
+!
+ip route 0.0.0.0/0 198.51.100.1 eth0 5
+!
+ipv6 route ::/0 2001:db8::1
+!
+ip route 203.0.113.0/24 ppp0
diff --git a/proxmox-ve-config/tests/static_routes/snapshots/static_routes__vrf_fabrics_with_static_routes.snap b/proxmox-ve-config/tests/static_routes/snapshots/static_routes__vrf_fabrics_with_static_routes.snap
new file mode 100644
index 000000000000..5a0093326549
--- /dev/null
+++ b/proxmox-ve-config/tests/static_routes/snapshots/static_routes__vrf_fabrics_with_static_routes.snap
@@ -0,0 +1,70 @@
+---
+source: proxmox-ve-config/tests/static_routes/main.rs
+expression: output
+---
+!
+router bgp 65001 vrf vrf_red
+ bgp router-id 10.0.0.1
+ no bgp default ipv4-unicast
+ neighbor red peer-group
+ neighbor red remote-as external
+ neighbor ens19 interface peer-group red
+ !
+ address-family ipv4 unicast
+  network 10.0.0.1/32
+  neighbor red activate
+  neighbor red soft-reconfiguration inbound
+  neighbor red route-map pve_bgp_red_in in
+ exit-address-family
+exit
+!
+router ospf vrf vrf_blue
+ ospf router-id 10.0.0.1
+exit
+!
+interface dummy_blue vrf vrf_blue
+ ip ospf area 0
+ ip ospf passive
+exit
+!
+interface ens18 vrf vrf_blue
+ ip ospf area 0
+ ip ospf network point-to-point
+exit
+!
+access-list pve_bgp_red_ips permit 10.0.0.0/24
+!
+access-list pve_ospf_blue_ips permit 10.0.0.0/24
+!
+route-map pve_bgp_red_in permit 10
+ match ip address pve_bgp_red_ips
+exit
+!
+route-map pve_bgp_vrf_red permit 110
+ match ip address pve_bgp_red_ips
+ set src 10.0.0.1
+exit
+!
+route-map pve_bgp_vrf_red permit 65535
+exit
+!
+route-map pve_ospf_vrf_blue permit 100
+ match ip address pve_ospf_blue_ips
+ set src 10.0.0.1
+exit
+!
+ip route 203.0.113.0/24 10.0.0.2 vrf vrf_blue
+!
+ipv6 route 2001:db8:42::/64 fe80::2 ens19 nexthop-vrf vrf_red vrf vrf_blue
+!
+ip route 203.0.113.0/24 10.0.0.3 ens19 20 vrf vrf_red
+!
+ipv6 route 2001:db8:42::/64 ens19 30 vrf vrf_red
+!
+vrf vrf_blue
+ ip protocol ospf route-map pve_ospf_vrf_blue
+exit-vrf
+!
+vrf vrf_red
+ ip protocol bgp route-map pve_bgp_vrf_red
+exit-vrf
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 65+ messages in thread

* [PATCH proxmox-ve-rs v3 08/32] sdn: support static routes in EVPN zone VRFs
  2026-11-16 16:11 [PATCH common/manager/network/proxmox{-ve-rs,-perl-rs,-widget-toolkit} v3 00/32] SDN VRF support Gabriel Goller
                   ` (6 preceding siblings ...)
  2026-11-16 16:11 ` [PATCH proxmox-ve-rs v3 07/32] sdn: allow static routes in simple zone VRFs Gabriel Goller
@ 2026-11-16 16:11 ` Gabriel Goller
  2026-11-18 15:32   ` Stefan Hanreich
  2026-11-16 16:11 ` [PATCH proxmox-perl-rs v3 09/32] pve-rs: fabrics: assign network interfaces to configured VRFs Gabriel Goller
                   ` (25 subsequent siblings)
  33 siblings, 1 reply; 65+ messages in thread
From: Gabriel Goller @ 2026-11-16 16:11 UTC (permalink / raw)
  To: pve-devel

Allow EVPN zones to reach networks behind appliances or external routers
using the same zone-wide static routes as simple zones. EVPN routes
always belong to vrf_<zone>, without requiring the dedicated-vrf option
used by simple zones.

Generate routes on all nodes that belong to the zone, not just exit
nodes. This does not enable redistribution of static routes, so adding
a route does not by itself advertise it to other nodes.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
 proxmox-ve-config/src/sdn/static_route.rs     | 11 +++--
 proxmox-ve-config/tests/static_routes/main.rs | 40 ++++++++++++++++++-
 ...tatic_routes__evpn_zone_routes_to_frr.snap | 12 ++++++
 3 files changed, 56 insertions(+), 7 deletions(-)
 create mode 100644 proxmox-ve-config/tests/static_routes/snapshots/static_routes__evpn_zone_routes_to_frr.snap

diff --git a/proxmox-ve-config/src/sdn/static_route.rs b/proxmox-ve-config/src/sdn/static_route.rs
index eab6300374ff..0a5e0b3939f4 100644
--- a/proxmox-ve-config/src/sdn/static_route.rs
+++ b/proxmox-ve-config/src/sdn/static_route.rs
@@ -1,4 +1,4 @@
-//! Static routes stored as repeatable property strings in simple SDN zones.
+//! Static routes stored as repeatable property strings in Simple and EVPN SDN zones.
 
 use std::collections::BTreeMap;
 use std::net::IpAddr;
@@ -22,7 +22,7 @@ use crate::sdn::fabric::section_config::interface::InterfaceName;
 )]
 #[derive(Clone, Debug, Serialize, Deserialize)]
 #[serde(rename_all = "kebab-case", deny_unknown_fields)]
-/// A static route in a simple zone. The destination VRF is determined by the zone.
+/// A static route in a Simple or EVPN zone. The destination VRF is determined by the zone.
 pub struct StaticRoute {
     /// Destination prefix, including 0.0.0.0/0 or ::/0 for a default route.
     pub prefix: Cidr,
@@ -119,8 +119,8 @@ impl ZoneRoutesConfig {
             if config.route.is_empty() {
                 continue;
             }
-            if config.ty != "simple" {
-                bail!("static routes are only supported in simple zones (zone '{zone}')");
+            if !matches!(config.ty.as_str(), "simple" | "evpn") {
+                bail!("static routes are only supported in Simple and EVPN zones (zone '{zone}')");
             }
             if config
                 .nodes
@@ -129,8 +129,7 @@ impl ZoneRoutesConfig {
             {
                 continue;
             }
-            let destination_vrf = config
-                .dedicated_vrf
+            let destination_vrf = (config.ty == "evpn" || config.dedicated_vrf)
                 .then(|| FrrInterfaceName::try_from(format!("vrf_{zone}")))
                 .transpose()?;
             for route in &config.route {
diff --git a/proxmox-ve-config/tests/static_routes/main.rs b/proxmox-ve-config/tests/static_routes/main.rs
index a0daf38449ff..f198a3bf3353 100644
--- a/proxmox-ve-config/tests/static_routes/main.rs
+++ b/proxmox-ve-config/tests/static_routes/main.rs
@@ -59,6 +59,44 @@ fn simple_zone_routes_to_frr() -> Result<(), Error> {
     Ok(())
 }
 
+#[test]
+fn evpn_zone_routes_to_frr() -> Result<(), Error> {
+    let zones: ZoneRoutesConfig = serde_json::from_value(json!({"ids": {
+        "blue": {
+            "type": "evpn",
+            "nodes": {"pve1": 1, "pve2": 1},
+            "exitnodes": {"pve1": 1},
+            "route": [
+                "prefix=0.0.0.0/0,via=10.10.0.2",
+                "prefix=172.20.0.0/16,via=192.0.2.1,distance=200,nexthop-vrf=default",
+                "prefix=::/0,via=fe80::1,iface=vnetblue",
+                "prefix=198.51.100.0/24,iface=uplink0"
+            ]
+        },
+        "disabled": {
+            "type": "evpn",
+            "nodes": {},
+            "route": ["prefix=192.0.2.0/24,iface=unused0"]
+        }
+    }}))?;
+    let config = FrrConfig {
+        ip_routes: zones.routes_for_node("pve1")?,
+        ..Default::default()
+    };
+    // EVPN always uses the zone VRF, without requiring the Simple-only dedicated-vrf flag.
+    let output = dump(&config)?;
+    insta::assert_snapshot!(output);
+
+    // Routes apply to every zone node, not just exit nodes. FRR resolves local interfaces.
+    let other = FrrConfig {
+        ip_routes: zones.routes_for_node("pve2")?,
+        ..Default::default()
+    };
+    assert_eq!(dump(&other)?, output);
+    assert!(zones.routes_for_node("pve3")?.is_empty());
+    Ok(())
+}
+
 #[test]
 fn validate_route_properties() {
     for value in [
@@ -109,7 +147,7 @@ fn validate_route_properties() {
 
 #[test]
 fn reject_routes_in_other_zone_types() -> Result<(), Error> {
-    for ty in ["vlan", "qinq", "vxlan", "evpn", "faucet"] {
+    for ty in ["vlan", "qinq", "vxlan", "faucet"] {
         let zones: ZoneRoutesConfig = serde_json::from_value(json!({"ids": {
             "zone1": {"type": ty, "route": ["prefix=0.0.0.0/0,via=192.0.2.1"]}
         }}))?;
diff --git a/proxmox-ve-config/tests/static_routes/snapshots/static_routes__evpn_zone_routes_to_frr.snap b/proxmox-ve-config/tests/static_routes/snapshots/static_routes__evpn_zone_routes_to_frr.snap
new file mode 100644
index 000000000000..0301559a6d77
--- /dev/null
+++ b/proxmox-ve-config/tests/static_routes/snapshots/static_routes__evpn_zone_routes_to_frr.snap
@@ -0,0 +1,12 @@
+---
+source: proxmox-ve-config/tests/static_routes/main.rs
+expression: output
+---
+!
+ip route 0.0.0.0/0 10.10.0.2 vrf vrf_blue
+!
+ip route 172.20.0.0/16 192.0.2.1 200 nexthop-vrf default vrf vrf_blue
+!
+ipv6 route ::/0 fe80::1 vnetblue vrf vrf_blue
+!
+ip route 198.51.100.0/24 uplink0 vrf vrf_blue
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 65+ messages in thread

* [PATCH proxmox-perl-rs v3 09/32] pve-rs: fabrics: assign network interfaces to configured VRFs
  2026-11-16 16:11 [PATCH common/manager/network/proxmox{-ve-rs,-perl-rs,-widget-toolkit} v3 00/32] SDN VRF support Gabriel Goller
                   ` (7 preceding siblings ...)
  2026-11-16 16:11 ` [PATCH proxmox-ve-rs v3 08/32] sdn: support static routes in EVPN " Gabriel Goller
@ 2026-11-16 16:11 ` Gabriel Goller
  2026-11-16 16:11 ` [PATCH proxmox-perl-rs v3 10/32] pve-rs: fabrics: make per-fabric status queries VRF-aware Gabriel Goller
                   ` (24 subsequent siblings)
  33 siblings, 0 replies; 65+ messages in thread
From: Gabriel Goller @ 2026-11-16 16:11 UTC (permalink / raw)
  To: pve-devel

Add the VRF stanza to generated interface configuration when a fabric
has a VRF. Apply it to dummy addresses, protocol interfaces, and BGP
unnumbered interfaces so traffic enters the correct routing table.

Fabrics without a VRF keep their existing configuration.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
 pve-rs/src/bindings/sdn/fabrics.rs | 59 ++++++++++++++++++++++--------
 1 file changed, 43 insertions(+), 16 deletions(-)

diff --git a/pve-rs/src/bindings/sdn/fabrics.rs b/pve-rs/src/bindings/sdn/fabrics.rs
index 1d3e8b5bbf34..b7c2d91e5471 100644
--- a/pve-rs/src/bindings/sdn/fabrics.rs
+++ b/pve-rs/src/bindings/sdn/fabrics.rs
@@ -586,7 +586,12 @@ pub mod pve_rs_sdn_fabrics {
     }
 
     /// Helper function to generate the default `/etc/network/interfaces` config for a given CIDR.
-    fn render_interface(name: &str, cidr: Cidr, link_type: Option<&str>) -> Result<String, Error> {
+    fn render_interface(
+        name: &str,
+        cidr: Cidr,
+        link_type: Option<&str>,
+        vrf: Option<&str>,
+    ) -> Result<String, Error> {
         let mut interface = String::new();
 
         writeln!(interface, "auto {name}")?;
@@ -598,6 +603,9 @@ pub mod pve_rs_sdn_fabrics {
         if let Some(link_type) = link_type {
             writeln!(interface, "\tlink-type {link_type}")?;
         }
+        if let Some(vrf) = vrf {
+            writeln!(interface, "\tvrf {vrf}")?;
+        }
         writeln!(interface, "\tip-forward 1")?;
 
         Ok(interface)
@@ -607,12 +615,14 @@ pub mod pve_rs_sdn_fabrics {
         interfaces: &mut String,
         fabric: &Fabric,
         node: &ConfigNode,
+        vrf: Option<&str>,
     ) -> Result<(), Error> {
         if let Some(ip) = node.ip() {
             let interface = render_interface(
                 &format!("dummy_{}", fabric.id()),
                 Cidr::new_v4(ip, 32)?,
                 Some("dummy"),
+                vrf,
             )?;
             writeln!(interfaces)?;
             write!(interfaces, "{interface}")?;
@@ -623,6 +633,7 @@ pub mod pve_rs_sdn_fabrics {
                 &format!("dummy_{}", fabric.id()),
                 Cidr::new_v6(ip6, 128)?,
                 Some("dummy"),
+                vrf,
             )?;
             writeln!(interfaces)?;
             write!(interfaces, "{interface}")?;
@@ -640,28 +651,35 @@ pub mod pve_rs_sdn_fabrics {
         let config = this.fabric_config.lock().unwrap();
         let mut interfaces = String::new();
 
-        let node_fabrics = config.values().filter_map(|entry| {
-            entry
-                .get_node(&node_id)
-                .map(|node| (entry.fabric(), node))
-                .ok()
-        });
+        let node_fabrics = config
+            .values()
+            .filter_map(|entry| entry.get_node(&node_id).map(|node| (entry, node)).ok());
 
-        for (fabric, node) in node_fabrics {
-            render_dummy_interfaces(&mut interfaces, fabric, node)?;
+        for (entry, node) in node_fabrics {
+            let fabric = entry.fabric();
+            let vrf = entry.fabric_vrf_name();
+            render_dummy_interfaces(&mut interfaces, fabric, node, vrf.as_deref())?;
 
             match node {
                 ConfigNode::Openfabric(node_section) => {
                     for interface in node_section.properties().interfaces() {
                         if let Some(ip) = interface.ip() {
-                            let interface =
-                                render_interface(interface.name(), Cidr::from(ip), None)?;
+                            let interface = render_interface(
+                                interface.name(),
+                                Cidr::from(ip),
+                                None,
+                                vrf.as_deref(),
+                            )?;
                             writeln!(interfaces)?;
                             write!(interfaces, "{interface}")?;
                         }
                         if let Some(ip) = interface.ip6() {
-                            let interface =
-                                render_interface(interface.name(), Cidr::from(ip), None)?;
+                            let interface = render_interface(
+                                interface.name(),
+                                Cidr::from(ip),
+                                None,
+                                vrf.as_deref(),
+                            )?;
                             writeln!(interfaces)?;
                             write!(interfaces, "{interface}")?;
                         }
@@ -678,7 +696,8 @@ pub mod pve_rs_sdn_fabrics {
                             } else {
                                 anyhow::bail!("there has to be a ipv4 or ipv6 node address");
                             });
-                            let interface = render_interface(interface.name(), cidr, None)?;
+                            let interface =
+                                render_interface(interface.name(), cidr, None, vrf.as_deref())?;
                             writeln!(interfaces)?;
                             write!(interfaces, "{interface}")?;
                         }
@@ -688,8 +707,12 @@ pub mod pve_rs_sdn_fabrics {
                     for interface in node_section.properties().interfaces() {
                         writeln!(interfaces)?;
                         if let Some(ip) = interface.ip() {
-                            let interface =
-                                render_interface(interface.name(), Cidr::from(ip), None)?;
+                            let interface = render_interface(
+                                interface.name(),
+                                Cidr::from(ip),
+                                None,
+                                vrf.as_deref(),
+                            )?;
                             write!(interfaces, "{interface}")?;
                         } else {
                             let interface = render_interface(
@@ -698,6 +721,7 @@ pub mod pve_rs_sdn_fabrics {
                                     anyhow::anyhow!("there has to be a ipv4 address")
                                 })?)),
                                 None,
+                                vrf.as_deref(),
                             )?;
                             write!(interfaces, "{interface}")?;
                         }
@@ -765,6 +789,9 @@ pub mod pve_rs_sdn_fabrics {
                             writeln!(interfaces)?;
                             writeln!(interfaces, "auto {name}")?;
                             writeln!(interfaces, "iface {name} inet manual")?;
+                            if let Some(vrf) = &vrf {
+                                writeln!(interfaces, "\tvrf {vrf}")?;
+                            }
                             writeln!(interfaces, "\tip-forward 1")?;
                             writeln!(interfaces, "\tip6-forward 1")?;
                             // BGP unnumbered uses RAs to discover peer link-local
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 65+ messages in thread

* [PATCH proxmox-perl-rs v3 10/32] pve-rs: fabrics: make per-fabric status queries VRF-aware
  2026-11-16 16:11 [PATCH common/manager/network/proxmox{-ve-rs,-perl-rs,-widget-toolkit} v3 00/32] SDN VRF support Gabriel Goller
                   ` (8 preceding siblings ...)
  2026-11-16 16:11 ` [PATCH proxmox-perl-rs v3 09/32] pve-rs: fabrics: assign network interfaces to configured VRFs Gabriel Goller
@ 2026-11-16 16:11 ` Gabriel Goller
  2026-11-18 15:42   ` Stefan Hanreich
  2026-11-16 16:11 ` [PATCH proxmox-perl-rs v3 11/32] pve-rs: fabrics: include VRF routes in aggregate status Gabriel Goller
                   ` (23 subsequent siblings)
  33 siblings, 1 reply; 65+ messages in thread
From: Gabriel Goller @ 2026-11-16 16:11 UTC (permalink / raw)
  To: pve-devel

Use the fabric VRF in FRR route, neighbor, and interface queries for
OSPF and BGP.

Keep the existing commands for fabrics in the default routing table.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
 pve-rs/src/bindings/sdn/fabrics.rs | 63 +++++++++++++++++++-----------
 1 file changed, 41 insertions(+), 22 deletions(-)

diff --git a/pve-rs/src/bindings/sdn/fabrics.rs b/pve-rs/src/bindings/sdn/fabrics.rs
index b7c2d91e5471..381de692acfc 100644
--- a/pve-rs/src/bindings/sdn/fabrics.rs
+++ b/pve-rs/src/bindings/sdn/fabrics.rs
@@ -841,6 +841,7 @@ pub mod pve_rs_sdn_fabrics {
         };
 
         let fabric = config.get_fabric(&fabric_id)?;
+        let vrf = fabric.fabric_vrf_name();
         match fabric {
             FabricEntry::Openfabric(_) => {
                 let openfabric_ipv4_routes_string = String::from_utf8(
@@ -878,12 +879,12 @@ pub mod pve_rs_sdn_fabrics {
                 )
             }
             FabricEntry::Ospf(_) => {
-                let ospf_routes_string = String::from_utf8(
-                    Command::new("sh")
-                        .args(["-c", "vtysh -c 'show ip route ospf json'"])
-                        .output()?
-                        .stdout,
-                )?;
+                let command = match &vrf {
+                    Some(vrf) => format!("vtysh -c 'show ip route vrf {vrf} ospf json'"),
+                    None => "vtysh -c 'show ip route ospf json'".to_string(),
+                };
+                let ospf_routes_string =
+                    String::from_utf8(Command::new("sh").args(["-c", &command]).output()?.stdout)?;
                 let ospf_routes: proxmox_frr::de::Routes = if ospf_routes_string.is_empty() {
                     proxmox_frr::de::Routes::default()
                 } else {
@@ -895,10 +896,18 @@ pub mod pve_rs_sdn_fabrics {
             }
             FabricEntry::WireGuard(_) => Ok(Vec::new()),
             FabricEntry::Bgp(_) => {
+                let ipv4_command = match &vrf {
+                    Some(vrf) => format!("vtysh -c 'show ip route vrf {vrf} bgp json'"),
+                    None => "vtysh -c 'show ip route bgp json'".to_string(),
+                };
+                let ipv6_command = match &vrf {
+                    Some(vrf) => format!("vtysh -c 'show ipv6 route vrf {vrf} bgp json'"),
+                    None => "vtysh -c 'show ipv6 route bgp json'".to_string(),
+                };
                 let bgp_ipv4_routes_string = String::from_utf8(
                     Command::new("sh")
                         .env("VTYSH_HISTFILE", "/dev/null")
-                        .args(["-c", "vtysh -c 'show ip route bgp json'"])
+                        .args(["-c", &ipv4_command])
                         .output()?
                         .stdout,
                 )?;
@@ -906,7 +915,7 @@ pub mod pve_rs_sdn_fabrics {
                 let bgp_ipv6_routes_string = String::from_utf8(
                     Command::new("sh")
                         .env("VTYSH_HISTFILE", "/dev/null")
-                        .args(["-c", "vtysh -c 'show ipv6 route bgp json'"])
+                        .args(["-c", &ipv6_command])
                         .output()?
                         .stdout,
                 )?;
@@ -941,6 +950,7 @@ pub mod pve_rs_sdn_fabrics {
         };
 
         let fabric = config.get_fabric(&fabric_id)?;
+        let vrf = fabric.fabric_vrf_name();
 
         match fabric {
             FabricEntry::Openfabric(_) => {
@@ -961,12 +971,12 @@ pub mod pve_rs_sdn_fabrics {
                 status::get_neighbors_openfabric(fabric_id, openfabric_neighbors).map(|v| v.into())
             }
             FabricEntry::Ospf(fabric) => {
-                let ospf_neighbors_string = String::from_utf8(
-                    Command::new("sh")
-                        .args(["-c", "vtysh -c 'show ip ospf neighbor json'"])
-                        .output()?
-                        .stdout,
-                )?;
+                let command = match &vrf {
+                    Some(vrf) => format!("vtysh -c 'show ip ospf vrf {vrf} neighbor json'"),
+                    None => "vtysh -c 'show ip ospf neighbor json'".to_string(),
+                };
+                let ospf_neighbors_string =
+                    String::from_utf8(Command::new("sh").args(["-c", &command]).output()?.stdout)?;
                 let ospf_neighbors: proxmox_frr::de::ospf::Neighbors =
                     if ospf_neighbors_string.is_empty() {
                         proxmox_frr::de::ospf::Neighbors::default()
@@ -985,10 +995,14 @@ pub mod pve_rs_sdn_fabrics {
             }
             FabricEntry::WireGuard(_) => Ok(status::NeighborStatus::WireGuard(Vec::new())),
             FabricEntry::Bgp(_) => {
+                let command = match &vrf {
+                    Some(vrf) => format!("vtysh -c 'show bgp vrf {vrf} neighbors json'"),
+                    None => "vtysh -c 'show bgp neighbors json'".to_string(),
+                };
                 let bgp_neighbors_string = String::from_utf8(
                     Command::new("sh")
                         .env("VTYSH_HISTFILE", "/dev/null")
-                        .args(["-c", "vtysh -c 'show bgp neighbors json'"])
+                        .args(["-c", &command])
                         .output()?
                         .stdout,
                 )?;
@@ -1018,6 +1032,7 @@ pub mod pve_rs_sdn_fabrics {
         };
 
         let fabric = config.get_fabric(&fabric_id)?;
+        let vrf = fabric.fabric_vrf_name();
 
         match fabric {
             FabricEntry::Openfabric(_) => {
@@ -1039,12 +1054,12 @@ pub mod pve_rs_sdn_fabrics {
                     .map(|v| v.into())
             }
             FabricEntry::Ospf(fabric) => {
-                let ospf_interfaces_string = String::from_utf8(
-                    Command::new("sh")
-                        .args(["-c", "vtysh -c 'show ip ospf interface json'"])
-                        .output()?
-                        .stdout,
-                )?;
+                let command = match &vrf {
+                    Some(vrf) => format!("vtysh -c 'show ip ospf vrf {vrf} interface json'"),
+                    None => "vtysh -c 'show ip ospf interface json'".to_string(),
+                };
+                let ospf_interfaces_string =
+                    String::from_utf8(Command::new("sh").args(["-c", &command]).output()?.stdout)?;
                 let ospf_interfaces: proxmox_frr::de::ospf::Interfaces =
                     if ospf_interfaces_string.is_empty() {
                         proxmox_frr::de::ospf::Interfaces::default()
@@ -1063,10 +1078,14 @@ pub mod pve_rs_sdn_fabrics {
             }
             FabricEntry::WireGuard(_) => Ok(status::InterfaceStatus::WireGuard(Vec::new())),
             FabricEntry::Bgp(_) => {
+                let command = match &vrf {
+                    Some(vrf) => format!("vtysh -c 'show bgp vrf {vrf} neighbors json'"),
+                    None => "vtysh -c 'show bgp neighbors json'".to_string(),
+                };
                 let bgp_neighbors_string = String::from_utf8(
                     Command::new("sh")
                         .env("VTYSH_HISTFILE", "/dev/null")
-                        .args(["-c", "vtysh -c 'show bgp neighbors json'"])
+                        .args(["-c", &command])
                         .output()?
                         .stdout,
                 )?;
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 65+ messages in thread

* [PATCH proxmox-perl-rs v3 11/32] pve-rs: fabrics: include VRF routes in aggregate status
  2026-11-16 16:11 [PATCH common/manager/network/proxmox{-ve-rs,-perl-rs,-widget-toolkit} v3 00/32] SDN VRF support Gabriel Goller
                   ` (9 preceding siblings ...)
  2026-11-16 16:11 ` [PATCH proxmox-perl-rs v3 10/32] pve-rs: fabrics: make per-fabric status queries VRF-aware Gabriel Goller
@ 2026-11-16 16:11 ` Gabriel Goller
  2026-11-16 16:11 ` [PATCH proxmox-perl-rs v3 12/32] pve-rs: fabrics: expose host interface membership Gabriel Goller
                   ` (22 subsequent siblings)
  33 siblings, 0 replies; 65+ messages in thread
From: Gabriel Goller @ 2026-11-16 16:11 UTC (permalink / raw)
  To: pve-devel

Collect OSPF and BGP routes from every VRF used by a fabric on the
local node, in addition to routes from the default routing table. Run
the related commands in one vtysh process and merge their JSON output,
including entries which share the same prefix.

Match routes by VRF when deciding whether a fabric has active routes.
This prevents routes from another routing table from affecting its
status. Add a parser test for duplicate prefixes across VRFs.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
 pve-rs/src/bindings/sdn/fabrics.rs | 211 ++++++++++++++++++-----------
 pve-rs/src/sdn/status.rs           | 149 ++++++++++++++++----
 2 files changed, 251 insertions(+), 109 deletions(-)

diff --git a/pve-rs/src/bindings/sdn/fabrics.rs b/pve-rs/src/bindings/sdn/fabrics.rs
index 381de692acfc..669bca6d2492 100644
--- a/pve-rs/src/bindings/sdn/fabrics.rs
+++ b/pve-rs/src/bindings/sdn/fabrics.rs
@@ -5,7 +5,7 @@ pub mod pve_rs_sdn_fabrics {
     //! This provides the configuration for the SDN fabrics, as well as helper methods for reading
     //! / writing the configuration, as well as for generating ifupdown2 and FRR configuration.
 
-    use std::collections::{BTreeMap, HashMap, HashSet};
+    use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet};
     use std::fmt::Write;
     use std::net::IpAddr;
     use std::ops::Deref;
@@ -977,13 +977,15 @@ pub mod pve_rs_sdn_fabrics {
                 };
                 let ospf_neighbors_string =
                     String::from_utf8(Command::new("sh").args(["-c", &command]).output()?.stdout)?;
-                let ospf_neighbors: proxmox_frr::de::ospf::Neighbors =
-                    if ospf_neighbors_string.is_empty() {
-                        proxmox_frr::de::ospf::Neighbors::default()
-                    } else {
-                        serde_json::from_str(&ospf_neighbors_string)
-                            .with_context(|| "error parsing ospf neighbors")?
-                    };
+                let ospf_neighbors = if ospf_neighbors_string.is_empty() {
+                    proxmox_frr::de::ospf::Neighbors::default()
+                } else {
+                    let output = serde_json::from_str(&ospf_neighbors_string)
+                        .with_context(|| "error parsing ospf neighbors")?;
+                    let output = status::extract_vrf_status(output, vrf.as_deref())?;
+                    serde_json::from_value(output)
+                        .with_context(|| "error parsing ospf neighbors")?
+                };
 
                 status::get_neighbors_ospf(
                     fabric_id,
@@ -1060,13 +1062,15 @@ pub mod pve_rs_sdn_fabrics {
                 };
                 let ospf_interfaces_string =
                     String::from_utf8(Command::new("sh").args(["-c", &command]).output()?.stdout)?;
-                let ospf_interfaces: proxmox_frr::de::ospf::Interfaces =
-                    if ospf_interfaces_string.is_empty() {
-                        proxmox_frr::de::ospf::Interfaces::default()
-                    } else {
-                        serde_json::from_str(&ospf_interfaces_string)
-                            .with_context(|| "error parsing ospf interfaces")?
-                    };
+                let ospf_interfaces = if ospf_interfaces_string.is_empty() {
+                    proxmox_frr::de::ospf::Interfaces::default()
+                } else {
+                    let output = serde_json::from_str(&ospf_interfaces_string)
+                        .with_context(|| "error parsing ospf interfaces")?;
+                    let output = status::extract_vrf_status(output, vrf.as_deref())?;
+                    serde_json::from_value(output)
+                        .with_context(|| "error parsing ospf interfaces")?
+                };
 
                 status::get_interfaces_ospf(
                     fabric_id,
@@ -1102,6 +1106,78 @@ pub mod pve_rs_sdn_fabrics {
         }
     }
 
+    fn extend_routes(destination: &mut proxmox_frr::de::Routes, source: proxmox_frr::de::Routes) {
+        for (prefix, routes) in source.0 {
+            destination.0.entry(prefix).or_default().extend(routes);
+        }
+    }
+
+    /// Query and merge routes from multiple FRR commands in a single `vtysh` process.
+    ///
+    /// The exit status is ignored, like in the single-command queries: if FRR is not running,
+    /// `vtysh` fails without printing anything to stdout, which yields no routes. This is polled
+    /// by pvestatd, so an error here would be logged on every cycle.
+    fn query_routes(
+        commands: impl IntoIterator<Item = String>,
+        protocol: &str,
+    ) -> Result<proxmox_frr::de::Routes, Error> {
+        let mut command = Command::new("vtysh");
+        command.env("VTYSH_HISTFILE", "/dev/null");
+        for query in commands {
+            command.args(["-c", &query]);
+        }
+
+        let output = match command.output() {
+            Ok(output) => output,
+            Err(err) if err.kind() == std::io::ErrorKind::NotFound => {
+                return Ok(proxmox_frr::de::Routes::default());
+            }
+            Err(err) => return Err(err.into()),
+        };
+
+        parse_routes(&output.stdout, protocol)
+    }
+
+    fn parse_routes(raw: &[u8], protocol: &str) -> Result<proxmox_frr::de::Routes, Error> {
+        let mut routes = proxmox_frr::de::Routes::default();
+        let route_stream =
+            serde_json::Deserializer::from_slice(raw).into_iter::<proxmox_frr::de::Routes>();
+        for queried_routes in route_stream {
+            extend_routes(
+                &mut routes,
+                queried_routes.with_context(|| format!("error parsing {protocol} routes"))?,
+            );
+        }
+
+        Ok(routes)
+    }
+
+    #[cfg(test)]
+    mod tests {
+        use super::parse_routes;
+
+        #[test]
+        fn parses_batched_routes_with_duplicate_prefixes() {
+            let raw = br#"
+                {"10.0.0.0/24":[{"nexthops":[],"metric":10,"protocol":"bgp","vrfName":"vrf_a"}]}
+                {"10.0.0.0/24":[{"nexthops":[],"metric":10,"protocol":"bgp","vrfName":"vrf_b"}]}
+            "#;
+
+            let routes = parse_routes(raw, "BGP").expect("batched routes should parse");
+            let routes = routes.0.values().next().expect("route should exist");
+
+            assert_eq!(routes.len(), 2);
+            assert_eq!(routes[0].vrf_name, "vrf_a");
+            assert_eq!(routes[1].vrf_name, "vrf_b");
+        }
+
+        #[test]
+        fn parses_empty_output() {
+            let routes = parse_routes(b"", "BGP").expect("empty output should parse");
+            assert!(routes.0.is_empty());
+        }
+    }
+
     /// Return the status of all fabrics on this node.
     ///
     /// Go through all fabrics in the config, then filter out the ones that exist on this node.
@@ -1117,76 +1193,47 @@ pub mod pve_rs_sdn_fabrics {
             return Ok(HashMap::new());
         };
 
-        let openfabric_ipv4_routes_string = String::from_utf8(
-            Command::new("sh")
-                .args(["-c", "vtysh -c 'show ip route openfabric json'"])
-                .output()?
-                .stdout,
-        )?;
-
-        let openfabric_ipv6_routes_string = String::from_utf8(
-            Command::new("sh")
-                .args(["-c", "vtysh -c 'show ipv6 route openfabric json'"])
-                .output()?
-                .stdout,
-        )?;
-
-        let ospf_routes_string = String::from_utf8(
-            Command::new("sh")
-                .args(["-c", "vtysh -c 'show ip route ospf json'"])
-                .output()?
-                .stdout,
+        let openfabric_routes = query_routes(
+            [
+                "show ip route openfabric json".to_string(),
+                "show ipv6 route openfabric json".to_string(),
+            ],
+            "OpenFabric",
         )?;
 
-        let mut openfabric_routes: proxmox_frr::de::Routes =
-            if openfabric_ipv4_routes_string.is_empty() {
-                proxmox_frr::de::Routes::default()
-            } else {
-                serde_json::from_str(&openfabric_ipv4_routes_string)
-                    .with_context(|| "error parsing openfabric ipv4 routes")?
-            };
-        if !openfabric_ipv6_routes_string.is_empty() {
-            let openfabric_ipv6_routes: proxmox_frr::de::Routes =
-                serde_json::from_str(&openfabric_ipv6_routes_string)
-                    .with_context(|| "error parsing openfabric ipv6 routes")?;
-            openfabric_routes.0.extend(openfabric_ipv6_routes.0);
-        }
-
-        let ospf_routes: proxmox_frr::de::Routes = if ospf_routes_string.is_empty() {
-            proxmox_frr::de::Routes::default()
-        } else {
-            serde_json::from_str(&ospf_routes_string)
-                .with_context(|| "error parsing ospf routes")?
-        };
-
-        let bgp_ipv4_routes_string = String::from_utf8(
-            Command::new("sh")
-                .env("VTYSH_HISTFILE", "/dev/null")
-                .args(["-c", "vtysh -c 'show ip route bgp json'"])
-                .output()?
-                .stdout,
-        )?;
-
-        let bgp_ipv6_routes_string = String::from_utf8(
-            Command::new("sh")
-                .env("VTYSH_HISTFILE", "/dev/null")
-                .args(["-c", "vtysh -c 'show ipv6 route bgp json'"])
-                .output()?
-                .stdout,
-        )?;
-
-        let mut bgp_routes: proxmox_frr::de::Routes = if bgp_ipv4_routes_string.is_empty() {
-            proxmox_frr::de::Routes::default()
-        } else {
-            serde_json::from_str(&bgp_ipv4_routes_string)
-                .with_context(|| "error parsing bgp ipv4 routes")?
-        };
-        if !bgp_ipv6_routes_string.is_empty() {
-            let bgp_ipv6_routes: proxmox_frr::de::Routes =
-                serde_json::from_str(&bgp_ipv6_routes_string)
-                    .with_context(|| "error parsing bgp ipv6 routes")?;
-            bgp_routes.0.extend(bgp_ipv6_routes.0);
+        let node_id = NodeId::from_string(proxmox_sys::nodename().to_string())?;
+        let ospf_vrfs: BTreeSet<_> = config
+            .values()
+            .filter(|entry| {
+                matches!(entry, FabricEntry::Ospf(_)) && entry.get_node(&node_id).is_ok()
+            })
+            .filter_map(FabricEntry::fabric_vrf_name)
+            .collect();
+        let mut ospf_commands = vec!["show ip route ospf json".to_string()];
+        ospf_commands.extend(
+            ospf_vrfs
+                .iter()
+                .map(|vrf| format!("show ip route vrf {vrf} ospf json")),
+        );
+        let ospf_routes = query_routes(ospf_commands, "OSPF")?;
+
+        let bgp_vrfs: BTreeSet<_> = config
+            .values()
+            .filter(|entry| {
+                matches!(entry, FabricEntry::Bgp(_)) && entry.get_node(&node_id).is_ok()
+            })
+            .filter_map(FabricEntry::fabric_vrf_name)
+            .collect();
+        let mut bgp_commands = vec![
+            "show ip route bgp json".to_string(),
+            "show ipv6 route bgp json".to_string(),
+        ];
+        for vrf in bgp_vrfs {
+            bgp_commands.extend(
+                ["ip", "ipv6"].map(|family| format!("show {family} route vrf {vrf} bgp json")),
+            );
         }
+        let bgp_routes = query_routes(bgp_commands, "BGP")?;
 
         let route_status = status::RoutesParsed {
             openfabric: openfabric_routes,
diff --git a/pve-rs/src/sdn/status.rs b/pve-rs/src/sdn/status.rs
index 7a1334d20804..369fe3a982b2 100644
--- a/pve-rs/src/sdn/status.rs
+++ b/pve-rs/src/sdn/status.rs
@@ -355,6 +355,20 @@ pub fn get_neighbors_openfabric(
     Ok(stats)
 }
 
+/// Extract status output nested under a VRF name, or return non-VRF output unchanged.
+pub fn extract_vrf_status(
+    mut output: serde_json::Value,
+    vrf: Option<&str>,
+) -> Result<serde_json::Value, anyhow::Error> {
+    match vrf {
+        Some(vrf) => output
+            .get_mut(vrf)
+            .map(serde_json::Value::take)
+            .ok_or_else(|| anyhow::anyhow!("missing status for VRF '{vrf}'")),
+        None => Ok(output),
+    }
+}
+
 /// Convert the parsed ospf neighbor neighbor information into a list of [`ospf::NeighborStatus`].
 ///
 /// Ospf does not use the name of the fabric at all, so we again need to retrieve the interfaces of
@@ -535,6 +549,10 @@ pub fn get_status(
             continue;
         }
         let fabric_id = node.id().fabric_id();
+        let vrf_name = config
+            .get_fabric(fabric_id)?
+            .fabric_vrf_name()
+            .unwrap_or_else(|| "default".to_string());
 
         let (current_protocol, all_routes) = match &node {
             ConfigNode::Openfabric(_) => (Protocol::Openfabric, &routes.openfabric.0),
@@ -565,13 +583,14 @@ pub fn get_status(
         // determine status by checking if any routes exist for our interfaces
         let has_routes = all_routes.values().any(|v| {
             v.iter().any(|route| {
-                route.nexthops.iter().any(|nexthop| {
-                    if let Some(iface_name) = &nexthop.interface_name {
-                        interface_names.contains(iface_name.as_str())
-                    } else {
-                        false
-                    }
-                })
+                route.vrf_name == vrf_name
+                    && route.nexthops.iter().any(|nexthop| {
+                        if let Some(iface_name) = &nexthop.interface_name {
+                            interface_names.contains(iface_name.as_str())
+                        } else {
+                            false
+                        }
+                    })
             })
         });
 
@@ -1400,11 +1419,8 @@ mod tests {
             }
             "#;
 
-            let neighbors: de::ospf::Neighbors = if json_output.is_empty() {
-                de::ospf::Neighbors::default()
-            } else {
-                serde_json::from_str(json_output).expect("error parsing json output")
-            };
+            let neighbors: de::ospf::Neighbors =
+                serde_json::from_str(json_output).expect("error parsing json output");
 
             let fabric_config = sample_one_fabric_config();
 
@@ -1436,6 +1452,94 @@ mod tests {
             assert_eq!(reference, output);
         }
 
+        #[test]
+        fn neighbors_vrf() {
+            let json_output = r#"
+            {
+              "vrf_vrf": {
+                "vrfName": "vrf_vrf",
+                "vrfId": 6,
+                "neighbors": {
+                  "4.4.4.3": [{
+                    "nbrState": "Full\/-",
+                    "upTime": "13m35s",
+                    "ifaceAddress": "4.4.4.3",
+                    "ifaceName": "nic1:4.4.4.1"
+                  }],
+                  "4.4.4.2": [{
+                    "nbrState": "Full\/-",
+                    "upTime": "13m35s",
+                    "ifaceAddress": "4.4.4.2",
+                    "ifaceName": "nic2:4.4.4.1"
+                  }]
+                }
+              },
+              "other_vrf": { "neighbors": {} }
+            }
+            "#;
+
+            let output = serde_json::from_str(json_output).unwrap();
+            let output = extract_vrf_status(output, Some("vrf_vrf")).unwrap();
+            let neighbors: de::ospf::Neighbors = serde_json::from_value(output).unwrap();
+            assert_eq!(neighbors.neighbors.len(), 2);
+            for (address, interface) in [("4.4.4.3", "nic1"), ("4.4.4.2", "nic2")] {
+                let neighbor = &neighbors.neighbors[address];
+                assert_eq!(neighbor.len(), 1);
+                assert_eq!(neighbor[0].interface_address, address);
+                assert_eq!(neighbor[0].interface_name, format!("{interface}:4.4.4.1"));
+                assert_eq!(neighbor[0].neighbor_state, "Full/-");
+                assert_eq!(neighbor[0].up_time, "13m35s");
+            }
+        }
+
+        #[test]
+        fn interfaces_vrf() {
+            let json_output = r#"
+            {
+              "vrf_vrf": {
+                "vrfName": "vrf_vrf",
+                "vrfId": 6,
+                "interfaces": {
+                  "dummy_fabric": { "ifUp": true, "networkType": "BROADCAST" },
+                  "nic1": { "ifUp": true, "networkType": "POINTOPOINT" },
+                  "nic2": { "ifUp": true, "networkType": "POINTOPOINT" }
+                }
+              },
+              "other_vrf": { "interfaces": {} }
+            }
+            "#;
+
+            let output = serde_json::from_str(json_output).unwrap();
+            let output = extract_vrf_status(output, Some("vrf_vrf")).unwrap();
+            let interfaces: de::ospf::Interfaces = serde_json::from_value(output).unwrap();
+            assert_eq!(interfaces.interfaces.len(), 3);
+            for (name, ty) in [
+                ("dummy_fabric", de::ospf::NetworkType::Broadcast),
+                ("nic1", de::ospf::NetworkType::PointToPoint),
+                ("nic2", de::ospf::NetworkType::PointToPoint),
+            ] {
+                let interface = &interfaces.interfaces[name];
+                assert!(interface.if_up);
+                assert_eq!(interface.network_type, ty);
+            }
+        }
+
+        #[test]
+        fn extract_non_vrf_status() {
+            for output in [
+                serde_json::json!({ "neighbors": {} }),
+                serde_json::json!({ "interfaces": {} }),
+            ] {
+                assert_eq!(extract_vrf_status(output.clone(), None).unwrap(), output);
+            }
+        }
+
+        #[test]
+        fn extract_missing_vrf_status() {
+            let output = serde_json::json!({ "other_vrf": { "neighbors": {} } });
+            assert!(extract_vrf_status(output, Some("vrf_vrf")).is_err());
+        }
+
         #[test]
         fn neighbors_multiple_areas() {
             let json_output = r#"
@@ -1509,11 +1613,8 @@ mod tests {
             }
             "#;
 
-            let neighbors: de::ospf::Neighbors = if json_output.is_empty() {
-                de::ospf::Neighbors::default()
-            } else {
-                serde_json::from_str(json_output).expect("error parsing json output")
-            };
+            let neighbors: de::ospf::Neighbors =
+                serde_json::from_str(json_output).expect("error parsing json output");
 
             let fabric_config = sample_two_fabric_config();
 
@@ -1672,11 +1773,8 @@ mod tests {
             }
             "#;
 
-            let interfaces: de::ospf::Interfaces = if json_output.is_empty() {
-                de::ospf::Interfaces::default()
-            } else {
-                serde_json::from_str(json_output).expect("error parsing json output")
-            };
+            let interfaces: de::ospf::Interfaces =
+                serde_json::from_str(json_output).expect("error parsing json output");
 
             let fabric_config = sample_one_fabric_config();
 
@@ -1904,11 +2002,8 @@ mod tests {
             }
             "#;
 
-            let interfaces: de::ospf::Interfaces = if json_output.is_empty() {
-                de::ospf::Interfaces::default()
-            } else {
-                serde_json::from_str(json_output).expect("error parsing json output")
-            };
+            let interfaces: de::ospf::Interfaces =
+                serde_json::from_str(json_output).expect("error parsing json output");
 
             let fabric_config = sample_two_fabric_config();
 
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 65+ messages in thread

* [PATCH proxmox-perl-rs v3 12/32] pve-rs: fabrics: expose host interface membership
  2026-11-16 16:11 [PATCH common/manager/network/proxmox{-ve-rs,-perl-rs,-widget-toolkit} v3 00/32] SDN VRF support Gabriel Goller
                   ` (10 preceding siblings ...)
  2026-11-16 16:11 ` [PATCH proxmox-perl-rs v3 11/32] pve-rs: fabrics: include VRF routes in aggregate status Gabriel Goller
@ 2026-11-16 16:11 ` Gabriel Goller
  2026-11-16 16:11 ` [PATCH proxmox-perl-rs v3 13/32] sdn: expose static routes for simple zone uplinks Gabriel Goller
                   ` (21 subsequent siblings)
  33 siblings, 0 replies; 65+ messages in thread
From: Gabriel Goller @ 2026-11-16 16:11 UTC (permalink / raw)
  To: pve-devel

Allow the host network editor to identify fabric-managed interfaces from
the parsed configuration rather than reparsing API property strings.
This keeps the VRF field under fabric control without locking unrelated
interface settings.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
 pve-rs/src/bindings/sdn/fabrics.rs | 36 ++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/pve-rs/src/bindings/sdn/fabrics.rs b/pve-rs/src/bindings/sdn/fabrics.rs
index 669bca6d2492..8a2255de9da3 100644
--- a/pve-rs/src/bindings/sdn/fabrics.rs
+++ b/pve-rs/src/bindings/sdn/fabrics.rs
@@ -484,6 +484,42 @@ pub mod pve_rs_sdn_fabrics {
         ifaces
     }
 
+    /// Method: Check whether an interface is configured in a fabric on the given node.
+    #[export]
+    pub fn is_fabric_interface(
+        #[try_from_ref] this: &PerlFabricConfig,
+        node_id: NodeId,
+        interface_name: &str,
+    ) -> bool {
+        let config = this.fabric_config.lock().unwrap();
+
+        config
+            .values()
+            .filter_map(|entry| entry.get_node(&node_id).ok())
+            .any(|node| match node {
+                ConfigNode::Openfabric(node) => node
+                    .properties()
+                    .interfaces()
+                    .any(|interface| interface.name().as_str() == interface_name),
+                ConfigNode::Ospf(node) => node
+                    .properties()
+                    .interfaces()
+                    .any(|interface| interface.name().as_str() == interface_name),
+                ConfigNode::WireGuard(node) => match node.properties() {
+                    WireGuardNode::Internal(properties) => properties
+                        .interfaces()
+                        .any(|interface| interface.name().as_str() == interface_name),
+                    WireGuardNode::External(_) => false,
+                },
+                ConfigNode::Bgp(node) => match node.properties() {
+                    BgpNode::Internal(properties) => properties
+                        .interfaces()
+                        .any(|interface| interface.name().as_str() == interface_name),
+                    BgpNode::External(_) => false,
+                },
+            })
+    }
+
     /// Method: Return all FRR daemons that need to be enabled for this fabric configuration
     /// instance.
     ///
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 65+ messages in thread

* [PATCH proxmox-perl-rs v3 13/32] sdn: expose static routes for simple zone uplinks
  2026-11-16 16:11 [PATCH common/manager/network/proxmox{-ve-rs,-perl-rs,-widget-toolkit} v3 00/32] SDN VRF support Gabriel Goller
                   ` (11 preceding siblings ...)
  2026-11-16 16:11 ` [PATCH proxmox-perl-rs v3 12/32] pve-rs: fabrics: expose host interface membership Gabriel Goller
@ 2026-11-16 16:11 ` Gabriel Goller
  2026-11-16 16:11 ` [PATCH pve-network v3 14/32] sdn: evpn: add unreachable IPv6 default route to zone VRFs Gabriel Goller
                   ` (20 subsequent siblings)
  33 siblings, 0 replies; 65+ messages in thread
From: Gabriel Goller @ 2026-11-16 16:11 UTC (permalink / raw)
  To: pve-devel

Allow zone configuration to provide static routes for simple zone VRFs,
so upstream connectivity does not require node-local FRR overrides.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
 pve-rs/src/bindings/sdn/mod.rs | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/pve-rs/src/bindings/sdn/mod.rs b/pve-rs/src/bindings/sdn/mod.rs
index dcae046a7e46..5231e05e3c2e 100644
--- a/pve-rs/src/bindings/sdn/mod.rs
+++ b/pve-rs/src/bindings/sdn/mod.rs
@@ -10,15 +10,32 @@ pub mod pve_rs_sdn {
     //! This provides general methods for generating the frr config.
 
     use anyhow::Error;
-    use proxmox_frr::ser::{FrrConfig, serializer::to_raw_config};
+    use proxmox_frr::ser::{FrrConfig, IpRoute, serializer::to_raw_config};
+    use proxmox_schema::property_string::PropertyString;
 
     use proxmox_ve_config::common::valid::Validatable;
     use proxmox_ve_config::sdn::fabric::section_config::node::NodeId;
+    use proxmox_ve_config::sdn::static_route::{StaticRoute, ZoneRoutesConfig};
 
     use crate::bindings::pve_rs_sdn_fabrics::PerlFabricConfig;
     use crate::bindings::sdn::prefix_lists::pve_rs_sdn_prefix_lists::PerlPrefixListConfig;
     use crate::bindings::sdn::route_maps::pve_rs_sdn_route_maps::PerlRouteMapConfig;
 
+    /// Validate a route property string before storing it in zones.cfg.
+    #[export]
+    pub fn validate_static_route(route: &str) -> Result<(), Error> {
+        route.parse::<PropertyString<StaticRoute>>()?.validate()
+    }
+
+    /// Return static routes for Simple/EVPN zones participating on this node.
+    #[export]
+    pub fn get_zone_routes(
+        zones: ZoneRoutesConfig,
+        node_id: NodeId,
+    ) -> Result<Vec<IpRoute>, Error> {
+        zones.routes_for_node(node_id.as_ref())
+    }
+
     /// Return the FRR configuration for the passed FrrConfig and the FabricsConfig as an array of
     /// strings, where each line represents a line in the FRR configuration.
     #[export]
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 65+ messages in thread

* [PATCH pve-network v3 14/32] sdn: evpn: add unreachable IPv6 default route to zone VRFs
  2026-11-16 16:11 [PATCH common/manager/network/proxmox{-ve-rs,-perl-rs,-widget-toolkit} v3 00/32] SDN VRF support Gabriel Goller
                   ` (12 preceding siblings ...)
  2026-11-16 16:11 ` [PATCH proxmox-perl-rs v3 13/32] sdn: expose static routes for simple zone uplinks Gabriel Goller
@ 2026-11-16 16:11 ` Gabriel Goller
  2026-11-18 16:08   ` Stefan Hanreich
  2026-11-16 16:11 ` [PATCH pve-network v3 15/32] sdn: add optional VRFs for simple zones Gabriel Goller
                   ` (19 subsequent siblings)
  33 siblings, 1 reply; 65+ messages in thread
From: Gabriel Goller @ 2026-11-16 16:11 UTC (permalink / raw)
  To: pve-devel

Without a family flag, ip route only adds the IPv4 unreachable default
route. IPv6 lookups that find no route in the VRF table therefore fall
through to the main table on non-exit nodes, e.g. before FRR has
installed the default route from the exit nodes.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
 src/PVE/Network/SDN/Zones/EvpnPlugin.pm               | 11 ++++-------
 .../evpn/advertise_subnets/expected_sdn_interfaces    |  1 +
 src/test/zones/evpn/auto_mode/expected_sdn_interfaces |  1 +
 src/test/zones/evpn/bgp_ebgp/expected_sdn_interfaces  |  1 +
 .../evpn/bgp_ebgp_multihop/expected_sdn_interfaces    |  1 +
 .../bgp_ebgp_reverse_order/expected_sdn_interfaces    |  1 +
 .../expected_sdn_interfaces                           |  1 +
 .../zones/evpn/bgp_fabric/expected_sdn_interfaces     |  1 +
 .../zones/evpn/bgp_loopback/expected_sdn_interfaces   |  1 +
 .../evpn/bgp_multipath_relax/expected_sdn_interfaces  |  1 +
 .../evpn/combined_bgp_isis/expected_sdn_interfaces    |  1 +
 .../expected_sdn_interfaces                           |  1 +
 src/test/zones/evpn/ebgp/expected_sdn_interfaces      |  1 +
 .../expected_sdn_interfaces                           |  1 +
 .../expected_sdn_interfaces                           |  1 +
 .../expected_sdn_interfaces                           |  2 ++
 .../zones/evpn/ebgp_loopback/expected_sdn_interfaces  |  1 +
 .../expected_sdn_interfaces                           |  1 +
 .../expected_sdn_interfaces                           |  2 ++
 src/test/zones/evpn/exitnode/expected_sdn_interfaces  |  1 +
 .../exitnode_local_routing/expected_sdn_interfaces    |  1 +
 .../expected_sdn_interfaces                           |  1 +
 .../evpn/exitnode_primary/expected_sdn_interfaces     |  1 +
 .../zones/evpn/exitnode_snat/expected_sdn_interfaces  |  1 +
 .../evpn/exitnodenullroute/expected_sdn_interfaces    |  2 ++
 .../evpn/frr_local_merge/expected_sdn_interfaces      |  1 +
 .../expected_sdn_interfaces                           |  1 +
 src/test/zones/evpn/ipv4/expected_sdn_interfaces      |  1 +
 src/test/zones/evpn/ipv4ipv6/expected_sdn_interfaces  |  1 +
 .../evpn/ipv4ipv6nogateway/expected_sdn_interfaces    |  1 +
 src/test/zones/evpn/ipv6/expected_sdn_interfaces      |  1 +
 .../zones/evpn/ipv6underlay/expected_sdn_interfaces   |  1 +
 src/test/zones/evpn/isis/expected_sdn_interfaces      |  1 +
 .../zones/evpn/isis_loopback/expected_sdn_interfaces  |  1 +
 .../evpn/multipath_relax/expected_sdn_interfaces      |  1 +
 .../zones/evpn/multiplezones/expected_sdn_interfaces  |  2 ++
 .../evpn/openfabric_fabric/expected_sdn_interfaces    |  1 +
 .../openfabric_fabric_ipv6/expected_sdn_interfaces    |  1 +
 .../expected_sdn_interfaces                           |  1 +
 .../zones/evpn/ospf_fabric/expected_sdn_interfaces    |  1 +
 src/test/zones/evpn/routemap/expected_sdn_interfaces  |  1 +
 .../evpn/routemap_exit_node/expected_sdn_interfaces   |  1 +
 .../evpn/routemap_prefix_list/expected_sdn_interfaces |  1 +
 src/test/zones/evpn/rt_import/expected_sdn_interfaces |  1 +
 src/test/zones/evpn/vxlanport/expected_sdn_interfaces |  1 +
 45 files changed, 52 insertions(+), 7 deletions(-)

diff --git a/src/PVE/Network/SDN/Zones/EvpnPlugin.pm b/src/PVE/Network/SDN/Zones/EvpnPlugin.pm
index c31b6c6a2bfd..45a628d6a69d 100644
--- a/src/PVE/Network/SDN/Zones/EvpnPlugin.pm
+++ b/src/PVE/Network/SDN/Zones/EvpnPlugin.pm
@@ -317,13 +317,10 @@ sub generate_sdn_config {
         #vrf interface
         @iface_config = ();
         push @iface_config, "vrf-table auto";
-        if (!$is_evpn_gateway) {
-            push @iface_config,
-                "post-up ip route add vrf $vrf_iface unreachable default metric 4278198272";
-        } else {
-            push @iface_config,
-                "post-up ip route del vrf $vrf_iface unreachable default metric 4278198272";
-        }
+        my $route_action = $is_evpn_gateway ? 'del' : 'add';
+        push @iface_config,
+            "post-up ip route $route_action vrf $vrf_iface unreachable default metric 4278198272",
+            "post-up ip -6 route $route_action vrf $vrf_iface unreachable default metric 4278198272";
 
         push(@{ $config->{$vrf_iface} }, @iface_config) if !$config->{$vrf_iface};
 
diff --git a/src/test/zones/evpn/advertise_subnets/expected_sdn_interfaces b/src/test/zones/evpn/advertise_subnets/expected_sdn_interfaces
index 9d1c64c0f3fa..4ff3c840dcb8 100644
--- a/src/test/zones/evpn/advertise_subnets/expected_sdn_interfaces
+++ b/src/test/zones/evpn/advertise_subnets/expected_sdn_interfaces
@@ -16,6 +16,7 @@ auto vrf_myzone
 iface vrf_myzone
 	vrf-table auto
 	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
+	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
 
 auto vrfbr_myzone
 iface vrfbr_myzone
diff --git a/src/test/zones/evpn/auto_mode/expected_sdn_interfaces b/src/test/zones/evpn/auto_mode/expected_sdn_interfaces
index 4cf13e05e688..c898bc2a5976 100644
--- a/src/test/zones/evpn/auto_mode/expected_sdn_interfaces
+++ b/src/test/zones/evpn/auto_mode/expected_sdn_interfaces
@@ -15,6 +15,7 @@ auto vrf_myzone
 iface vrf_myzone
 	vrf-table auto
 	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
+	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
 
 auto vrfbr_myzone
 iface vrfbr_myzone
diff --git a/src/test/zones/evpn/bgp_ebgp/expected_sdn_interfaces b/src/test/zones/evpn/bgp_ebgp/expected_sdn_interfaces
index 4cf13e05e688..c898bc2a5976 100644
--- a/src/test/zones/evpn/bgp_ebgp/expected_sdn_interfaces
+++ b/src/test/zones/evpn/bgp_ebgp/expected_sdn_interfaces
@@ -15,6 +15,7 @@ auto vrf_myzone
 iface vrf_myzone
 	vrf-table auto
 	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
+	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
 
 auto vrfbr_myzone
 iface vrfbr_myzone
diff --git a/src/test/zones/evpn/bgp_ebgp_multihop/expected_sdn_interfaces b/src/test/zones/evpn/bgp_ebgp_multihop/expected_sdn_interfaces
index 4cf13e05e688..c898bc2a5976 100644
--- a/src/test/zones/evpn/bgp_ebgp_multihop/expected_sdn_interfaces
+++ b/src/test/zones/evpn/bgp_ebgp_multihop/expected_sdn_interfaces
@@ -15,6 +15,7 @@ auto vrf_myzone
 iface vrf_myzone
 	vrf-table auto
 	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
+	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
 
 auto vrfbr_myzone
 iface vrfbr_myzone
diff --git a/src/test/zones/evpn/bgp_ebgp_reverse_order/expected_sdn_interfaces b/src/test/zones/evpn/bgp_ebgp_reverse_order/expected_sdn_interfaces
index 4cf13e05e688..c898bc2a5976 100644
--- a/src/test/zones/evpn/bgp_ebgp_reverse_order/expected_sdn_interfaces
+++ b/src/test/zones/evpn/bgp_ebgp_reverse_order/expected_sdn_interfaces
@@ -15,6 +15,7 @@ auto vrf_myzone
 iface vrf_myzone
 	vrf-table auto
 	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
+	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
 
 auto vrfbr_myzone
 iface vrfbr_myzone
diff --git a/src/test/zones/evpn/bgp_evpn_routemap_prefix_list/expected_sdn_interfaces b/src/test/zones/evpn/bgp_evpn_routemap_prefix_list/expected_sdn_interfaces
index 4cf13e05e688..c898bc2a5976 100644
--- a/src/test/zones/evpn/bgp_evpn_routemap_prefix_list/expected_sdn_interfaces
+++ b/src/test/zones/evpn/bgp_evpn_routemap_prefix_list/expected_sdn_interfaces
@@ -15,6 +15,7 @@ auto vrf_myzone
 iface vrf_myzone
 	vrf-table auto
 	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
+	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
 
 auto vrfbr_myzone
 iface vrfbr_myzone
diff --git a/src/test/zones/evpn/bgp_fabric/expected_sdn_interfaces b/src/test/zones/evpn/bgp_fabric/expected_sdn_interfaces
index fd16853cd00e..816ddda444e7 100644
--- a/src/test/zones/evpn/bgp_fabric/expected_sdn_interfaces
+++ b/src/test/zones/evpn/bgp_fabric/expected_sdn_interfaces
@@ -16,6 +16,7 @@ auto vrf_evpn
 iface vrf_evpn
 	vrf-table auto
 	post-up ip route add vrf vrf_evpn unreachable default metric 4278198272
+	post-up ip -6 route add vrf vrf_evpn unreachable default metric 4278198272
 
 auto vrfbr_evpn
 iface vrfbr_evpn
diff --git a/src/test/zones/evpn/bgp_loopback/expected_sdn_interfaces b/src/test/zones/evpn/bgp_loopback/expected_sdn_interfaces
index 4cf13e05e688..c898bc2a5976 100644
--- a/src/test/zones/evpn/bgp_loopback/expected_sdn_interfaces
+++ b/src/test/zones/evpn/bgp_loopback/expected_sdn_interfaces
@@ -15,6 +15,7 @@ auto vrf_myzone
 iface vrf_myzone
 	vrf-table auto
 	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
+	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
 
 auto vrfbr_myzone
 iface vrfbr_myzone
diff --git a/src/test/zones/evpn/bgp_multipath_relax/expected_sdn_interfaces b/src/test/zones/evpn/bgp_multipath_relax/expected_sdn_interfaces
index 4cf13e05e688..c898bc2a5976 100644
--- a/src/test/zones/evpn/bgp_multipath_relax/expected_sdn_interfaces
+++ b/src/test/zones/evpn/bgp_multipath_relax/expected_sdn_interfaces
@@ -15,6 +15,7 @@ auto vrf_myzone
 iface vrf_myzone
 	vrf-table auto
 	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
+	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
 
 auto vrfbr_myzone
 iface vrfbr_myzone
diff --git a/src/test/zones/evpn/combined_bgp_isis/expected_sdn_interfaces b/src/test/zones/evpn/combined_bgp_isis/expected_sdn_interfaces
index 4cf13e05e688..c898bc2a5976 100644
--- a/src/test/zones/evpn/combined_bgp_isis/expected_sdn_interfaces
+++ b/src/test/zones/evpn/combined_bgp_isis/expected_sdn_interfaces
@@ -15,6 +15,7 @@ auto vrf_myzone
 iface vrf_myzone
 	vrf-table auto
 	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
+	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
 
 auto vrfbr_myzone
 iface vrfbr_myzone
diff --git a/src/test/zones/evpn/disable_arp_nd_suppression/expected_sdn_interfaces b/src/test/zones/evpn/disable_arp_nd_suppression/expected_sdn_interfaces
index bbde90648dbb..102a6a0f7cb3 100644
--- a/src/test/zones/evpn/disable_arp_nd_suppression/expected_sdn_interfaces
+++ b/src/test/zones/evpn/disable_arp_nd_suppression/expected_sdn_interfaces
@@ -16,6 +16,7 @@ auto vrf_myzone
 iface vrf_myzone
 	vrf-table auto
 	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
+	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
 
 auto vrfbr_myzone
 iface vrfbr_myzone
diff --git a/src/test/zones/evpn/ebgp/expected_sdn_interfaces b/src/test/zones/evpn/ebgp/expected_sdn_interfaces
index 4cf13e05e688..c898bc2a5976 100644
--- a/src/test/zones/evpn/ebgp/expected_sdn_interfaces
+++ b/src/test/zones/evpn/ebgp/expected_sdn_interfaces
@@ -15,6 +15,7 @@ auto vrf_myzone
 iface vrf_myzone
 	vrf-table auto
 	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
+	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
 
 auto vrfbr_myzone
 iface vrfbr_myzone
diff --git a/src/test/zones/evpn/ebgp_evpn_ibgp_wan_evpn_ebgp/expected_sdn_interfaces b/src/test/zones/evpn/ebgp_evpn_ibgp_wan_evpn_ebgp/expected_sdn_interfaces
index 7481d3655ca9..492e0c61a317 100644
--- a/src/test/zones/evpn/ebgp_evpn_ibgp_wan_evpn_ebgp/expected_sdn_interfaces
+++ b/src/test/zones/evpn/ebgp_evpn_ibgp_wan_evpn_ebgp/expected_sdn_interfaces
@@ -15,6 +15,7 @@ auto vrf_myzone
 iface vrf_myzone
 	vrf-table auto
 	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
+	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
 
 auto vrfbr_myzone
 iface vrfbr_myzone
diff --git a/src/test/zones/evpn/ebgp_evpn_ibgp_wan_evpn_ebgp_rt_import/expected_sdn_interfaces b/src/test/zones/evpn/ebgp_evpn_ibgp_wan_evpn_ebgp_rt_import/expected_sdn_interfaces
index 7481d3655ca9..492e0c61a317 100644
--- a/src/test/zones/evpn/ebgp_evpn_ibgp_wan_evpn_ebgp_rt_import/expected_sdn_interfaces
+++ b/src/test/zones/evpn/ebgp_evpn_ibgp_wan_evpn_ebgp_rt_import/expected_sdn_interfaces
@@ -15,6 +15,7 @@ auto vrf_myzone
 iface vrf_myzone
 	vrf-table auto
 	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
+	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
 
 auto vrfbr_myzone
 iface vrfbr_myzone
diff --git a/src/test/zones/evpn/ebgp_evpn_ibgp_wan_evpn_ebgp_rt_import_mixed/expected_sdn_interfaces b/src/test/zones/evpn/ebgp_evpn_ibgp_wan_evpn_ebgp_rt_import_mixed/expected_sdn_interfaces
index 39f3beb14c58..4b2202402722 100644
--- a/src/test/zones/evpn/ebgp_evpn_ibgp_wan_evpn_ebgp_rt_import_mixed/expected_sdn_interfaces
+++ b/src/test/zones/evpn/ebgp_evpn_ibgp_wan_evpn_ebgp_rt_import_mixed/expected_sdn_interfaces
@@ -26,11 +26,13 @@ auto vrf_myzone
 iface vrf_myzone
 	vrf-table auto
 	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
+	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
 
 auto vrf_myzone2
 iface vrf_myzone2
 	vrf-table auto
 	post-up ip route add vrf vrf_myzone2 unreachable default metric 4278198272
+	post-up ip -6 route add vrf vrf_myzone2 unreachable default metric 4278198272
 
 auto vrfbr_myzone
 iface vrfbr_myzone
diff --git a/src/test/zones/evpn/ebgp_loopback/expected_sdn_interfaces b/src/test/zones/evpn/ebgp_loopback/expected_sdn_interfaces
index 4cf13e05e688..c898bc2a5976 100644
--- a/src/test/zones/evpn/ebgp_loopback/expected_sdn_interfaces
+++ b/src/test/zones/evpn/ebgp_loopback/expected_sdn_interfaces
@@ -15,6 +15,7 @@ auto vrf_myzone
 iface vrf_myzone
 	vrf-table auto
 	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
+	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
 
 auto vrfbr_myzone
 iface vrfbr_myzone
diff --git a/src/test/zones/evpn/evpn_cluster_ibgp_uplink_ebgp/expected_sdn_interfaces b/src/test/zones/evpn/evpn_cluster_ibgp_uplink_ebgp/expected_sdn_interfaces
index 4cf13e05e688..c898bc2a5976 100644
--- a/src/test/zones/evpn/evpn_cluster_ibgp_uplink_ebgp/expected_sdn_interfaces
+++ b/src/test/zones/evpn/evpn_cluster_ibgp_uplink_ebgp/expected_sdn_interfaces
@@ -15,6 +15,7 @@ auto vrf_myzone
 iface vrf_myzone
 	vrf-table auto
 	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
+	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
 
 auto vrfbr_myzone
 iface vrfbr_myzone
diff --git a/src/test/zones/evpn/evpn_multiple_zones_cluster_ibgp_uplink_ebgp/expected_sdn_interfaces b/src/test/zones/evpn/evpn_multiple_zones_cluster_ibgp_uplink_ebgp/expected_sdn_interfaces
index 88706b7c1a5d..7a5477a4e65d 100644
--- a/src/test/zones/evpn/evpn_multiple_zones_cluster_ibgp_uplink_ebgp/expected_sdn_interfaces
+++ b/src/test/zones/evpn/evpn_multiple_zones_cluster_ibgp_uplink_ebgp/expected_sdn_interfaces
@@ -26,11 +26,13 @@ auto vrf_myzone
 iface vrf_myzone
 	vrf-table auto
 	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
+	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
 
 auto vrf_myzone2
 iface vrf_myzone2
 	vrf-table auto
 	post-up ip route add vrf vrf_myzone2 unreachable default metric 4278198272
+	post-up ip -6 route add vrf vrf_myzone2 unreachable default metric 4278198272
 
 auto vrfbr_myzone
 iface vrfbr_myzone
diff --git a/src/test/zones/evpn/exitnode/expected_sdn_interfaces b/src/test/zones/evpn/exitnode/expected_sdn_interfaces
index 5ab308477596..5dcfc83fce9a 100644
--- a/src/test/zones/evpn/exitnode/expected_sdn_interfaces
+++ b/src/test/zones/evpn/exitnode/expected_sdn_interfaces
@@ -15,6 +15,7 @@ auto vrf_myzone
 iface vrf_myzone
 	vrf-table auto
 	post-up ip route del vrf vrf_myzone unreachable default metric 4278198272
+	post-up ip -6 route del vrf vrf_myzone unreachable default metric 4278198272
 
 auto vrfbr_myzone
 iface vrfbr_myzone
diff --git a/src/test/zones/evpn/exitnode_local_routing/expected_sdn_interfaces b/src/test/zones/evpn/exitnode_local_routing/expected_sdn_interfaces
index 301f5b30202a..511cec67fdc3 100644
--- a/src/test/zones/evpn/exitnode_local_routing/expected_sdn_interfaces
+++ b/src/test/zones/evpn/exitnode_local_routing/expected_sdn_interfaces
@@ -15,6 +15,7 @@ auto vrf_myzone
 iface vrf_myzone
 	vrf-table auto
 	post-up ip route del vrf vrf_myzone unreachable default metric 4278198272
+	post-up ip -6 route del vrf vrf_myzone unreachable default metric 4278198272
 
 auto vrfbr_myzone
 iface vrfbr_myzone
diff --git a/src/test/zones/evpn/exitnode_local_routing_ipv6/expected_sdn_interfaces b/src/test/zones/evpn/exitnode_local_routing_ipv6/expected_sdn_interfaces
index b46d4e7b6ea0..1c3b94a75fad 100644
--- a/src/test/zones/evpn/exitnode_local_routing_ipv6/expected_sdn_interfaces
+++ b/src/test/zones/evpn/exitnode_local_routing_ipv6/expected_sdn_interfaces
@@ -15,6 +15,7 @@ auto vrf_myzone
 iface vrf_myzone
 	vrf-table auto
 	post-up ip route del vrf vrf_myzone unreachable default metric 4278198272
+	post-up ip -6 route del vrf vrf_myzone unreachable default metric 4278198272
 
 auto vrfbr_myzone
 iface vrfbr_myzone
diff --git a/src/test/zones/evpn/exitnode_primary/expected_sdn_interfaces b/src/test/zones/evpn/exitnode_primary/expected_sdn_interfaces
index 5ab308477596..5dcfc83fce9a 100644
--- a/src/test/zones/evpn/exitnode_primary/expected_sdn_interfaces
+++ b/src/test/zones/evpn/exitnode_primary/expected_sdn_interfaces
@@ -15,6 +15,7 @@ auto vrf_myzone
 iface vrf_myzone
 	vrf-table auto
 	post-up ip route del vrf vrf_myzone unreachable default metric 4278198272
+	post-up ip -6 route del vrf vrf_myzone unreachable default metric 4278198272
 
 auto vrfbr_myzone
 iface vrfbr_myzone
diff --git a/src/test/zones/evpn/exitnode_snat/expected_sdn_interfaces b/src/test/zones/evpn/exitnode_snat/expected_sdn_interfaces
index 0d7d17412f0b..57ac29823da1 100644
--- a/src/test/zones/evpn/exitnode_snat/expected_sdn_interfaces
+++ b/src/test/zones/evpn/exitnode_snat/expected_sdn_interfaces
@@ -34,6 +34,7 @@ auto vrf_myzone
 iface vrf_myzone
 	vrf-table auto
 	post-up ip route del vrf vrf_myzone unreachable default metric 4278198272
+	post-up ip -6 route del vrf vrf_myzone unreachable default metric 4278198272
 
 auto vrfbr_myzone
 iface vrfbr_myzone
diff --git a/src/test/zones/evpn/exitnodenullroute/expected_sdn_interfaces b/src/test/zones/evpn/exitnodenullroute/expected_sdn_interfaces
index 4bf5ccf96f91..ee2f2e77ebe7 100644
--- a/src/test/zones/evpn/exitnodenullroute/expected_sdn_interfaces
+++ b/src/test/zones/evpn/exitnodenullroute/expected_sdn_interfaces
@@ -34,11 +34,13 @@ auto vrf_myzone
 iface vrf_myzone
 	vrf-table auto
 	post-up ip route del vrf vrf_myzone unreachable default metric 4278198272
+	post-up ip -6 route del vrf vrf_myzone unreachable default metric 4278198272
 
 auto vrf_myzone2
 iface vrf_myzone2
 	vrf-table auto
 	post-up ip route del vrf vrf_myzone2 unreachable default metric 4278198272
+	post-up ip -6 route del vrf vrf_myzone2 unreachable default metric 4278198272
 
 auto vrfbr_myzone
 iface vrfbr_myzone
diff --git a/src/test/zones/evpn/frr_local_merge/expected_sdn_interfaces b/src/test/zones/evpn/frr_local_merge/expected_sdn_interfaces
index c7ddf44ef6d3..eb74308f4545 100644
--- a/src/test/zones/evpn/frr_local_merge/expected_sdn_interfaces
+++ b/src/test/zones/evpn/frr_local_merge/expected_sdn_interfaces
@@ -16,6 +16,7 @@ auto vrf_myzone
 iface vrf_myzone
 	vrf-table auto
 	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
+	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
 
 auto vrfbr_myzone
 iface vrfbr_myzone
diff --git a/src/test/zones/evpn/frr_local_merge_router_without_exit/expected_sdn_interfaces b/src/test/zones/evpn/frr_local_merge_router_without_exit/expected_sdn_interfaces
index 169f32d38951..ece76710d341 100644
--- a/src/test/zones/evpn/frr_local_merge_router_without_exit/expected_sdn_interfaces
+++ b/src/test/zones/evpn/frr_local_merge_router_without_exit/expected_sdn_interfaces
@@ -16,6 +16,7 @@ auto vrf_evpnz
 iface vrf_evpnz
 	vrf-table auto
 	post-up ip route add vrf vrf_evpnz unreachable default metric 4278198272
+	post-up ip -6 route add vrf vrf_evpnz unreachable default metric 4278198272
 
 auto vrfbr_evpnz
 iface vrfbr_evpnz
diff --git a/src/test/zones/evpn/ipv4/expected_sdn_interfaces b/src/test/zones/evpn/ipv4/expected_sdn_interfaces
index 9d1c64c0f3fa..4ff3c840dcb8 100644
--- a/src/test/zones/evpn/ipv4/expected_sdn_interfaces
+++ b/src/test/zones/evpn/ipv4/expected_sdn_interfaces
@@ -16,6 +16,7 @@ auto vrf_myzone
 iface vrf_myzone
 	vrf-table auto
 	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
+	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
 
 auto vrfbr_myzone
 iface vrfbr_myzone
diff --git a/src/test/zones/evpn/ipv4ipv6/expected_sdn_interfaces b/src/test/zones/evpn/ipv4ipv6/expected_sdn_interfaces
index 7a5d741b067c..e54a453a280c 100644
--- a/src/test/zones/evpn/ipv4ipv6/expected_sdn_interfaces
+++ b/src/test/zones/evpn/ipv4ipv6/expected_sdn_interfaces
@@ -18,6 +18,7 @@ auto vrf_myzone
 iface vrf_myzone
 	vrf-table auto
 	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
+	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
 
 auto vrfbr_myzone
 iface vrfbr_myzone
diff --git a/src/test/zones/evpn/ipv4ipv6nogateway/expected_sdn_interfaces b/src/test/zones/evpn/ipv4ipv6nogateway/expected_sdn_interfaces
index 378fa77fa368..2e8dc2a9c869 100644
--- a/src/test/zones/evpn/ipv4ipv6nogateway/expected_sdn_interfaces
+++ b/src/test/zones/evpn/ipv4ipv6nogateway/expected_sdn_interfaces
@@ -14,6 +14,7 @@ auto vrf_myzone
 iface vrf_myzone
 	vrf-table auto
 	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
+	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
 
 auto vrfbr_myzone
 iface vrfbr_myzone
diff --git a/src/test/zones/evpn/ipv6/expected_sdn_interfaces b/src/test/zones/evpn/ipv6/expected_sdn_interfaces
index b2bdbfefd810..5d9ecfef0225 100644
--- a/src/test/zones/evpn/ipv6/expected_sdn_interfaces
+++ b/src/test/zones/evpn/ipv6/expected_sdn_interfaces
@@ -16,6 +16,7 @@ auto vrf_myzone
 iface vrf_myzone
 	vrf-table auto
 	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
+	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
 
 auto vrfbr_myzone
 iface vrfbr_myzone
diff --git a/src/test/zones/evpn/ipv6underlay/expected_sdn_interfaces b/src/test/zones/evpn/ipv6underlay/expected_sdn_interfaces
index 3b91f75eb3dd..00a66c8a276b 100644
--- a/src/test/zones/evpn/ipv6underlay/expected_sdn_interfaces
+++ b/src/test/zones/evpn/ipv6underlay/expected_sdn_interfaces
@@ -16,6 +16,7 @@ auto vrf_myzone
 iface vrf_myzone
 	vrf-table auto
 	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
+	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
 
 auto vrfbr_myzone
 iface vrfbr_myzone
diff --git a/src/test/zones/evpn/isis/expected_sdn_interfaces b/src/test/zones/evpn/isis/expected_sdn_interfaces
index 4cf13e05e688..c898bc2a5976 100644
--- a/src/test/zones/evpn/isis/expected_sdn_interfaces
+++ b/src/test/zones/evpn/isis/expected_sdn_interfaces
@@ -15,6 +15,7 @@ auto vrf_myzone
 iface vrf_myzone
 	vrf-table auto
 	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
+	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
 
 auto vrfbr_myzone
 iface vrfbr_myzone
diff --git a/src/test/zones/evpn/isis_loopback/expected_sdn_interfaces b/src/test/zones/evpn/isis_loopback/expected_sdn_interfaces
index e595dc93f60a..1f8a7989e0fd 100644
--- a/src/test/zones/evpn/isis_loopback/expected_sdn_interfaces
+++ b/src/test/zones/evpn/isis_loopback/expected_sdn_interfaces
@@ -15,6 +15,7 @@ auto vrf_myzone
 iface vrf_myzone
 	vrf-table auto
 	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
+	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
 
 auto vrfbr_myzone
 iface vrfbr_myzone
diff --git a/src/test/zones/evpn/multipath_relax/expected_sdn_interfaces b/src/test/zones/evpn/multipath_relax/expected_sdn_interfaces
index 4cf13e05e688..c898bc2a5976 100644
--- a/src/test/zones/evpn/multipath_relax/expected_sdn_interfaces
+++ b/src/test/zones/evpn/multipath_relax/expected_sdn_interfaces
@@ -15,6 +15,7 @@ auto vrf_myzone
 iface vrf_myzone
 	vrf-table auto
 	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
+	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
 
 auto vrfbr_myzone
 iface vrfbr_myzone
diff --git a/src/test/zones/evpn/multiplezones/expected_sdn_interfaces b/src/test/zones/evpn/multiplezones/expected_sdn_interfaces
index e279b0a5770f..933d99277dba 100644
--- a/src/test/zones/evpn/multiplezones/expected_sdn_interfaces
+++ b/src/test/zones/evpn/multiplezones/expected_sdn_interfaces
@@ -26,11 +26,13 @@ auto vrf_myzone
 iface vrf_myzone
 	vrf-table auto
 	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
+	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
 
 auto vrf_myzone2
 iface vrf_myzone2
 	vrf-table auto
 	post-up ip route add vrf vrf_myzone2 unreachable default metric 4278198272
+	post-up ip -6 route add vrf vrf_myzone2 unreachable default metric 4278198272
 
 auto vrfbr_myzone
 iface vrfbr_myzone
diff --git a/src/test/zones/evpn/openfabric_fabric/expected_sdn_interfaces b/src/test/zones/evpn/openfabric_fabric/expected_sdn_interfaces
index 7460b12ce686..02cb79a8beb2 100644
--- a/src/test/zones/evpn/openfabric_fabric/expected_sdn_interfaces
+++ b/src/test/zones/evpn/openfabric_fabric/expected_sdn_interfaces
@@ -16,6 +16,7 @@ auto vrf_evpn
 iface vrf_evpn
 	vrf-table auto
 	post-up ip route add vrf vrf_evpn unreachable default metric 4278198272
+	post-up ip -6 route add vrf vrf_evpn unreachable default metric 4278198272
 
 auto vrfbr_evpn
 iface vrfbr_evpn
diff --git a/src/test/zones/evpn/openfabric_fabric_ipv6/expected_sdn_interfaces b/src/test/zones/evpn/openfabric_fabric_ipv6/expected_sdn_interfaces
index d01771386658..d3b0fe83d588 100644
--- a/src/test/zones/evpn/openfabric_fabric_ipv6/expected_sdn_interfaces
+++ b/src/test/zones/evpn/openfabric_fabric_ipv6/expected_sdn_interfaces
@@ -16,6 +16,7 @@ auto vrf_evpn
 iface vrf_evpn
 	vrf-table auto
 	post-up ip route add vrf vrf_evpn unreachable default metric 4278198272
+	post-up ip -6 route add vrf vrf_evpn unreachable default metric 4278198272
 
 auto vrfbr_evpn
 iface vrfbr_evpn
diff --git a/src/test/zones/evpn/openfabric_fabric_ipv6_only/expected_sdn_interfaces b/src/test/zones/evpn/openfabric_fabric_ipv6_only/expected_sdn_interfaces
index 51507d7d3fbe..abcad331ef10 100644
--- a/src/test/zones/evpn/openfabric_fabric_ipv6_only/expected_sdn_interfaces
+++ b/src/test/zones/evpn/openfabric_fabric_ipv6_only/expected_sdn_interfaces
@@ -16,6 +16,7 @@ auto vrf_evpn
 iface vrf_evpn
 	vrf-table auto
 	post-up ip route add vrf vrf_evpn unreachable default metric 4278198272
+	post-up ip -6 route add vrf vrf_evpn unreachable default metric 4278198272
 
 auto vrfbr_evpn
 iface vrfbr_evpn
diff --git a/src/test/zones/evpn/ospf_fabric/expected_sdn_interfaces b/src/test/zones/evpn/ospf_fabric/expected_sdn_interfaces
index 2543304a47ba..7ad2cb4cf812 100644
--- a/src/test/zones/evpn/ospf_fabric/expected_sdn_interfaces
+++ b/src/test/zones/evpn/ospf_fabric/expected_sdn_interfaces
@@ -16,6 +16,7 @@ auto vrf_evpn
 iface vrf_evpn
 	vrf-table auto
 	post-up ip route add vrf vrf_evpn unreachable default metric 4278198272
+	post-up ip -6 route add vrf vrf_evpn unreachable default metric 4278198272
 
 auto vrfbr_evpn
 iface vrfbr_evpn
diff --git a/src/test/zones/evpn/routemap/expected_sdn_interfaces b/src/test/zones/evpn/routemap/expected_sdn_interfaces
index 4cf13e05e688..c898bc2a5976 100644
--- a/src/test/zones/evpn/routemap/expected_sdn_interfaces
+++ b/src/test/zones/evpn/routemap/expected_sdn_interfaces
@@ -15,6 +15,7 @@ auto vrf_myzone
 iface vrf_myzone
 	vrf-table auto
 	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
+	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
 
 auto vrfbr_myzone
 iface vrfbr_myzone
diff --git a/src/test/zones/evpn/routemap_exit_node/expected_sdn_interfaces b/src/test/zones/evpn/routemap_exit_node/expected_sdn_interfaces
index 5ab308477596..5dcfc83fce9a 100644
--- a/src/test/zones/evpn/routemap_exit_node/expected_sdn_interfaces
+++ b/src/test/zones/evpn/routemap_exit_node/expected_sdn_interfaces
@@ -15,6 +15,7 @@ auto vrf_myzone
 iface vrf_myzone
 	vrf-table auto
 	post-up ip route del vrf vrf_myzone unreachable default metric 4278198272
+	post-up ip -6 route del vrf vrf_myzone unreachable default metric 4278198272
 
 auto vrfbr_myzone
 iface vrfbr_myzone
diff --git a/src/test/zones/evpn/routemap_prefix_list/expected_sdn_interfaces b/src/test/zones/evpn/routemap_prefix_list/expected_sdn_interfaces
index 4cf13e05e688..c898bc2a5976 100644
--- a/src/test/zones/evpn/routemap_prefix_list/expected_sdn_interfaces
+++ b/src/test/zones/evpn/routemap_prefix_list/expected_sdn_interfaces
@@ -15,6 +15,7 @@ auto vrf_myzone
 iface vrf_myzone
 	vrf-table auto
 	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
+	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
 
 auto vrfbr_myzone
 iface vrfbr_myzone
diff --git a/src/test/zones/evpn/rt_import/expected_sdn_interfaces b/src/test/zones/evpn/rt_import/expected_sdn_interfaces
index 9d1c64c0f3fa..4ff3c840dcb8 100644
--- a/src/test/zones/evpn/rt_import/expected_sdn_interfaces
+++ b/src/test/zones/evpn/rt_import/expected_sdn_interfaces
@@ -16,6 +16,7 @@ auto vrf_myzone
 iface vrf_myzone
 	vrf-table auto
 	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
+	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
 
 auto vrfbr_myzone
 iface vrfbr_myzone
diff --git a/src/test/zones/evpn/vxlanport/expected_sdn_interfaces b/src/test/zones/evpn/vxlanport/expected_sdn_interfaces
index d511bf99eca1..18b6074a9b2e 100644
--- a/src/test/zones/evpn/vxlanport/expected_sdn_interfaces
+++ b/src/test/zones/evpn/vxlanport/expected_sdn_interfaces
@@ -16,6 +16,7 @@ auto vrf_myzone
 iface vrf_myzone
 	vrf-table auto
 	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
+	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
 
 auto vrfbr_myzone
 iface vrfbr_myzone
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 65+ messages in thread

* [PATCH pve-network v3 15/32] sdn: add optional VRFs for simple zones
  2026-11-16 16:11 [PATCH common/manager/network/proxmox{-ve-rs,-perl-rs,-widget-toolkit} v3 00/32] SDN VRF support Gabriel Goller
                   ` (13 preceding siblings ...)
  2026-11-16 16:11 ` [PATCH pve-network v3 14/32] sdn: evpn: add unreachable IPv6 default route to zone VRFs Gabriel Goller
@ 2026-11-16 16:11 ` Gabriel Goller
  2026-11-18 16:18   ` Stefan Hanreich
  2026-11-16 16:11 ` [PATCH pve-network v3 16/32] sdn: allow fabrics to use simple zone VRFs Gabriel Goller
                   ` (18 subsequent siblings)
  33 siblings, 1 reply; 65+ messages in thread
From: Gabriel Goller @ 2026-11-16 16:11 UTC (permalink / raw)
  To: pve-devel

Allow simple zones to isolate routing with dedicated-vrf. It is
disabled by default to preserve existing behavior.

Create the VRF even when the zone has no VNets, so fabrics can use it
without requiring a VNet.

Add unreachable IPv4 and IPv6 default routes with the highest metric
to the VRF, as EVPN does on non-exit nodes. Otherwise lookups that find
no route in the VRF table fall through to the main table, e.g. if no
default route is configured or before FRR has installed it.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
 src/PVE/API2/Network/SDN/Zones.pm             |  6 ++++
 src/PVE/Network/SDN/Zones.pm                  | 19 +++++++++--
 src/PVE/Network/SDN/Zones/EvpnPlugin.pm       |  5 +--
 src/PVE/Network/SDN/Zones/Plugin.pm           | 11 ++++++
 src/PVE/Network/SDN/Zones/SimplePlugin.pm     | 32 +++++++++++++++--
 .../hetzner-vrf/expected_sdn_interfaces       | 27 +++++++++++++++
 src/test/zones/simple/hetzner-vrf/interfaces  |  6 ++++
 src/test/zones/simple/hetzner-vrf/sdn_config  | 34 +++++++++++++++++++
 .../simple/vrf-empty/expected_sdn_interfaces  |  7 ++++
 src/test/zones/simple/vrf-empty/interfaces    |  2 ++
 src/test/zones/simple/vrf-empty/sdn_config    | 12 +++++++
 .../zones/simple/vrf/expected_sdn_interfaces  | 14 ++++++++
 src/test/zones/simple/vrf/interfaces          |  2 ++
 src/test/zones/simple/vrf/sdn_config          | 17 ++++++++++
 14 files changed, 187 insertions(+), 7 deletions(-)
 create mode 100644 src/test/zones/simple/hetzner-vrf/expected_sdn_interfaces
 create mode 100644 src/test/zones/simple/hetzner-vrf/interfaces
 create mode 100644 src/test/zones/simple/hetzner-vrf/sdn_config
 create mode 100644 src/test/zones/simple/vrf-empty/expected_sdn_interfaces
 create mode 100644 src/test/zones/simple/vrf-empty/interfaces
 create mode 100644 src/test/zones/simple/vrf-empty/sdn_config
 create mode 100644 src/test/zones/simple/vrf/expected_sdn_interfaces
 create mode 100644 src/test/zones/simple/vrf/interfaces
 create mode 100644 src/test/zones/simple/vrf/sdn_config

diff --git a/src/PVE/API2/Network/SDN/Zones.pm b/src/PVE/API2/Network/SDN/Zones.pm
index 74b10f032bf4..38d950fda076 100644
--- a/src/PVE/API2/Network/SDN/Zones.pm
+++ b/src/PVE/API2/Network/SDN/Zones.pm
@@ -61,6 +61,12 @@ my $ZONE_PROPERTIES = {
         optional => 1,
         description => 'Name of DHCP server backend for this zone.',
     },
+    'dedicated-vrf' => {
+        type => 'boolean',
+        default => 0,
+        optional => 1,
+        description => 'Create a dedicated VRF for a simple zone.',
+    },
     'rt-import' => {
         type => 'string',
         optional => 1,
diff --git a/src/PVE/Network/SDN/Zones.pm b/src/PVE/Network/SDN/Zones.pm
index c189652a79eb..cf81c002c4a5 100644
--- a/src/PVE/Network/SDN/Zones.pm
+++ b/src/PVE/Network/SDN/Zones.pm
@@ -124,6 +124,9 @@ sub generate_etc_network_config {
     my $controller_cfg = $cfg->{controllers};
     return if !$vnet_cfg && !$zone_cfg;
 
+    my $vnet_ids = $vnet_cfg ? ($vnet_cfg->{ids} // {}) : {};
+    my $zone_ids = $zone_cfg ? ($zone_cfg->{ids} // {}) : {};
+
     my $interfaces_config = PVE::INotify::read_file('interfaces');
     my $bridge_ports = PVE::IPRoute2::get_bridge_port_mapping();
 
@@ -131,8 +134,18 @@ sub generate_etc_network_config {
     my $config = {};
     my $nodename = PVE::INotify::nodename();
 
-    for my $id (sort keys %{ $vnet_cfg->{ids} }) {
-        my $vnet = $vnet_cfg->{ids}->{$id};
+    for my $zone_id (sort keys %$zone_ids) {
+        my $plugin_config = $zone_ids->{$zone_id};
+        next if $plugin_config->{type} ne 'simple';
+        next if defined($plugin_config->{nodes}) && !$plugin_config->{nodes}->{$nodename};
+
+        PVE::Network::SDN::Zones::SimplePlugin->generate_zone_config(
+            $plugin_config, $zone_id, $config,
+        );
+    }
+
+    for my $id (sort keys %$vnet_ids) {
+        my $vnet = $vnet_ids->{$id};
         my $zone = $vnet->{zone};
 
         if (!$zone) {
@@ -140,7 +153,7 @@ sub generate_etc_network_config {
             next;
         }
 
-        my $plugin_config = $zone_cfg->{ids}->{$zone};
+        my $plugin_config = $zone_ids->{$zone};
 
         if (!defined($plugin_config)) {
             warn "can't generate vnet '$id': zone $zone don't exist\n";
diff --git a/src/PVE/Network/SDN/Zones/EvpnPlugin.pm b/src/PVE/Network/SDN/Zones/EvpnPlugin.pm
index 45a628d6a69d..534ac9ffa5b1 100644
--- a/src/PVE/Network/SDN/Zones/EvpnPlugin.pm
+++ b/src/PVE/Network/SDN/Zones/EvpnPlugin.pm
@@ -319,8 +319,9 @@ sub generate_sdn_config {
         push @iface_config, "vrf-table auto";
         my $route_action = $is_evpn_gateway ? 'del' : 'add';
         push @iface_config,
-            "post-up ip route $route_action vrf $vrf_iface unreachable default metric 4278198272",
-            "post-up ip -6 route $route_action vrf $vrf_iface unreachable default metric 4278198272";
+            PVE::Network::SDN::Zones::Plugin::vrf_unreachable_default_cmds(
+                $vrf_iface, $route_action,
+            );
 
         push(@{ $config->{$vrf_iface} }, @iface_config) if !$config->{$vrf_iface};
 
diff --git a/src/PVE/Network/SDN/Zones/Plugin.pm b/src/PVE/Network/SDN/Zones/Plugin.pm
index f3844ffda3b5..b3b4261c58af 100644
--- a/src/PVE/Network/SDN/Zones/Plugin.pm
+++ b/src/PVE/Network/SDN/Zones/Plugin.pm
@@ -99,6 +99,17 @@ sub encode_value {
     return $value;
 }
 
+# Unreachable IPv4 and IPv6 default routes with the highest metric, so that
+# lookups without a matching route in the VRF table do not fall through to the
+# main table. $action is 'add' or 'del'.
+sub vrf_unreachable_default_cmds {
+    my ($vrf_iface, $action) = @_;
+
+    return map {
+        "post-up ip${_} route $action vrf $vrf_iface unreachable default metric 4278198272"
+    } ('', ' -6');
+}
+
 sub generate_sdn_config {
     my (
         $class,
diff --git a/src/PVE/Network/SDN/Zones/SimplePlugin.pm b/src/PVE/Network/SDN/Zones/SimplePlugin.pm
index 347eee9a46ba..bc591839819d 100644
--- a/src/PVE/Network/SDN/Zones/SimplePlugin.pm
+++ b/src/PVE/Network/SDN/Zones/SimplePlugin.pm
@@ -35,6 +35,11 @@ sub properties {
             type => 'string',
             enum => PVE::Network::SDN::Dhcp->plugin_types(),
         },
+        'dedicated-vrf' => {
+            description => 'Create a dedicated VRF for the zone.',
+            type => 'boolean',
+            default => 0,
+        },
     };
 }
 
@@ -47,15 +52,34 @@ sub options {
         dnszone => { optional => 1 },
         ipam => { optional => 1 },
         dhcp => { optional => 1 },
+        'dedicated-vrf' => { optional => 1 },
     };
 }
 
+sub generate_zone_config {
+    my ($class, $plugin_config, $zone_id, $config) = @_;
+
+    if ($plugin_config->{'dedicated-vrf'}) {
+        my $vrf_iface = "vrf_$zone_id";
+        if (!defined($config->{$vrf_iface})) {
+            $config->{$vrf_iface} = [
+                'vrf-table auto',
+                PVE::Network::SDN::Zones::Plugin::vrf_unreachable_default_cmds(
+                    $vrf_iface, 'add',
+                ),
+            ];
+        }
+    }
+
+    return $config;
+}
+
 # Plugin implementation
 sub generate_sdn_config {
     my (
         $class,
         $plugin_config,
-        $zoneid,
+        $zone_id,
         $vnetid,
         $vnet,
         $controller,
@@ -110,7 +134,10 @@ sub generate_sdn_config {
         }
 
         #add route for /32 pointtopoint
-        push @iface_config, "up ip route add $cidr dev $vnetid" if $mask == 32 && $ipversion == 4;
+        if ($mask == 32 && $ipversion == 4) {
+            my $vrf = $plugin_config->{'dedicated-vrf'} ? " vrf vrf_$zone_id" : '';
+            push @iface_config, "up ip route add $cidr dev $vnetid$vrf";
+        }
         if ($subnet->{snat}) {
             #find outgoing interface
             my ($outip, $outiface);
@@ -150,6 +177,7 @@ sub generate_sdn_config {
     push @iface_config, "alias $alias" if $alias;
     push @iface_config, "ip-forward on" if $enable_forward_v4;
     push @iface_config, "ip6-forward on" if $enable_forward_v6;
+    push @iface_config, "vrf vrf_$zone_id" if $plugin_config->{'dedicated-vrf'};
 
     push @{ $config->{$vnetid} }, @iface_config;
 
diff --git a/src/test/zones/simple/hetzner-vrf/expected_sdn_interfaces b/src/test/zones/simple/hetzner-vrf/expected_sdn_interfaces
new file mode 100644
index 000000000000..a94d091dcf50
--- /dev/null
+++ b/src/test/zones/simple/hetzner-vrf/expected_sdn_interfaces
@@ -0,0 +1,27 @@
+#version:1
+
+auto myvnet
+iface myvnet
+	address 144.76.100.65/29
+	bridge_ports none
+	bridge_stp off
+	bridge_fd 0
+	ip-forward on
+	vrf vrf_myzone
+
+auto myvnet2
+iface myvnet2
+	address 144.76.0.1/32
+	up ip route add 144.76.200.65/32 dev myvnet2 vrf vrf_myzone
+	up ip route add 144.76.200.66/32 dev myvnet2 vrf vrf_myzone
+	bridge_ports none
+	bridge_stp off
+	bridge_fd 0
+	ip-forward on
+	vrf vrf_myzone
+
+auto vrf_myzone
+iface vrf_myzone
+	vrf-table auto
+	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
+	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
diff --git a/src/test/zones/simple/hetzner-vrf/interfaces b/src/test/zones/simple/hetzner-vrf/interfaces
new file mode 100644
index 000000000000..53e894aaa4ef
--- /dev/null
+++ b/src/test/zones/simple/hetzner-vrf/interfaces
@@ -0,0 +1,6 @@
+auto eth0
+iface eth0 inet static
+  address 144.76.0.1
+  netmask 255.255.255.255
+  pointopoint 172.31.1.1
+  gateway 172.31.1.1
diff --git a/src/test/zones/simple/hetzner-vrf/sdn_config b/src/test/zones/simple/hetzner-vrf/sdn_config
new file mode 100644
index 000000000000..847c42da81a4
--- /dev/null
+++ b/src/test/zones/simple/hetzner-vrf/sdn_config
@@ -0,0 +1,34 @@
+{
+  version => 1,
+  vnets   => {
+               ids => {
+                        myvnet => { type => "vnet", zone => "myzone" },
+                        myvnet2 => { type => "vnet", zone => "myzone" },
+                      },
+             },
+  zones   => {
+               ids => { myzone => { ipam => "pve", type => "simple", "dedicated-vrf" => 1 } },
+             },
+
+  subnets => {
+                ids => {
+                        'myzone-144.76.100.64-29' => {
+                                                        'type' => 'subnet',
+                                                        'vnet' => 'myvnet',
+                                                        'gateway' => '144.76.100.65',
+                                                },
+                        'myzone-144.76.200.65-32' => {
+                                                        'type' => 'subnet',
+                                                        'vnet' => 'myvnet2',
+                                                        'gateway' => '144.76.0.1',
+                                                },
+                        'myzone-144.76.200.66-32' => {
+                                                        'type' => 'subnet',
+                                                        'vnet' => 'myvnet2',
+                                                        'gateway' => '144.76.0.1',
+                                                },
+                }
+             }
+}
+
+
diff --git a/src/test/zones/simple/vrf-empty/expected_sdn_interfaces b/src/test/zones/simple/vrf-empty/expected_sdn_interfaces
new file mode 100644
index 000000000000..d3b7de26d460
--- /dev/null
+++ b/src/test/zones/simple/vrf-empty/expected_sdn_interfaces
@@ -0,0 +1,7 @@
+#version:1
+
+auto vrf_myzone
+iface vrf_myzone
+	vrf-table auto
+	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
+	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
diff --git a/src/test/zones/simple/vrf-empty/interfaces b/src/test/zones/simple/vrf-empty/interfaces
new file mode 100644
index 000000000000..f1bd92ed2b43
--- /dev/null
+++ b/src/test/zones/simple/vrf-empty/interfaces
@@ -0,0 +1,2 @@
+auto lo
+iface lo inet loopback
diff --git a/src/test/zones/simple/vrf-empty/sdn_config b/src/test/zones/simple/vrf-empty/sdn_config
new file mode 100644
index 000000000000..32fd5ea50432
--- /dev/null
+++ b/src/test/zones/simple/vrf-empty/sdn_config
@@ -0,0 +1,12 @@
+{
+  version => 1,
+  vnets   => { ids => {} },
+  zones   => {
+               ids => {
+                        myzone => {
+                                    type => "simple",
+                                    "dedicated-vrf" => 1,
+                                  },
+                      },
+             },
+}
diff --git a/src/test/zones/simple/vrf/expected_sdn_interfaces b/src/test/zones/simple/vrf/expected_sdn_interfaces
new file mode 100644
index 000000000000..777adafa9f48
--- /dev/null
+++ b/src/test/zones/simple/vrf/expected_sdn_interfaces
@@ -0,0 +1,14 @@
+#version:1
+
+auto myvnet
+iface myvnet
+	bridge_ports none
+	bridge_stp off
+	bridge_fd 0
+	vrf vrf_myzone
+
+auto vrf_myzone
+iface vrf_myzone
+	vrf-table auto
+	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
+	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
diff --git a/src/test/zones/simple/vrf/interfaces b/src/test/zones/simple/vrf/interfaces
new file mode 100644
index 000000000000..f1bd92ed2b43
--- /dev/null
+++ b/src/test/zones/simple/vrf/interfaces
@@ -0,0 +1,2 @@
+auto lo
+iface lo inet loopback
diff --git a/src/test/zones/simple/vrf/sdn_config b/src/test/zones/simple/vrf/sdn_config
new file mode 100644
index 000000000000..c57074e1bf4a
--- /dev/null
+++ b/src/test/zones/simple/vrf/sdn_config
@@ -0,0 +1,17 @@
+{
+  version => 1,
+  vnets   => {
+               ids => {
+                        myvnet => { type => "vnet", zone => "myzone" },
+                      },
+             },
+  zones   => {
+               ids => {
+                        myzone => {
+                                    ipam => "pve",
+                                    type => "simple",
+                                    "dedicated-vrf" => 1,
+                                  },
+                      },
+             },
+}
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 65+ messages in thread

* [PATCH pve-network v3 16/32] sdn: allow fabrics to use simple zone VRFs
  2026-11-16 16:11 [PATCH common/manager/network/proxmox{-ve-rs,-perl-rs,-widget-toolkit} v3 00/32] SDN VRF support Gabriel Goller
                   ` (14 preceding siblings ...)
  2026-11-16 16:11 ` [PATCH pve-network v3 15/32] sdn: add optional VRFs for simple zones Gabriel Goller
@ 2026-11-16 16:11 ` Gabriel Goller
  2026-11-18 16:27   ` Stefan Hanreich
  2026-11-16 16:11 ` [PATCH pve-network v3 17/32] sdn: require underlay fabrics to use the default VRF Gabriel Goller
                   ` (17 subsequent siblings)
  33 siblings, 1 reply; 65+ messages in thread
From: Gabriel Goller @ 2026-11-16 16:11 UTC (permalink / raw)
  To: pve-devel

Let BGP and OSPF fabrics use a simple zone with dedicated-vrf enabled
to keep their routes separate from the default VRF.

The zone must be enabled on every fabric node. Prevent zone changes
or deletion that would leave a fabric without its VRF. A fabric's zone
cannot be changed after creation, since that resets all its sessions
anyway and other objects rely on the fabric staying in its VRF.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
 src/PVE/API2/Network/SDN/Fabrics/Fabric.pm    | 57 ++++++++++++++++---
 .../API2/Network/SDN/Fabrics/FabricNode.pm    | 18 ++++++
 src/PVE/API2/Network/SDN/Zones.pm             | 28 +++++++++
 src/PVE/Network/SDN/Controllers/BgpPlugin.pm  |  2 +-
 src/PVE/Network/SDN/Fabrics.pm                | 26 +++++++++
 5 files changed, 122 insertions(+), 9 deletions(-)

diff --git a/src/PVE/API2/Network/SDN/Fabrics/Fabric.pm b/src/PVE/API2/Network/SDN/Fabrics/Fabric.pm
index bbc33e047154..20b7b1f98e4b 100644
--- a/src/PVE/API2/Network/SDN/Fabrics/Fabric.pm
+++ b/src/PVE/API2/Network/SDN/Fabrics/Fabric.pm
@@ -6,13 +6,51 @@ use warnings;
 use PVE::Network::SDN;
 use PVE::Network::SDN::Controllers;
 use PVE::Network::SDN::Fabrics;
+use PVE::Network::SDN::Zones;
 
+use PVE::Exception qw(raise_param_exc);
 use PVE::JSONSchema qw(get_standard_option);
 use PVE::Tools qw(extract_param);
 
 use PVE::RESTHandler;
 use base qw(PVE::RESTHandler);
 
+sub validate_fabric_zone {
+    my ($fabric, $config) = @_;
+
+    my $protocol = $fabric->{protocol} // '';
+    if ($protocol eq 'bgp' && !$fabric->{zone}) {
+        my $controller_cfg = PVE::Network::SDN::Controllers::config();
+        for my $controller_id (keys %{ $controller_cfg->{ids} // {} }) {
+            my $controller = $controller_cfg->{ids}->{$controller_id};
+            if ($controller->{type} eq 'bgp') {
+                die "cannot configure a BGP fabric while BGP controller '$controller_id' exists:"
+                    . " both target the default-VRF BGP router\n";
+            }
+        }
+    }
+
+    my $zone_id = $fabric->{zone};
+    return if !$zone_id;
+
+    raise_param_exc({ zone => 'VRF zones are only supported for BGP and OSPF fabrics' })
+        if $protocol !~ /^(?:bgp|ospf)$/;
+
+    my $zone = PVE::Network::SDN::Zones::get_zone($zone_id);
+
+    raise_param_exc({ zone => "zone '$zone_id' does not exist" }) if !$zone;
+    raise_param_exc({ zone => "zone '$zone_id' is not a simple zone" })
+        if $zone->{type} ne 'simple';
+    raise_param_exc({ zone => "zone '$zone_id' is configured to use the default VRF" })
+        if $zone->{'default-vrf'} // 1;
+
+    if ($config) {
+        PVE::Network::SDN::Fabrics::assert_fabric_nodes_in_zone(
+            $config, $fabric->{id}, $zone_id, $zone,
+        );
+    }
+}
+
 __PACKAGE__->register_method({
     name => 'index',
     path => '',
@@ -129,6 +167,8 @@ __PACKAGE__->register_method({
     protected => 1,
     permissions => {
         check => ['perm', '/sdn/fabrics', ['SDN.Allocate']],
+        description => "Assigning a VRF zone additionally requires 'SDN.Allocate' on"
+            . " '/sdn/zones/<zone>'.",
     },
     parameters => {
         properties => PVE::Network::SDN::Fabrics::fabric_properties(0),
@@ -148,14 +188,10 @@ __PACKAGE__->register_method({
                 my $digest = extract_param($param, 'digest');
                 PVE::Tools::assert_if_modified($config->digest(), $digest) if $digest;
 
-                if (($param->{protocol} // '') eq 'bgp') {
-                    my $controller_cfg = PVE::Network::SDN::Controllers::config();
-                    for my $id (keys %{ $controller_cfg->{ids} // {} }) {
-                        die "cannot add a BGP fabric while BGP controller '$id' exists:"
-                            . " both target the default-VRF BGP router\n"
-                            if $controller_cfg->{ids}->{$id}->{type} eq 'bgp';
-                    }
-                }
+                PVE::Network::SDN::Zones::api_get_zone_checked($param->{zone}, ['SDN.Allocate'])
+                    if $param->{zone};
+
+                validate_fabric_zone($param);
 
                 my $privs = ['SDN.Use', 'SDN.Allocate'];
                 PVE::Network::SDN::Fabrics::api_validate_property_references($param, $privs);
@@ -200,7 +236,12 @@ __PACKAGE__->register_method({
                 my $privs = ['SDN.Use', 'SDN.Allocate'];
                 PVE::Network::SDN::Fabrics::api_validate_property_references($param, $privs);
 
+                my $old_zone = $config->get_fabric($id)->{zone} // '';
+                raise_param_exc({ zone => "cannot change the VRF zone of an existing fabric" })
+                    if defined($param->{zone}) && $param->{zone} ne $old_zone;
+
                 $config->update_fabric($id, $param);
+                validate_fabric_zone($config->get_fabric($id), $config);
                 PVE::Network::SDN::Fabrics::write_config($config);
             },
             "updating fabric failed",
diff --git a/src/PVE/API2/Network/SDN/Fabrics/FabricNode.pm b/src/PVE/API2/Network/SDN/Fabrics/FabricNode.pm
index 7a148b550f7d..eb3b429075e5 100644
--- a/src/PVE/API2/Network/SDN/Fabrics/FabricNode.pm
+++ b/src/PVE/API2/Network/SDN/Fabrics/FabricNode.pm
@@ -9,6 +9,7 @@ use PVE::Tools qw(extract_param run_command);
 use PVE::Network::SDN;
 use PVE::Network::SDN::Fabrics;
 use PVE::Network::SDN::WireGuard;
+use PVE::Network::SDN::Zones;
 use PVE::RS::SDN::Fabrics;
 
 use PVE::RESTHandler;
@@ -138,6 +139,21 @@ my sub is_internal_wireguard_node {
     return $node->{protocol} eq 'wireguard' && $node->{role} eq 'internal';
 }
 
+my sub validate_node_fabric_zone {
+    my ($config, $fabric_id, $node_id) = @_;
+
+    my $fabric = $config->get_fabric($fabric_id);
+    my $zone_id = $fabric->{zone};
+    return if !$zone_id;
+
+    my $zone = PVE::Network::SDN::Zones::get_zone($zone_id);
+
+    die "zone '$zone_id' does not exist\n" if !$zone;
+    PVE::Network::SDN::Fabrics::assert_fabric_node_in_zone(
+        $fabric_id, $node_id, $zone_id, $zone,
+    );
+}
+
 __PACKAGE__->register_method({
     name => 'add_node',
     path => '',
@@ -169,6 +185,8 @@ __PACKAGE__->register_method({
                 my $digest = extract_param($param, 'digest');
                 PVE::Tools::assert_if_modified($config->digest(), $digest) if $digest;
 
+                validate_node_fabric_zone($config, $param->{fabric_id}, $param->{node_id});
+
                 if (is_internal_wireguard_node($param) && $param->{interfaces}) {
                     my $private_keys = PVE::Network::SDN::WireGuard::private_keys();
 
diff --git a/src/PVE/API2/Network/SDN/Zones.pm b/src/PVE/API2/Network/SDN/Zones.pm
index 38d950fda076..e4f4b174466e 100644
--- a/src/PVE/API2/Network/SDN/Zones.pm
+++ b/src/PVE/API2/Network/SDN/Zones.pm
@@ -11,6 +11,7 @@ use PVE::SafeSyslog;
 use PVE::Tools qw(extract_param);
 
 use PVE::Network::SDN::Dns;
+use PVE::Network::SDN::Fabrics;
 use PVE::Network::SDN::Subnets;
 use PVE::Network::SDN::Vnets;
 use PVE::Network::SDN;
@@ -363,6 +364,13 @@ sub create_etc_interfaces_sdn_dir {
     mkdir("/etc/pve/sdn");
 }
 
+sub fabrics_using_zone {
+    my ($zone_id, $fabric_config) = @_;
+
+    my $fabrics = $fabric_config->list_fabrics();
+    return grep { ($fabrics->{$_}->{zone} // '') eq $zone_id } sort keys $fabrics->%*;
+}
+
 __PACKAGE__->register_method({
     name => 'create',
     protected => 1,
@@ -475,6 +483,22 @@ __PACKAGE__->register_method({
 
                 $scfg->{$_} = $opts->{$_} for keys $opts->%*;
 
+                my $fabric_config = PVE::Network::SDN::Fabrics::config();
+                my @fabric_ids = fabrics_using_zone($id, $fabric_config);
+
+                if (@fabric_ids && $scfg->{type} eq 'simple' && !$scfg->{'dedicated-vrf'}) {
+                    raise_param_exc({
+                        'dedicated-vrf' =>
+                            "zone is still used as VRF by fabric '$fabric_ids[0]'",
+                    });
+                }
+
+                for my $fabric_id (@fabric_ids) {
+                    PVE::Network::SDN::Fabrics::assert_fabric_nodes_in_zone(
+                        $fabric_config, $fabric_id, $id, $scfg,
+                    );
+                }
+
                 my $new_ipam = $scfg->{ipam};
                 if (!$new_ipam != !$old_ipam || (($new_ipam // '') ne ($old_ipam // ''))) {
                     # don't allow ipam change if subnet are defined for now, need to implement resync ipam content
@@ -547,6 +571,10 @@ __PACKAGE__->register_method({
                 my $plugin = PVE::Network::SDN::Zones::Plugin->lookup($scfg->{type});
                 my $vnet_cfg = PVE::Network::SDN::Vnets::config();
 
+                my $fabric_config = PVE::Network::SDN::Fabrics::config();
+                my @fabric_ids = fabrics_using_zone($id, $fabric_config);
+                die "zone is still used as VRF by fabric '$fabric_ids[0]'\n" if @fabric_ids;
+
                 $plugin->on_delete_hook($id, $vnet_cfg);
 
                 delete $cfg->{ids}->{$id};
diff --git a/src/PVE/Network/SDN/Controllers/BgpPlugin.pm b/src/PVE/Network/SDN/Controllers/BgpPlugin.pm
index 537b46229e58..328246ce7d77 100644
--- a/src/PVE/Network/SDN/Controllers/BgpPlugin.pm
+++ b/src/PVE/Network/SDN/Controllers/BgpPlugin.pm
@@ -209,7 +209,7 @@ sub on_update_hook {
     for my $id (keys %$fabrics) {
         die "cannot configure a BGP controller while BGP fabric '$id' exists:"
             . " both target the default-VRF BGP router\n"
-            if $fabrics->{$id}->{protocol} eq 'bgp';
+            if $fabrics->{$id}->{protocol} eq 'bgp' && !$fabrics->{$id}->{zone};
     }
 
     my $controller = $controller_cfg->{ids}->{$controllerid};
diff --git a/src/PVE/Network/SDN/Fabrics.pm b/src/PVE/Network/SDN/Fabrics.pm
index 41119b2ec782..e7cec1fe9582 100644
--- a/src/PVE/Network/SDN/Fabrics.pm
+++ b/src/PVE/Network/SDN/Fabrics.pm
@@ -229,6 +229,23 @@ sub write_config {
     cfs_write_file("sdn/fabrics.cfg", $config->to_raw(), 1);
 }
 
+sub assert_fabric_node_in_zone {
+    my ($fabric_id, $node_id, $zone_id, $zone) = @_;
+
+    return if !defined($zone->{nodes}) || $zone->{nodes}->{$node_id};
+
+    die "fabric '$fabric_id' contains node '$node_id', which is not enabled for zone '$zone_id'\n";
+}
+
+sub assert_fabric_nodes_in_zone {
+    my ($config, $fabric_id, $zone_id, $zone) = @_;
+
+    my $nodes = $config->list_nodes_fabric($fabric_id);
+    for my $node_id (sort keys $nodes->%*) {
+        assert_fabric_node_in_zone($fabric_id, $node_id, $zone_id, $zone);
+    }
+}
+
 sub get_frr_daemon_status {
     my ($fabric_config) = @_;
 
@@ -512,6 +529,15 @@ sub fabric_properties {
         protocol => get_standard_option('pve-sdn-fabric-protocol'),
         digest => get_standard_option('pve-config-digest'),
         'lock-token' => get_standard_option('pve-sdn-lock-token'),
+        zone => get_standard_option(
+            'pve-sdn-zone-id',
+            {
+                description => 'Simple zone whose VRF contains this fabric.',
+                'type-property' => 'protocol',
+                'instance-types' => ['bgp', 'ospf'],
+                optional => 1,
+            },
+        ),
         ip_prefix => {
             type => 'string',
             format => 'CIDR',
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 65+ messages in thread

* [PATCH pve-network v3 17/32] sdn: require underlay fabrics to use the default VRF
  2026-11-16 16:11 [PATCH common/manager/network/proxmox{-ve-rs,-perl-rs,-widget-toolkit} v3 00/32] SDN VRF support Gabriel Goller
                   ` (15 preceding siblings ...)
  2026-11-16 16:11 ` [PATCH pve-network v3 16/32] sdn: allow fabrics to use simple zone VRFs Gabriel Goller
@ 2026-11-16 16:11 ` Gabriel Goller
  2026-11-18 16:30   ` Stefan Hanreich
  2026-11-16 16:11 ` [PATCH pve-network v3 18/32] sdn: always generate EVPN zone VRFs Gabriel Goller
                   ` (16 subsequent siblings)
  33 siblings, 1 reply; 65+ messages in thread
From: Gabriel Goller @ 2026-11-16 16:11 UTC (permalink / raw)
  To: pve-devel

EVPN controllers and VXLAN zones set up their VTEPs and BGP peering in
the default VRF, so an underlay fabric in a zone VRF breaks them. A
fabric's VRF cannot change after creation, so checking the fabric when
a controller or zone references it is enough.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
 src/PVE/Network/SDN/Controllers/EvpnPlugin.pm |  2 ++
 src/PVE/Network/SDN/Fabrics.pm                | 10 ++++++++++
 src/PVE/Network/SDN/Zones/VxlanPlugin.pm      |  5 +++++
 3 files changed, 17 insertions(+)

diff --git a/src/PVE/Network/SDN/Controllers/EvpnPlugin.pm b/src/PVE/Network/SDN/Controllers/EvpnPlugin.pm
index 4220cb6721e5..67afe936ecc9 100644
--- a/src/PVE/Network/SDN/Controllers/EvpnPlugin.pm
+++ b/src/PVE/Network/SDN/Controllers/EvpnPlugin.pm
@@ -688,6 +688,8 @@ sub on_update_hook {
         die "must have exactly one of peers / fabric defined"
             if ($controller->{peers} && $controller->{fabric})
             || !($controller->{peers} || $controller->{fabric});
+        PVE::Network::SDN::Fabrics::assert_underlay_fabric($controller->{fabric})
+            if $controller->{fabric};
         if ($controller->{peers}) {
             my @peers = PVE::Tools::split_list($controller->{peers});
             my $family;
diff --git a/src/PVE/Network/SDN/Fabrics.pm b/src/PVE/Network/SDN/Fabrics.pm
index e7cec1fe9582..a9ea0b74301e 100644
--- a/src/PVE/Network/SDN/Fabrics.pm
+++ b/src/PVE/Network/SDN/Fabrics.pm
@@ -246,6 +246,16 @@ sub assert_fabric_nodes_in_zone {
     }
 }
 
+sub assert_underlay_fabric {
+    my ($fabric_id) = @_;
+
+    my $fabric = eval { config()->get_fabric($fabric_id) };
+    die "fabric '$fabric_id' does not exist\n" if !$fabric;
+    die "fabric '$fabric_id' is in the VRF of zone '$fabric->{zone}', underlay fabrics must use"
+        . " the default VRF\n"
+        if $fabric->{zone};
+}
+
 sub get_frr_daemon_status {
     my ($fabric_config) = @_;
 
diff --git a/src/PVE/Network/SDN/Zones/VxlanPlugin.pm b/src/PVE/Network/SDN/Zones/VxlanPlugin.pm
index b8b1ef0eeb7f..059bc90f4211 100644
--- a/src/PVE/Network/SDN/Zones/VxlanPlugin.pm
+++ b/src/PVE/Network/SDN/Zones/VxlanPlugin.pm
@@ -167,6 +167,11 @@ sub on_update_hook {
             fabric => "must have exactly one of peers / fabric defined",
         });
     }
+
+    if ($zone->{fabric}) {
+        eval { PVE::Network::SDN::Fabrics::assert_underlay_fabric($zone->{fabric}) };
+        raise_param_exc({ fabric => "$@" }) if $@;
+    }
 }
 
 sub vnet_update_hook {
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 65+ messages in thread

* [PATCH pve-network v3 18/32] sdn: always generate EVPN zone VRFs
  2026-11-16 16:11 [PATCH common/manager/network/proxmox{-ve-rs,-perl-rs,-widget-toolkit} v3 00/32] SDN VRF support Gabriel Goller
                   ` (16 preceding siblings ...)
  2026-11-16 16:11 ` [PATCH pve-network v3 17/32] sdn: require underlay fabrics to use the default VRF Gabriel Goller
@ 2026-11-16 16:11 ` Gabriel Goller
  2026-11-16 16:11 ` [PATCH pve-network v3 19/32] api: sdn: allow EVPN zones as fabric VRFs Gabriel Goller
                   ` (15 subsequent siblings)
  33 siblings, 0 replies; 65+ messages in thread
From: Gabriel Goller @ 2026-11-16 16:11 UTC (permalink / raw)
  To: pve-devel

Fabrics need the zone VRF even when the zone has no VNets. Previously,
the VRF was only created along with the first VNet, so an empty EVPN
zone could not be used for a fabric.

Create it independently of the VNets, as for simple zones. Keep the
unreachable default routes on non-exit nodes to prevent lookups from
falling through to the main table.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
 src/PVE/Network/SDN/Zones.pm                  |  6 ++--
 src/PVE/Network/SDN/Zones/EvpnPlugin.pm       | 35 ++++++++++++-------
 src/PVE/Network/SDN/Zones/Plugin.pm           |  6 ++++
 .../evpn/vrf-empty/expected_sdn_interfaces    |  7 ++++
 src/test/zones/evpn/vrf-empty/interfaces      |  2 ++
 src/test/zones/evpn/vrf-empty/sdn_config      | 13 +++++++
 6 files changed, 53 insertions(+), 16 deletions(-)
 create mode 100644 src/test/zones/evpn/vrf-empty/expected_sdn_interfaces
 create mode 100644 src/test/zones/evpn/vrf-empty/interfaces
 create mode 100644 src/test/zones/evpn/vrf-empty/sdn_config

diff --git a/src/PVE/Network/SDN/Zones.pm b/src/PVE/Network/SDN/Zones.pm
index cf81c002c4a5..1d3ad22c1cd5 100644
--- a/src/PVE/Network/SDN/Zones.pm
+++ b/src/PVE/Network/SDN/Zones.pm
@@ -136,12 +136,10 @@ sub generate_etc_network_config {
 
     for my $zone_id (sort keys %$zone_ids) {
         my $plugin_config = $zone_ids->{$zone_id};
-        next if $plugin_config->{type} ne 'simple';
         next if defined($plugin_config->{nodes}) && !$plugin_config->{nodes}->{$nodename};
 
-        PVE::Network::SDN::Zones::SimplePlugin->generate_zone_config(
-            $plugin_config, $zone_id, $config,
-        );
+        my $plugin = PVE::Network::SDN::Zones::Plugin->lookup($plugin_config->{type});
+        $plugin->generate_zone_config($plugin_config, $zone_id, $config);
     }
 
     for my $id (sort keys %$vnet_ids) {
diff --git a/src/PVE/Network/SDN/Zones/EvpnPlugin.pm b/src/PVE/Network/SDN/Zones/EvpnPlugin.pm
index 534ac9ffa5b1..e5b8ea16446f 100644
--- a/src/PVE/Network/SDN/Zones/EvpnPlugin.pm
+++ b/src/PVE/Network/SDN/Zones/EvpnPlugin.pm
@@ -133,6 +133,27 @@ sub options {
 }
 
 # Plugin implementation
+sub generate_zone_config {
+    my ($class, $plugin_config, $zone_id, $config) = @_;
+
+    my $vrf_iface = "vrf_$zone_id";
+    my $local_node = PVE::INotify::nodename();
+    my $is_evpn_gateway =
+        $plugin_config->{exitnodes} && $plugin_config->{exitnodes}->{$local_node};
+    my $route_action = $is_evpn_gateway ? 'del' : 'add';
+
+    if (!defined($config->{$vrf_iface})) {
+        $config->{$vrf_iface} = [
+            'vrf-table auto',
+            PVE::Network::SDN::Zones::Plugin::vrf_unreachable_default_cmds(
+                $vrf_iface, $route_action,
+            ),
+        ];
+    }
+
+    return $config;
+}
+
 sub generate_sdn_config {
     my (
         $class,
@@ -215,7 +236,8 @@ sub generate_sdn_config {
         die "neither fabric nor peers configured for EVPN controller $controller->{id}";
     }
 
-    my $is_evpn_gateway = $plugin_config->{'exitnodes'}->{$local_node};
+    my $is_evpn_gateway =
+        $plugin_config->{exitnodes} && $plugin_config->{exitnodes}->{$local_node};
     my $exitnodes_local_routing = $plugin_config->{'exitnodes-local-routing'};
 
     my $mtu = 1450;
@@ -314,17 +336,6 @@ sub generate_sdn_config {
     push(@{ $config->{$vnetid} }, @iface_config) if !$config->{$vnetid};
 
     if ($vrf_iface) {
-        #vrf interface
-        @iface_config = ();
-        push @iface_config, "vrf-table auto";
-        my $route_action = $is_evpn_gateway ? 'del' : 'add';
-        push @iface_config,
-            PVE::Network::SDN::Zones::Plugin::vrf_unreachable_default_cmds(
-                $vrf_iface, $route_action,
-            );
-
-        push(@{ $config->{$vrf_iface} }, @iface_config) if !$config->{$vrf_iface};
-
         if ($vrfvxlan) {
             #l3vni vxlan interface
             my $iface_vrf_vxlan = "vrfvx_$zoneid";
diff --git a/src/PVE/Network/SDN/Zones/Plugin.pm b/src/PVE/Network/SDN/Zones/Plugin.pm
index b3b4261c58af..dc8f19cb6587 100644
--- a/src/PVE/Network/SDN/Zones/Plugin.pm
+++ b/src/PVE/Network/SDN/Zones/Plugin.pm
@@ -110,6 +110,12 @@ sub vrf_unreachable_default_cmds {
     } ('', ' -6');
 }
 
+sub generate_zone_config {
+    my ($class, $plugin_config, $zone_id, $config) = @_;
+
+    return $config;
+}
+
 sub generate_sdn_config {
     my (
         $class,
diff --git a/src/test/zones/evpn/vrf-empty/expected_sdn_interfaces b/src/test/zones/evpn/vrf-empty/expected_sdn_interfaces
new file mode 100644
index 000000000000..d3b7de26d460
--- /dev/null
+++ b/src/test/zones/evpn/vrf-empty/expected_sdn_interfaces
@@ -0,0 +1,7 @@
+#version:1
+
+auto vrf_myzone
+iface vrf_myzone
+	vrf-table auto
+	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
+	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
diff --git a/src/test/zones/evpn/vrf-empty/interfaces b/src/test/zones/evpn/vrf-empty/interfaces
new file mode 100644
index 000000000000..f1bd92ed2b43
--- /dev/null
+++ b/src/test/zones/evpn/vrf-empty/interfaces
@@ -0,0 +1,2 @@
+auto lo
+iface lo inet loopback
diff --git a/src/test/zones/evpn/vrf-empty/sdn_config b/src/test/zones/evpn/vrf-empty/sdn_config
new file mode 100644
index 000000000000..00c1c724b95e
--- /dev/null
+++ b/src/test/zones/evpn/vrf-empty/sdn_config
@@ -0,0 +1,13 @@
+{
+  version => 1,
+  vnets   => { ids => {} },
+  zones   => {
+               ids => {
+                        myzone => {
+                                    type => "evpn",
+                                    controller => "evpnctl",
+                                    "vrf-vxlan" => 1000,
+                                  },
+                      },
+             },
+}
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 65+ messages in thread

* [PATCH pve-network v3 19/32] api: sdn: allow EVPN zones as fabric VRFs
  2026-11-16 16:11 [PATCH common/manager/network/proxmox{-ve-rs,-perl-rs,-widget-toolkit} v3 00/32] SDN VRF support Gabriel Goller
                   ` (17 preceding siblings ...)
  2026-11-16 16:11 ` [PATCH pve-network v3 18/32] sdn: always generate EVPN zone VRFs Gabriel Goller
@ 2026-11-16 16:11 ` Gabriel Goller
  2026-11-16 16:11 ` [PATCH pve-network v3 20/32] api: sdn: disallow BGP fabrics in EVPN zone VRFs Gabriel Goller
                   ` (14 subsequent siblings)
  33 siblings, 0 replies; 65+ messages in thread
From: Gabriel Goller @ 2026-11-16 16:11 UTC (permalink / raw)
  To: pve-devel

Allow fabrics to use an EVPN zone's routing table instead of the default
VRF, so their routes stay within the zone. EVPN zones always have a
dedicated VRF, including when they have no VNets.

Simple zones still need dedicated-vrf enabled. The existing checks that
the zone is enabled on every fabric node also apply to EVPN zones.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
 src/PVE/API2/Network/SDN/Fabrics/Fabric.pm | 6 +++---
 src/PVE/Network/SDN/Fabrics.pm             | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/PVE/API2/Network/SDN/Fabrics/Fabric.pm b/src/PVE/API2/Network/SDN/Fabrics/Fabric.pm
index 20b7b1f98e4b..48c7198ad0f5 100644
--- a/src/PVE/API2/Network/SDN/Fabrics/Fabric.pm
+++ b/src/PVE/API2/Network/SDN/Fabrics/Fabric.pm
@@ -39,10 +39,10 @@ sub validate_fabric_zone {
     my $zone = PVE::Network::SDN::Zones::get_zone($zone_id);
 
     raise_param_exc({ zone => "zone '$zone_id' does not exist" }) if !$zone;
-    raise_param_exc({ zone => "zone '$zone_id' is not a simple zone" })
-        if $zone->{type} ne 'simple';
+    raise_param_exc({ zone => "zone '$zone_id' does not provide a dedicated VRF" })
+        if $zone->{type} ne 'simple' && $zone->{type} ne 'evpn';
     raise_param_exc({ zone => "zone '$zone_id' is configured to use the default VRF" })
-        if $zone->{'default-vrf'} // 1;
+        if $zone->{type} eq 'simple' && !$zone->{'dedicated-vrf'};
 
     if ($config) {
         PVE::Network::SDN::Fabrics::assert_fabric_nodes_in_zone(
diff --git a/src/PVE/Network/SDN/Fabrics.pm b/src/PVE/Network/SDN/Fabrics.pm
index a9ea0b74301e..2c5c90adba58 100644
--- a/src/PVE/Network/SDN/Fabrics.pm
+++ b/src/PVE/Network/SDN/Fabrics.pm
@@ -542,7 +542,7 @@ sub fabric_properties {
         zone => get_standard_option(
             'pve-sdn-zone-id',
             {
-                description => 'Simple zone whose VRF contains this fabric.',
+                description => 'SDN zone whose VRF contains this fabric.',
                 'type-property' => 'protocol',
                 'instance-types' => ['bgp', 'ospf'],
                 optional => 1,
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 65+ messages in thread

* [PATCH pve-network v3 20/32] api: sdn: disallow BGP fabrics in EVPN zone VRFs
  2026-11-16 16:11 [PATCH common/manager/network/proxmox{-ve-rs,-perl-rs,-widget-toolkit} v3 00/32] SDN VRF support Gabriel Goller
                   ` (18 preceding siblings ...)
  2026-11-16 16:11 ` [PATCH pve-network v3 19/32] api: sdn: allow EVPN zones as fabric VRFs Gabriel Goller
@ 2026-11-16 16:11 ` Gabriel Goller
  2026-11-16 16:11 ` [PATCH pve-network v3 21/32] sdn: simple: support static routes in zone routing tables Gabriel Goller
                   ` (13 subsequent siblings)
  33 siblings, 0 replies; 65+ messages in thread
From: Gabriel Goller @ 2026-11-16 16:11 UTC (permalink / raw)
  To: pve-devel

EVPN controllers already configure a BGP instance in the zone VRF. FRR
only allows one BGP instance per VRF, so a BGP fabric in the same VRF
would conflict with the controller's configuration.

Reject this combination when creating or updating a fabric. OSPF fabrics
can still use EVPN zone VRFs.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
 src/PVE/API2/Network/SDN/Fabrics/Fabric.pm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/PVE/API2/Network/SDN/Fabrics/Fabric.pm b/src/PVE/API2/Network/SDN/Fabrics/Fabric.pm
index 48c7198ad0f5..e245a0dc3736 100644
--- a/src/PVE/API2/Network/SDN/Fabrics/Fabric.pm
+++ b/src/PVE/API2/Network/SDN/Fabrics/Fabric.pm
@@ -41,6 +41,8 @@ sub validate_fabric_zone {
     raise_param_exc({ zone => "zone '$zone_id' does not exist" }) if !$zone;
     raise_param_exc({ zone => "zone '$zone_id' does not provide a dedicated VRF" })
         if $zone->{type} ne 'simple' && $zone->{type} ne 'evpn';
+    raise_param_exc({ zone => "BGP fabrics cannot use an EVPN zone VRF" })
+        if $protocol eq 'bgp' && $zone->{type} eq 'evpn';
     raise_param_exc({ zone => "zone '$zone_id' is configured to use the default VRF" })
         if $zone->{type} eq 'simple' && !$zone->{'dedicated-vrf'};
 
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 65+ messages in thread

* [PATCH pve-network v3 21/32] sdn: simple: support static routes in zone routing tables
  2026-11-16 16:11 [PATCH common/manager/network/proxmox{-ve-rs,-perl-rs,-widget-toolkit} v3 00/32] SDN VRF support Gabriel Goller
                   ` (19 preceding siblings ...)
  2026-11-16 16:11 ` [PATCH pve-network v3 20/32] api: sdn: disallow BGP fabrics in EVPN zone VRFs Gabriel Goller
@ 2026-11-16 16:11 ` Gabriel Goller
  2026-11-18 16:49   ` Stefan Hanreich
  2026-11-16 16:11 ` [PATCH pve-network v3 22/32] sdn: evpn: allow static routes Gabriel Goller
                   ` (12 subsequent siblings)
  33 siblings, 1 reply; 65+ messages in thread
From: Gabriel Goller @ 2026-11-16 16:11 UTC (permalink / raw)
  To: pve-devel

Allow simple zones to reach outside networks through static routes,
without needing a fabric. Routes use the zone's dedicated VRF, or the
default routing table if dedicated-vrf is disabled.

Support IPv4 and IPv6 routes, including default routes, with a gateway
or an outgoing interface. nexthop-vrf allows a gateway in another VRF,
e.g. the default VRF, without moving the uplink into the zone.

Routes are managed by FRR, so zones with static routes need FRR even
without a controller or fabric. This requires the matching pve-rs
support for route validation and FRR config generation.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
 src/PVE/API2/Network/SDN/Zones.pm         |   9 ++
 src/PVE/Network/SDN.pm                    |  22 ++-
 src/PVE/Network/SDN/Zones/Plugin.pm       |  55 +++++++
 src/PVE/Network/SDN/Zones/SimplePlugin.pm |   1 +
 src/test/Makefile                         |   5 +-
 src/test/run_test_static_routes.pl        | 178 ++++++++++++++++++++++
 6 files changed, 266 insertions(+), 4 deletions(-)
 create mode 100644 src/test/run_test_static_routes.pl

diff --git a/src/PVE/API2/Network/SDN/Zones.pm b/src/PVE/API2/Network/SDN/Zones.pm
index e4f4b174466e..8df1bf8527fd 100644
--- a/src/PVE/API2/Network/SDN/Zones.pm
+++ b/src/PVE/API2/Network/SDN/Zones.pm
@@ -68,6 +68,15 @@ my $ZONE_PROPERTIES = {
         optional => 1,
         description => 'Create a dedicated VRF for a simple zone.',
     },
+    route => {
+        type => 'array',
+        optional => 1,
+        description => 'Static routes in the zone routing table. Simple zone only.',
+        items => {
+            type => 'string',
+            format => 'pve-sdn-static-route',
+        },
+    },
     'rt-import' => {
         type => 'string',
         optional => 1,
diff --git a/src/PVE/Network/SDN.pm b/src/PVE/Network/SDN.pm
index 9373ec3035fa..626fe7387f54 100644
--- a/src/PVE/Network/SDN.pm
+++ b/src/PVE/Network/SDN.pm
@@ -17,6 +17,7 @@ use PVE::RESTEnvironment qw(log_warn);
 use PVE::RPCEnvironment;
 use PVE::Tools qw(file_get_contents file_set_contents extract_param dir_glob_regex run_command);
 
+use PVE::RS::SDN;
 use PVE::RS::SDN::Fabrics;
 
 use PVE::Network::SDN::Vnets;
@@ -130,10 +131,19 @@ sub running_config_has_frr {
     my $fabrics = $running_config->{fabrics}->{ids} // {};
     my $route_maps = $running_config->{'route-maps'}->{ids} // {};
     my $prefix_lists = $running_config->{'prefix-lists'}->{ids} // {};
+    my $zones = $running_config->{zones}->{ids} // {};
+    my $zone_routes =
+        grep { $_->{type} eq 'simple' && scalar(@{ $_->{route} // [] }) } values %$zones;
 
     my $local_frr_config = PVE::Network::SDN::Frr::local_frr_config_exists();
 
-    return %$controllers || %$fabrics || %$route_maps || %$prefix_lists || $local_frr_config;
+    return
+        %$controllers
+        || %$fabrics
+        || %$route_maps
+        || %$prefix_lists
+        || $zone_routes
+        || $local_frr_config;
 }
 
 sub pending_config {
@@ -563,11 +573,14 @@ sub generate_frr_raw_config {
 
     my $frr_config = {};
 
+    my $nodename = PVE::INotify::nodename();
+
     PVE::Network::SDN::Controllers::generate_frr_config($frr_config, $running_config);
+    my $routes =
+        PVE::RS::SDN::get_zone_routes($running_config->{zones} // { ids => {} }, $nodename);
+    push @{ $frr_config->{frr}->{ip_routes} }, @$routes;
     PVE::Network::SDN::Frr::append_local_config($frr_config);
 
-    my $nodename = PVE::INotify::nodename();
-
     return PVE::RS::SDN::get_frr_raw_config(
         $frr_config->{'frr'},
         $prefix_list_config,
@@ -619,6 +632,9 @@ sub generate_dhcp_config {
 sub encode_value {
     my ($type, $key, $value) = @_;
 
+    # Route strings contain commas themselves, so preserve array element boundaries.
+    return join("\n", sort @$value) if $key eq 'route' && ref($value) eq 'ARRAY';
+
     if (
         $key eq 'nodes'
         || $key eq 'exitnodes'
diff --git a/src/PVE/Network/SDN/Zones/Plugin.pm b/src/PVE/Network/SDN/Zones/Plugin.pm
index dc8f19cb6587..a3863bc9818c 100644
--- a/src/PVE/Network/SDN/Zones/Plugin.pm
+++ b/src/PVE/Network/SDN/Zones/Plugin.pm
@@ -8,6 +8,7 @@ use Net::IP qw(ip_get_version);
 use PVE::JSONSchema;
 use PVE::Cluster;
 use PVE::Network;
+use PVE::RS::SDN;
 
 use PVE::JSONSchema qw(get_standard_option);
 use base qw(PVE::SectionConfig);
@@ -29,6 +30,50 @@ PVE::JSONSchema::register_standard_option(
     },
 );
 
+my $static_route_fmt = {
+    prefix => {
+        type => 'string',
+        description => 'Destination prefix in CIDR notation, including default routes.',
+    },
+    via => {
+        type => 'string',
+        format => 'ip',
+        optional => 1,
+        description => 'Next-hop IP address. IPv6 link-local addresses require an interface.',
+    },
+    iface => {
+        type => 'string',
+        optional => 1,
+        description => 'Outgoing interface. At least one of via or iface is required.',
+    },
+    distance => {
+        type => 'integer',
+        minimum => 1,
+        maximum => 255,
+        optional => 1,
+        description => 'Administrative distance.',
+    },
+    'nexthop-vrf' => {
+        type => 'string',
+        optional => 1,
+        description => 'VRF of the next hop, or default for the default routing table.',
+    },
+};
+
+PVE::JSONSchema::register_format(
+    'pve-sdn-static-route',
+    $static_route_fmt,
+    sub {
+        my ($route) = @_;
+
+        PVE::RS::SDN::validate_static_route(
+            PVE::JSONSchema::print_property_string($route, $static_route_fmt),
+        );
+
+        return $route;
+    },
+);
+
 my $defaultData = {
 
     propertyList => {
@@ -39,6 +84,16 @@ my $defaultData = {
             type => 'string',
         },
         nodes => get_standard_option('pve-node-list', { optional => 1 }),
+        route => {
+            type => 'array',
+            optional => 1,
+            description =>
+                'Static routes in the zone VRF, or the default table for Simple zones without dedicated-vrf.',
+            items => {
+                type => 'string',
+                format => 'pve-sdn-static-route',
+            },
+        },
         zone => get_standard_option(
             'pve-sdn-zone-id',
             {
diff --git a/src/PVE/Network/SDN/Zones/SimplePlugin.pm b/src/PVE/Network/SDN/Zones/SimplePlugin.pm
index bc591839819d..1d44f0b078f5 100644
--- a/src/PVE/Network/SDN/Zones/SimplePlugin.pm
+++ b/src/PVE/Network/SDN/Zones/SimplePlugin.pm
@@ -53,6 +53,7 @@ sub options {
         ipam => { optional => 1 },
         dhcp => { optional => 1 },
         'dedicated-vrf' => { optional => 1 },
+        route => { optional => 1 },
     };
 }
 
diff --git a/src/test/Makefile b/src/test/Makefile
index 607153a8a1b5..85aad2a8e439 100644
--- a/src/test/Makefile
+++ b/src/test/Makefile
@@ -1,10 +1,13 @@
 all: test
 
-test: test_zones test_ipams test_dns test_subnets test_vnets_blackbox test_running_config
+test: test_zones test_static_routes test_ipams test_dns test_subnets test_vnets_blackbox test_running_config
 
 test_zones: run_test_zones.pl
 	./run_test_zones.pl
 
+test_static_routes: run_test_static_routes.pl
+	perl ./run_test_static_routes.pl
+
 test_ipams: run_test_ipams.pl
 	./run_test_ipams.pl
 
diff --git a/src/test/run_test_static_routes.pl b/src/test/run_test_static_routes.pl
new file mode 100644
index 000000000000..c6809fe4dc9c
--- /dev/null
+++ b/src/test/run_test_static_routes.pl
@@ -0,0 +1,178 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use lib qw(..);
+
+use Storable qw(dclone);
+use Test::More;
+use Test::MockModule;
+
+use PVE::API2::Network::SDN::Zones;
+use PVE::Network::SDN;
+
+my $routes = [
+    'prefix=0.0.0.0/0,via=192.0.2.1,iface=uplink0,distance=20,nexthop-vrf=default',
+    'prefix=::/0,via=fe80::1,iface=uplink0,nexthop-vrf=default',
+    'prefix=10.20.0.0/16,iface=vnet0',
+];
+my $zones = {
+    ids => {
+        isolated => {
+            type => 'simple',
+            'dedicated-vrf' => 1,
+            nodes => { localhost => 1 },
+            route => $routes,
+        },
+        plain => {
+            type => 'simple',
+            route => ['prefix=198.51.100.0/24,via=192.0.2.1'],
+        },
+        remote => {
+            type => 'simple',
+            nodes => { othernode => 1 },
+            route => ['prefix=192.0.2.0/24,iface=remote0'],
+        },
+    },
+};
+
+subtest 'route API schema and Rust validation' => sub {
+    my $create = PVE::API2::Network::SDN::Zones->map_method_by_name('create');
+    my $schema = $create->{parameters}->{properties}->{route};
+    is($schema->{type}, 'array', 'API accepts repeatable routes');
+
+    my $errors = {};
+    PVE::JSONSchema::check_prop($routes, $schema, 'route', $errors);
+    is_deeply($errors, {}, 'default routes and interface-only routes are valid');
+
+    for my $route (
+        'via=192.0.2.1',
+        'prefix=0.0.0.0/0',
+        'prefix=::/0,via=fe80::1',
+        'prefix=0.0.0.0/0,via=2001:db8::1',
+        'prefix=::/0,via=192.0.2.1',
+        'prefix=0.0.0.0/0,via=192.0.2.1,distance=256',
+    ) {
+        my $errors = {};
+        PVE::JSONSchema::check_prop([$route], $schema, 'route', $errors);
+        ok(scalar(keys %$errors), "reject invalid route: $route");
+    }
+
+    for my $method ('index', 'read') {
+        my $info = PVE::API2::Network::SDN::Zones->map_method_by_name($method);
+        my $properties =
+            $method eq 'index'
+            ? $info->{returns}->{items}->{properties}
+            : $info->{returns}->{properties};
+        is_deeply(
+            $properties->{route}->{items},
+            $schema->{items},
+            "$method returns route strings",
+        );
+        is(
+            $properties->{pending}->{properties}->{route}->{type},
+            'array',
+            "$method pending routes are arrays",
+        );
+    }
+
+    eval {
+        PVE::Network::SDN::Zones::VlanPlugin->check_config(
+            'vlanzone',
+            { bridge => 'vmbr0', route => $routes },
+            1,
+            1,
+        );
+    };
+    like($@, qr/unexpected property 'route'/, 'routes are only supported on simple zones');
+};
+
+subtest 'repeatable config persistence' => sub {
+    my $raw = PVE::Network::SDN::Zones::Plugin->write_config('zones.cfg', dclone($zones));
+    is(scalar(() = $raw =~ /^\s+route /gm), 5, 'one config line per route');
+    my $parsed = PVE::Network::SDN::Zones::Plugin->parse_config('zones.cfg', $raw);
+    ok(!$parsed->{errors}, 'all routes parse without errors');
+    is_deeply($parsed->{ids}, $zones->{ids}, 'routes and node restrictions survive round trip');
+};
+
+subtest 'pending arrays compare by value' => sub {
+    my $running = { zones => dclone($zones) };
+    my $configured = dclone($zones);
+    my $pending = PVE::Network::SDN::pending_config($running, $configured, 'zones');
+    ok(!$pending->{ids}->{isolated}->{state}, 'equal arrays are unchanged');
+
+    $configured->{ids}->{isolated}->{route} = [reverse @$routes];
+    $pending = PVE::Network::SDN::pending_config($running, $configured, 'zones');
+    ok(!$pending->{ids}->{isolated}->{state}, 'route ordering does not cause pending changes');
+
+    $configured->{ids}->{isolated}->{route} = ['prefix=::/0,iface=vnet1'];
+    $pending = PVE::Network::SDN::pending_config($running, $configured, 'zones');
+    is($pending->{ids}->{isolated}->{state}, 'changed', 'route modification detected');
+    is_deeply(
+        $pending->{ids}->{isolated}->{pending}->{route},
+        ['prefix=::/0,iface=vnet1'],
+        'pending retains an array',
+    );
+
+    delete $configured->{ids}->{isolated}->{route};
+    $pending = PVE::Network::SDN::pending_config($running, $configured, 'zones');
+    is($pending->{ids}->{isolated}->{pending}->{route}, 'deleted', 'route removal detected');
+};
+
+my $running = { zones => $zones, controllers => { ids => {} }, vnets => { ids => {} } };
+my $sdn = Test::MockModule->new('PVE::Network::SDN');
+$sdn->mock(running_config => sub { return $running; });
+my $inotify = Test::MockModule->new('PVE::INotify');
+$inotify->mock(nodename => sub { return 'localhost'; });
+my $controllers = Test::MockModule->new('PVE::Network::SDN::Controllers');
+$controllers->mock(read_etc_network_interfaces => sub { return { ifaces => {} }; });
+my $frr = Test::MockModule->new('PVE::Network::SDN::Frr');
+$frr->mock(local_frr_config_exists => sub { return 0; });
+$frr->mock(
+    read_local_frr_config => sub { return 'ip prefix-list LOCAL seq 5 permit 203.0.113.0/24'; },
+);
+
+subtest 'route-only FRR detection' => sub {
+    ok(PVE::Network::SDN::running_config_has_frr(), 'routes without controllers require FRR');
+    local $running->{zones} = { ids => { empty => { type => 'simple', route => [] } } };
+    ok(!PVE::Network::SDN::running_config_has_frr(), 'empty route array does not require FRR');
+};
+
+subtest 'zone routes reach FRR with local config' => sub {
+    my $fabric_config = PVE::RS::SDN::Fabrics->running_config({});
+    my $route_maps = PVE::RS::SDN::RouteMaps->running_config({});
+    my $prefix_lists = PVE::RS::SDN::PrefixLists->running_config({});
+    my $raw = PVE::Network::SDN::generate_frr_raw_config(
+        $running, $fabric_config, $route_maps, $prefix_lists,
+    );
+    my $config = join("\n", @$raw);
+    like(
+        $config,
+        qr/^ip route 0\.0\.0\.0\/0 192\.0\.2\.1 uplink0 20 nexthop-vrf default vrf vrf_isolated$/m,
+        'IPv4 default route with distance and cross-VRF next hop',
+    );
+    like(
+        $config,
+        qr/^ipv6 route ::\/0 fe80::1 uplink0 nexthop-vrf default vrf vrf_isolated$/m,
+        'IPv6 link-local default route',
+    );
+    like(
+        $config,
+        qr/^ip route 10\.20\.0\.0\/16 vnet0 vrf vrf_isolated$/m,
+        'interface-only route in zone VRF',
+    );
+    like(
+        $config,
+        qr/^ip route 198\.51\.100\.0\/24 192\.0\.2\.1(?: vrf default)?$/m,
+        'zone without dedicated VRF uses default table',
+    );
+    unlike($config, qr/remote0/, 'routes restricted to another node are omitted');
+    like(
+        $config,
+        qr/^ip prefix-list LOCAL seq 5 permit 203\.0\.113\.0\/24$/m,
+        'local FRR configuration coexists with zone routes',
+    );
+};
+
+done_testing();
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 65+ messages in thread

* [PATCH pve-network v3 22/32] sdn: evpn: allow static routes
  2026-11-16 16:11 [PATCH common/manager/network/proxmox{-ve-rs,-perl-rs,-widget-toolkit} v3 00/32] SDN VRF support Gabriel Goller
                   ` (20 preceding siblings ...)
  2026-11-16 16:11 ` [PATCH pve-network v3 21/32] sdn: simple: support static routes in zone routing tables Gabriel Goller
@ 2026-11-16 16:11 ` Gabriel Goller
  2026-11-16 16:11 ` [PATCH pve-network v3 23/32] sdn: zones: SNAT via dedicated uplinks in zone VRFs Gabriel Goller
                   ` (11 subsequent siblings)
  33 siblings, 0 replies; 65+ messages in thread
From: Gabriel Goller @ 2026-11-16 16:11 UTC (permalink / raw)
  To: pve-devel

Allow EVPN zones to reach networks through a configured gateway or
interface, using the same route options as simple zones. Routes are
installed in the zone VRF on each node where the zone is enabled, and
can also use a next hop in another VRF.

Configuring a route does not enable static-route redistribution into
BGP. The unreachable default routes and exit-node behavior stay as they
are, so adding static routes does not change how other traffic leaves
the zone.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
 src/PVE/API2/Network/SDN/Zones.pm             |  2 +-
 src/PVE/Network/SDN.pm                        |  5 +-
 src/PVE/Network/SDN/Zones/EvpnPlugin.pm       |  1 +
 src/test/run_test_static_routes.pl            | 47 +++++++++++++++++--
 .../expected_controller_config                |  6 +++
 .../zones/evpn/advertise_subnets/sdn_config   |  8 +++-
 6 files changed, 61 insertions(+), 8 deletions(-)

diff --git a/src/PVE/API2/Network/SDN/Zones.pm b/src/PVE/API2/Network/SDN/Zones.pm
index 8df1bf8527fd..25e0aed017dc 100644
--- a/src/PVE/API2/Network/SDN/Zones.pm
+++ b/src/PVE/API2/Network/SDN/Zones.pm
@@ -71,7 +71,7 @@ my $ZONE_PROPERTIES = {
     route => {
         type => 'array',
         optional => 1,
-        description => 'Static routes in the zone routing table. Simple zone only.',
+        description => 'Static routes in the zone routing table. Simple and EVPN zones only.',
         items => {
             type => 'string',
             format => 'pve-sdn-static-route',
diff --git a/src/PVE/Network/SDN.pm b/src/PVE/Network/SDN.pm
index 626fe7387f54..ea7372213394 100644
--- a/src/PVE/Network/SDN.pm
+++ b/src/PVE/Network/SDN.pm
@@ -132,8 +132,9 @@ sub running_config_has_frr {
     my $route_maps = $running_config->{'route-maps'}->{ids} // {};
     my $prefix_lists = $running_config->{'prefix-lists'}->{ids} // {};
     my $zones = $running_config->{zones}->{ids} // {};
-    my $zone_routes =
-        grep { $_->{type} eq 'simple' && scalar(@{ $_->{route} // [] }) } values %$zones;
+    my $zone_routes = grep {
+        ($_->{type} eq 'simple' || $_->{type} eq 'evpn') && scalar(@{ $_->{route} // [] })
+    } values %$zones;
 
     my $local_frr_config = PVE::Network::SDN::Frr::local_frr_config_exists();
 
diff --git a/src/PVE/Network/SDN/Zones/EvpnPlugin.pm b/src/PVE/Network/SDN/Zones/EvpnPlugin.pm
index e5b8ea16446f..1933ce86f997 100644
--- a/src/PVE/Network/SDN/Zones/EvpnPlugin.pm
+++ b/src/PVE/Network/SDN/Zones/EvpnPlugin.pm
@@ -113,6 +113,7 @@ sub options {
     return {
         nodes => { optional => 1 },
         'vrf-vxlan' => { optional => 0 },
+        route => { optional => 1 },
         controller => { optional => 0 },
         'secondary-controllers' => { optional => 1 },
         exitnodes => { optional => 1 },
diff --git a/src/test/run_test_static_routes.pl b/src/test/run_test_static_routes.pl
index c6809fe4dc9c..8f3acc25d21f 100644
--- a/src/test/run_test_static_routes.pl
+++ b/src/test/run_test_static_routes.pl
@@ -85,7 +85,7 @@ subtest 'route API schema and Rust validation' => sub {
             1,
         );
     };
-    like($@, qr/unexpected property 'route'/, 'routes are only supported on simple zones');
+    like($@, qr/unexpected property 'route'/, 'routes are only supported on simple and evpn zones');
 };
 
 subtest 'repeatable config persistence' => sub {
@@ -96,6 +96,39 @@ subtest 'repeatable config persistence' => sub {
     is_deeply($parsed->{ids}, $zones->{ids}, 'routes and node restrictions survive round trip');
 };
 
+subtest 'EVPN routes reuse validation and persistence' => sub {
+    my $evpn = {
+        type => 'evpn',
+        controller => 'evpnctl',
+        'vrf-vxlan' => 1000,
+        nodes => { localhost => 1 },
+        route => $routes,
+    };
+    my $plugin = PVE::Network::SDN::Zones::Plugin->lookup('evpn');
+    for my $create (0, 1) {
+        my $params = dclone($evpn);
+        $params->{nodes} = 'localhost';
+        my $opts = $plugin->check_config('overlay', $params, $create, 1);
+        is_deeply($opts->{route}, $routes, 'EVPN accepts the shared route property');
+    }
+
+    my $errors = {};
+    PVE::JSONSchema::check_prop(
+        ['prefix=::/0,via=fe80::1'],
+        $plugin->get_property_schema('evpn', 'route'),
+        'route',
+        $errors,
+    );
+    ok(scalar(keys %$errors), 'EVPN uses the same Rust-backed validation');
+
+    my $config = dclone($zones);
+    $config->{ids}->{overlay} = $evpn;
+    my $raw = PVE::Network::SDN::Zones::Plugin->write_config('zones.cfg', $config);
+    my $parsed = PVE::Network::SDN::Zones::Plugin->parse_config('zones.cfg', $raw);
+    ok(!$parsed->{errors}, 'Simple and EVPN routes parse together');
+    is_deeply($parsed->{ids}, $config->{ids}, 'both zone types preserve repeated routes');
+};
+
 subtest 'pending arrays compare by value' => sub {
     my $running = { zones => dclone($zones) };
     my $configured = dclone($zones);
@@ -134,9 +167,15 @@ $frr->mock(
 );
 
 subtest 'route-only FRR detection' => sub {
-    ok(PVE::Network::SDN::running_config_has_frr(), 'routes without controllers require FRR');
-    local $running->{zones} = { ids => { empty => { type => 'simple', route => [] } } };
-    ok(!PVE::Network::SDN::running_config_has_frr(), 'empty route array does not require FRR');
+    for my $type ('simple', 'evpn') {
+        local $running->{zones} = { ids => { zone1 => { type => $type, route => $routes } } };
+        ok(PVE::Network::SDN::running_config_has_frr(), "$type routes require FRR");
+        $running->{zones}->{ids}->{zone1}->{route} = [];
+        ok(
+            !PVE::Network::SDN::running_config_has_frr(),
+            "empty $type routes do not require FRR",
+        );
+    }
 };
 
 subtest 'zone routes reach FRR with local config' => sub {
diff --git a/src/test/zones/evpn/advertise_subnets/expected_controller_config b/src/test/zones/evpn/advertise_subnets/expected_controller_config
index 8ab18ef648fc..fd1ee333ba78 100644
--- a/src/test/zones/evpn/advertise_subnets/expected_controller_config
+++ b/src/test/zones/evpn/advertise_subnets/expected_controller_config
@@ -53,5 +53,11 @@ exit
 route-map MAP_VTEP_OUT permit 1
 exit
 !
+ip route 0.0.0.0/0 10.0.0.2 vrf vrf_myzone
+!
+ip route 198.51.100.0/24 192.0.2.1 nexthop-vrf default vrf vrf_myzone
+!
+ipv6 route ::/0 fe80::2 myvnet vrf vrf_myzone
+!
 line vty
 !
diff --git a/src/test/zones/evpn/advertise_subnets/sdn_config b/src/test/zones/evpn/advertise_subnets/sdn_config
index 76f16a16af6a..aedcf40524a0 100644
--- a/src/test/zones/evpn/advertise_subnets/sdn_config
+++ b/src/test/zones/evpn/advertise_subnets/sdn_config
@@ -7,7 +7,13 @@
              },
 
   zones   => {
-               ids => { myzone => { ipam => "pve", type => "evpn", controller => "evpnctl", 'vrf-vxlan' => 1000, 'mac' => 'A2:1D:CB:1A:C0:8B', 'advertise-subnets' => 1 } },
+               ids => { myzone => { ipam => "pve", type => "evpn", controller => "evpnctl", 'vrf-vxlan' => 1000, 'mac' => 'A2:1D:CB:1A:C0:8B', 'advertise-subnets' => 1,
+                   route => [
+                       'prefix=0.0.0.0/0,via=10.0.0.2',
+                       'prefix=198.51.100.0/24,via=192.0.2.1,nexthop-vrf=default',
+                       'prefix=::/0,via=fe80::2,iface=myvnet',
+                   ],
+               } },
              },
   controllers  => {
                ids => { evpnctl => { type => "evpn", 'peers' => '192.168.0.1,192.168.0.2,192.168.0.3', asn => "65000" } },
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 65+ messages in thread

* [PATCH pve-network v3 23/32] sdn: zones: SNAT via dedicated uplinks in zone VRFs
  2026-11-16 16:11 [PATCH common/manager/network/proxmox{-ve-rs,-perl-rs,-widget-toolkit} v3 00/32] SDN VRF support Gabriel Goller
                   ` (21 preceding siblings ...)
  2026-11-16 16:11 ` [PATCH pve-network v3 22/32] sdn: evpn: allow static routes Gabriel Goller
@ 2026-11-16 16:11 ` Gabriel Goller
  2026-11-18 18:07   ` Stefan Hanreich
  2026-11-16 16:11 ` [PATCH pve-network v3 24/32] sdn: dhcp: only configure DHCP for zones on the local node Gabriel Goller
                   ` (10 subsequent siblings)
  33 siblings, 1 reply; 65+ messages in thread
From: Gabriel Goller @ 2026-11-16 16:11 UTC (permalink / raw)
  To: pve-devel

SNAT for subnets in a zone VRF resolved the outgoing interface and source
address in the default routing table, so the generated rule never matched
traffic leaving through the VRF. Allow moving a dedicated uplink into the
VRF instead, which keeps the zone isolated from the default routing table.

The uplink is derived from the zone's default route, or else from the
gateway of a host interface in the VRF, since the config is generated before
ifreload creates the VRF and moves the interface into it. Only without
either, e.g. for a DHCP uplink, the VRF routing table is queried. MASQUERADE is used if the
uplink has no static address. Simple zones with a VRF never fall back to
the default routing table, EVPN exit nodes without a dedicated uplink keep
the current behavior.

As subnets can overlap between zones, connections from the vnets of such
zones are put into a conntrack zone per VRF in the original direction.
Replies are found via their NATed reply tuple in the default zone, so the
uplink needs no rule. The conntrack zone ID is hashed from the VRF name to
stay stable across reloads.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
 src/PVE/Network/SDN/Zones.pm                  |   3 +-
 src/PVE/Network/SDN/Zones/EvpnPlugin.pm       |  51 +++---
 src/PVE/Network/SDN/Zones/Plugin.pm           | 157 +++++++++++++++++-
 src/PVE/Network/SDN/Zones/SimplePlugin.pm     |  46 +++--
 src/test/run_test_zones.pl                    |   4 +-
 .../expected_controller_config                |  79 +++++++++
 .../expected_sdn_interfaces                   |  73 ++++++++
 .../evpn/exitnode_snat_vrf_uplink/interfaces  |  16 ++
 .../evpn/exitnode_snat_vrf_uplink/sdn_config  |  42 +++++
 .../vrf_snat_uplink/expected_sdn_interfaces   |  92 ++++++++++
 .../zones/simple/vrf_snat_uplink/interfaces   |  26 +++
 .../zones/simple/vrf_snat_uplink/sdn_config   |  84 ++++++++++
 12 files changed, 632 insertions(+), 41 deletions(-)
 create mode 100644 src/test/zones/evpn/exitnode_snat_vrf_uplink/expected_controller_config
 create mode 100644 src/test/zones/evpn/exitnode_snat_vrf_uplink/expected_sdn_interfaces
 create mode 100644 src/test/zones/evpn/exitnode_snat_vrf_uplink/interfaces
 create mode 100644 src/test/zones/evpn/exitnode_snat_vrf_uplink/sdn_config
 create mode 100644 src/test/zones/simple/vrf_snat_uplink/expected_sdn_interfaces
 create mode 100644 src/test/zones/simple/vrf_snat_uplink/interfaces
 create mode 100644 src/test/zones/simple/vrf_snat_uplink/sdn_config

diff --git a/src/PVE/Network/SDN/Zones.pm b/src/PVE/Network/SDN/Zones.pm
index 1d3ad22c1cd5..0f64f39f6ac6 100644
--- a/src/PVE/Network/SDN/Zones.pm
+++ b/src/PVE/Network/SDN/Zones.pm
@@ -133,6 +133,7 @@ sub generate_etc_network_config {
     #generate configuration
     my $config = {};
     my $nodename = PVE::INotify::nodename();
+    my $vrf_ct_zones = PVE::Network::SDN::Zones::Plugin::get_vrf_ct_zones($zone_ids);
 
     for my $zone_id (sort keys %$zone_ids) {
         my $plugin_config = $zone_ids->{$zone_id};
@@ -168,7 +169,7 @@ sub generate_etc_network_config {
         my $plugin = PVE::Network::SDN::Zones::Plugin->lookup($plugin_config->{type});
         eval {
             $plugin->generate_sdn_config(
-                $plugin_config,
+                { %$plugin_config, 'vrf-ct-zone' => $vrf_ct_zones->{$zone} },
                 $zone,
                 $id,
                 $vnet,
diff --git a/src/PVE/Network/SDN/Zones/EvpnPlugin.pm b/src/PVE/Network/SDN/Zones/EvpnPlugin.pm
index 1933ce86f997..b4b4ab450384 100644
--- a/src/PVE/Network/SDN/Zones/EvpnPlugin.pm
+++ b/src/PVE/Network/SDN/Zones/EvpnPlugin.pm
@@ -268,6 +268,7 @@ sub generate_sdn_config {
     my $ipv6 = undef;
     my $enable_forward_v4 = undef;
     my $enable_forward_v6 = undef;
+    my $ct_zones = {};
     my $subnets = PVE::Network::SDN::Vnets::get_subnets($vnetid, 1);
     foreach my $subnetid (sort keys %{$subnets}) {
         my $subnet = $subnets->{$subnetid};
@@ -280,50 +281,62 @@ sub generate_sdn_config {
             $address->{$gateway} = 1;
         }
 
-        my $iptables = undef;
         my $checkrouteip = undef;
         my $ipversion = Net::IP::ip_is_ipv6($gateway) ? 6 : 4;
 
         if ($ipversion == 6) {
             $ipv6 = 1;
-            $iptables = "ip6tables";
             $checkrouteip = '2001:4860:4860::8888';
             $enable_forward_v6 = 1 if $gateway;
         } else {
             $ipv4 = 1;
-            $iptables = "iptables";
             $checkrouteip = '8.8.8.8';
             $enable_forward_v4 = 1 if $gateway;
         }
 
-        if ($subnet->{snat}) {
+        if ($subnet->{snat} && $is_evpn_gateway) {
 
             #find outgoing interface
-            my ($outip, $outiface);
+            my ($outip, $outiface, $ct_zone);
             eval {
-                ($outip, $outiface) =
-                    PVE::Network::SDN::Zones::Plugin::get_local_route_ip($checkrouteip);
+                ($outip, $outiface) = PVE::Network::SDN::Zones::Plugin::find_dedicated_uplink(
+                    $zoneid, $plugin_config, $ipversion, $interfaces_config,
+                );
+                if ($outiface) {
+                    $ct_zone = $plugin_config->{'vrf-ct-zone'};
+                } else {
+                    # the VRF of exit nodes falls through to the default routing table
+                    ($outip, $outiface) =
+                        PVE::Network::SDN::Zones::Plugin::get_local_route_ip($checkrouteip);
+                    $outiface = undef if !$outip;
+                }
             };
             if ($@) {
                 my $msg = "interface for SNAT could not be resolved: $@";
                 log_warn($msg);
                 next;
             }
-            if ($outip && $outiface && $is_evpn_gateway) {
-                #use snat, faster than masquerade
-                push @iface_config,
-                    "post-up $iptables -t nat -A POSTROUTING -s '$cidr' -o $outiface -j SNAT --to-source $outip";
-                push @iface_config,
-                    "post-down $iptables -t nat -D POSTROUTING -s '$cidr' -o $outiface -j SNAT --to-source $outip";
-                #add conntrack zone once on outgoing interface
-                push @iface_config,
-                    "post-up $iptables -t raw -I PREROUTING -i fwbr+ -j CT --zone 1";
-                push @iface_config,
-                    "post-down $iptables -t raw -D PREROUTING -i fwbr+ -j CT --zone 1";
-            }
+            next if !$outiface;
+
+            $ct_zones->{$ipversion} = $ct_zone if defined($ct_zone);
+            push @iface_config,
+                PVE::Network::SDN::Zones::Plugin::generate_snat_config(
+                    $ipversion, $cidr, $outip, $outiface,
+                );
         }
     }
 
+    # also for traffic routed from other nodes via the L3VNI
+    for my $ipversion (sort keys %$ct_zones) {
+        push @iface_config,
+            PVE::Network::SDN::Zones::Plugin::generate_vrf_ct_zone_config(
+                $ipversion,
+                $ct_zones->{$ipversion},
+                $vnetid,
+                "vrfbr_$zoneid",
+            );
+    }
+
     push @iface_config, "hwaddress $mac" if $mac;
     push @iface_config, "bridge_ports $vxlan_iface";
     push @iface_config, "bridge_stp off";
diff --git a/src/PVE/Network/SDN/Zones/Plugin.pm b/src/PVE/Network/SDN/Zones/Plugin.pm
index a3863bc9818c..5c4dafd01c9f 100644
--- a/src/PVE/Network/SDN/Zones/Plugin.pm
+++ b/src/PVE/Network/SDN/Zones/Plugin.pm
@@ -4,6 +4,7 @@ use strict;
 use warnings;
 
 use PVE::Tools qw(run_command);
+use Digest::SHA;
 use Net::IP qw(ip_get_version);
 use PVE::JSONSchema;
 use PVE::Cluster;
@@ -378,13 +379,15 @@ sub get_iface_addresses {
 }
 
 sub get_local_route_ip {
-    my ($targetip) = @_;
+    my ($targetip, $vrf) = @_;
 
     my $ip = undef;
     my $interface = undef;
 
     run_command(
-        ['/sbin/ip', 'route', 'get', $targetip],
+        ['/sbin/ip', 'route', 'get', $targetip, defined($vrf) ? ('vrf', $vrf) : ()],
+        # a missing VRF or route is expected on the first apply, and handled by the caller
+        defined($vrf) ? (errfunc => sub { }) : (),
         outfunc => sub {
             if ($_[0] =~ m/src ($PVE::Tools::IPRE)/) {
                 $ip = $1;
@@ -398,6 +401,156 @@ sub get_local_route_ip {
     return ($ip, $interface);
 }
 
+# Assign each zone with a VRF a conntrack zone, so that identical connections
+# from overlapping subnets in different VRFs do not clash.
+#
+# The ID is derived from the VRF name, so it only changes if a zone with a
+# colliding hash is added. Zones 0 (default) and 1 (fwbr+ bridges) are reserved.
+sub get_vrf_ct_zones {
+    my ($zones) = @_;
+
+    my $ct_zones = {};
+    my $used = {};
+
+    for my $zone_id (sort keys %$zones) {
+        my $zone = $zones->{$zone_id};
+        next if $zone->{type} ne 'evpn' && !($zone->{type} eq 'simple' && $zone->{'dedicated-vrf'});
+
+        my $ct_zone = 2 + unpack('n', Digest::SHA::sha256("vrf_$zone_id")) % 65534;
+        $ct_zone = $ct_zone == 65535 ? 2 : $ct_zone + 1 while $used->{$ct_zone};
+
+        $used->{$ct_zone} = 1;
+        $ct_zones->{$zone_id} = $ct_zone;
+    }
+
+    return $ct_zones;
+}
+
+# Return the zone's default route of the given IP version with the lowest
+# administrative distance.
+sub find_zone_default_route {
+    my ($plugin_config, $ipversion) = @_;
+
+    my @routes;
+    for my $route_str (@{ $plugin_config->{route} // [] }) {
+        my $route = PVE::JSONSchema::parse_property_string('pve-sdn-static-route', $route_str);
+        my ($ip, $mask) = split(/\//, $route->{prefix}, 2);
+        next if !defined($mask) || $mask != 0 || (ip_get_version($ip) // 0) != $ipversion;
+        push @routes, $route;
+    }
+
+    my ($route) = sort { ($a->{distance} // 1) <=> ($b->{distance} // 1) } @routes;
+    return $route;
+}
+
+# Resolve the dedicated SNAT uplink of a zone, i.e. the host interface in the
+# zone VRF that the default route of the given IP version points to.
+#
+# The uplink is resolved from the configuration if possible, since neither the
+# VRF nor its routes exist on the first apply. A default route of the zone takes
+# precedence over an interface in the VRF with a gateway. Without either, e.g.
+# if the uplink gets its gateway via DHCP, the VRF routing table is queried.
+#
+# Returns ($ip, $iface), with $ip undef if the uplink has no static address, or
+# nothing if the zone has no dedicated uplink. Dies if the default route has its
+# next hop in the zone VRF, but not via an interface in it.
+sub find_dedicated_uplink {
+    my ($zone_id, $plugin_config, $ipversion, $interfaces_config) = @_;
+
+    my $vrf = "vrf_$zone_id";
+    my $ifaces = $interfaces_config->{ifaces} // {};
+    my ($address_key, $method_key, $cidr_key, $gateway_key) =
+        $ipversion == 6
+        ? ('address6', 'method6', 'cidr6', 'gateway6')
+        : ('address', 'method', 'cidr', 'gateway');
+
+    my $is_member = sub {
+        my ($iface) = @_;
+        return defined($iface) && ($ifaces->{$iface}->{vrf} // '') eq $vrf;
+    };
+
+    my $iface;
+    if (my $route = find_zone_default_route($plugin_config, $ipversion)) {
+        return if ($route->{'nexthop-vrf'} // $vrf) ne $vrf;
+
+        $iface = $route->{iface};
+        if (!defined($iface) && defined(my $via = $route->{via})) {
+            ($iface) = grep {
+                $is_member->($_)
+                    && $ifaces->{$_}->{$cidr_key}
+                    && PVE::Network::is_ip_in_cidr($via, $ifaces->{$_}->{$cidr_key}, $ipversion)
+            } sort keys %$ifaces;
+        }
+
+        die "default route of zone '$zone_id' is not via an interface in $vrf\n"
+            if !$is_member->($iface);
+    } elsif (
+        my @gw_ifaces =
+        grep { $is_member->($_) && $ifaces->{$_}->{$gateway_key} } sort keys %$ifaces
+    ) {
+        # ifupdown2 installs the gateway into the VRF routing table
+        $iface = $gw_ifaces[0];
+    } else {
+        my $targetip = $ipversion == 6 ? '2001:4860:4860::8888' : '8.8.8.8';
+        # fails if the VRF or its default route do not exist yet
+        (undef, $iface) = eval { get_local_route_ip($targetip, $vrf) };
+        return if !$is_member->($iface);
+    }
+
+    my $ip;
+    if (($ifaces->{$iface}->{$method_key} // '') eq 'static') {
+        $ip = $ifaces->{$iface}->{$address_key};
+        $ip = $ip->[0] if ref($ip) eq 'ARRAY';
+    }
+
+    return ($ip, $iface);
+}
+
+my sub generate_iptables_rules {
+    my ($ipversion, @rules) = @_;
+
+    my $iptables = $ipversion == 6 ? 'ip6tables' : 'iptables';
+
+    my @iface_config;
+    for my $rule (@rules) {
+        my ($table, $action, $spec) = @$rule;
+        push @iface_config, "post-up $iptables -t $table $action $spec";
+        push @iface_config, "post-down $iptables -t $table -D $spec";
+    }
+
+    return @iface_config;
+}
+
+# Generate the ifupdown2 commands to SNAT $cidr out of $outiface, using
+# MASQUERADE if the source address is not known.
+sub generate_snat_config {
+    my ($ipversion, $cidr, $outip, $outiface) = @_;
+
+    my $target = defined($outip) ? "SNAT --to-source $outip" : 'MASQUERADE';
+
+    return generate_iptables_rules(
+        $ipversion,
+        #use snat, faster than masquerade
+        ['nat', '-A', "POSTROUTING -s '$cidr' -o $outiface -j $target"],
+        #add conntrack zone once on outgoing interface
+        ['raw', '-I', 'PREROUTING -i fwbr+ -j CT --zone 1'],
+    );
+}
+
+# Put connections received on @ifaces into conntrack zone $ct_zone in the
+# original direction, so identical connections from overlapping subnets in
+# other VRFs do not clash before being NATed. Replies are looked up by their
+# reply tuple in the default zone, which NAT keeps unique, so neither the
+# uplink nor local replies need a rule.
+sub generate_vrf_ct_zone_config {
+    my ($ipversion, $ct_zone, @ifaces) = @_;
+
+    return generate_iptables_rules(
+        $ipversion,
+        map { ['raw', '-I', "PREROUTING -i $_ -j CT --zone-orig $ct_zone"] } @ifaces,
+    );
+}
+
 sub find_local_ip_interface_peers {
     my ($peers, $iface) = @_;
 
diff --git a/src/PVE/Network/SDN/Zones/SimplePlugin.pm b/src/PVE/Network/SDN/Zones/SimplePlugin.pm
index 1d44f0b078f5..c8718629ac28 100644
--- a/src/PVE/Network/SDN/Zones/SimplePlugin.pm
+++ b/src/PVE/Network/SDN/Zones/SimplePlugin.pm
@@ -106,6 +106,7 @@ sub generate_sdn_config {
     my $ipv6 = undef;
     my $enable_forward_v4 = undef;
     my $enable_forward_v6 = undef;
+    my $ct_zones = {};
 
     foreach my $subnetid (sort keys %{$subnets}) {
         my $subnet = $subnets->{$subnetid};
@@ -118,18 +119,15 @@ sub generate_sdn_config {
             $address->{$gateway} = 1;
         }
 
-        my $iptables = undef;
         my $checkrouteip = undef;
         my $ipversion = Net::IP::ip_is_ipv6($gateway) ? 6 : 4;
 
         if ($ipversion == 6) {
             $ipv6 = 1;
-            $iptables = "ip6tables";
             $checkrouteip = '2001:4860:4860::8888';
             $enable_forward_v6 = 1 if $gateway;
         } else {
             $ipv4 = 1;
-            $iptables = "iptables";
             $checkrouteip = '8.8.8.8';
             $enable_forward_v4 = 1 if $gateway;
         }
@@ -141,31 +139,43 @@ sub generate_sdn_config {
         }
         if ($subnet->{snat}) {
             #find outgoing interface
-            my ($outip, $outiface);
+            my ($outip, $outiface, $ct_zone);
             eval {
-                ($outip, $outiface) =
-                    PVE::Network::SDN::Zones::Plugin::get_local_route_ip($checkrouteip);
+                if ($plugin_config->{'dedicated-vrf'}) {
+                    ($outip, $outiface) =
+                        PVE::Network::SDN::Zones::Plugin::find_dedicated_uplink(
+                            $zone_id, $plugin_config, $ipversion, $interfaces_config,
+                        );
+                    die "no uplink interface in vrf_$zone_id\n" if !$outiface;
+                    $ct_zone = $plugin_config->{'vrf-ct-zone'};
+                } else {
+                    ($outip, $outiface) =
+                        PVE::Network::SDN::Zones::Plugin::get_local_route_ip($checkrouteip);
+                    $outiface = undef if !$outip;
+                }
             };
             if ($@) {
                 my $msg = "interface for SNAT could not be resolved: $@";
                 log_warn($msg);
                 next;
             }
-            if ($outip && $outiface) {
-                #use snat, faster than masquerade
-                push @iface_config,
-                    "post-up $iptables -t nat -A POSTROUTING -s '$cidr' -o $outiface -j SNAT --to-source $outip";
-                push @iface_config,
-                    "post-down $iptables -t nat -D POSTROUTING -s '$cidr' -o $outiface -j SNAT --to-source $outip";
-                #add conntrack zone once on outgoing interface
-                push @iface_config,
-                    "post-up $iptables -t raw -I PREROUTING -i fwbr+ -j CT --zone 1";
-                push @iface_config,
-                    "post-down $iptables -t raw -D PREROUTING -i fwbr+ -j CT --zone 1";
-            }
+            next if !$outiface;
+
+            $ct_zones->{$ipversion} = $ct_zone if defined($ct_zone);
+            push @iface_config,
+                PVE::Network::SDN::Zones::Plugin::generate_snat_config(
+                    $ipversion, $cidr, $outip, $outiface,
+                );
         }
     }
 
+    for my $ipversion (sort keys %$ct_zones) {
+        push @iface_config,
+            PVE::Network::SDN::Zones::Plugin::generate_vrf_ct_zone_config(
+                $ipversion, $ct_zones->{$ipversion}, $vnetid,
+            );
+    }
+
     push @iface_config, "hwaddress $mac" if $mac;
     push @iface_config, "bridge_ports none";
     push @iface_config, "bridge_stp off";
diff --git a/src/test/run_test_zones.pl b/src/test/run_test_zones.pl
index f8ef7375cdc0..afb0ed5d8a00 100755
--- a/src/test/run_test_zones.pl
+++ b/src/test/run_test_zones.pl
@@ -93,7 +93,9 @@ foreach my $test (@tests) {
     $pve_sdn_zones_plugin = Test::MockModule->new('PVE::Network::SDN::Zones::Plugin');
     $pve_sdn_zones_plugin->mock(
         get_local_route_ip => sub {
-            my ($targetip) = @_;
+            my ($targetip, $vrf) = @_;
+            # VRFs do not exist yet on the first apply
+            die "Cannot find device \"$vrf\"\n" if defined($vrf);
             my $outiface = "vmbr0";
             my $outip = $interfaces_config->{ifaces}->{$outiface}->{address};
             if (Net::IP::ip_is_ipv6($targetip)) {
diff --git a/src/test/zones/evpn/exitnode_snat_vrf_uplink/expected_controller_config b/src/test/zones/evpn/exitnode_snat_vrf_uplink/expected_controller_config
new file mode 100644
index 000000000000..0a19fc711bf6
--- /dev/null
+++ b/src/test/zones/evpn/exitnode_snat_vrf_uplink/expected_controller_config
@@ -0,0 +1,79 @@
+frr version 10.6.1
+frr defaults datacenter
+hostname localhost
+log syslog informational
+service integrated-vtysh-config
+!
+vrf vrf_myzone
+ vni 1000
+exit-vrf
+!
+router bgp 65000
+ bgp router-id 192.168.0.1
+ no bgp hard-administrative-reset
+ no bgp default ipv4-unicast
+ coalesce-time 1000
+ no bgp graceful-restart notification
+ neighbor VTEP peer-group
+ neighbor VTEP remote-as 65000
+ neighbor VTEP bfd
+ neighbor 192.168.0.2 peer-group VTEP
+ neighbor 192.168.0.3 peer-group VTEP
+ !
+ address-family ipv4 unicast
+  import vrf vrf_myzone
+ exit-address-family
+ !
+ address-family ipv6 unicast
+  import vrf vrf_myzone
+ exit-address-family
+ !
+ address-family l2vpn evpn
+  neighbor VTEP activate
+  neighbor VTEP route-map MAP_VTEP_IN in
+  neighbor VTEP route-map MAP_VTEP_OUT out
+  advertise-all-vni
+ exit-address-family
+exit
+!
+router bgp 65000 vrf vrf_myzone
+ bgp router-id 192.168.0.1
+ no bgp hard-administrative-reset
+ no bgp graceful-restart notification
+ !
+ address-family ipv4 unicast
+  redistribute connected
+ exit-address-family
+ !
+ address-family ipv6 unicast
+  redistribute connected
+ exit-address-family
+ !
+ address-family l2vpn evpn
+  default-originate ipv4
+  default-originate ipv6
+ exit-address-family
+exit
+!
+ip prefix-list only_default seq 1 permit 0.0.0.0/0
+!
+ipv6 prefix-list only_default_v6 seq 1 permit ::/0
+!
+route-map MAP_VTEP_IN deny 1
+ match ip address prefix-list only_default
+exit
+!
+route-map MAP_VTEP_IN deny 2
+ match ipv6 address prefix-list only_default_v6
+exit
+!
+route-map MAP_VTEP_IN permit 3
+exit
+!
+route-map MAP_VTEP_OUT permit 1
+exit
+!
+ip route 0.0.0.0/0 203.0.113.1 vrf vrf_myzone
+!
+line vty
+!
diff --git a/src/test/zones/evpn/exitnode_snat_vrf_uplink/expected_sdn_interfaces b/src/test/zones/evpn/exitnode_snat_vrf_uplink/expected_sdn_interfaces
new file mode 100644
index 000000000000..1848a62e657e
--- /dev/null
+++ b/src/test/zones/evpn/exitnode_snat_vrf_uplink/expected_sdn_interfaces
@@ -0,0 +1,73 @@
+#version:1
+
+auto myvnet
+iface myvnet
+	address 10.0.0.1/24
+	post-up iptables -t nat -A POSTROUTING -s '10.0.0.0/24' -o eth1 -j SNAT --to-source 203.0.113.10
+	post-down iptables -t nat -D POSTROUTING -s '10.0.0.0/24' -o eth1 -j SNAT --to-source 203.0.113.10
+	post-up iptables -t raw -I PREROUTING -i fwbr+ -j CT --zone 1
+	post-down iptables -t raw -D PREROUTING -i fwbr+ -j CT --zone 1
+	post-up iptables -t raw -I PREROUTING -i myvnet -j CT --zone-orig 7767
+	post-down iptables -t raw -D PREROUTING -i myvnet -j CT --zone-orig 7767
+	post-up iptables -t raw -I PREROUTING -i vrfbr_myzone -j CT --zone-orig 7767
+	post-down iptables -t raw -D PREROUTING -i vrfbr_myzone -j CT --zone-orig 7767
+	bridge_ports vxlan_myvnet
+	bridge_stp off
+	bridge_fd 0
+	mtu 1450
+	ip-forward on
+	arp-accept on
+	vrf vrf_myzone
+
+auto myvnet2
+iface myvnet2
+	address 2a08:2142:302:3::1/64
+	post-up ip6tables -t nat -A POSTROUTING -s '2a08:2142:302:3::/64' -o vmbr0 -j SNAT --to-source 2001:db8::2
+	post-down ip6tables -t nat -D POSTROUTING -s '2a08:2142:302:3::/64' -o vmbr0 -j SNAT --to-source 2001:db8::2
+	post-up ip6tables -t raw -I PREROUTING -i fwbr+ -j CT --zone 1
+	post-down ip6tables -t raw -D PREROUTING -i fwbr+ -j CT --zone 1
+	bridge_ports vxlan_myvnet2
+	bridge_stp off
+	bridge_fd 0
+	mtu 1450
+	ip6-forward on
+	arp-accept on
+	vrf vrf_myzone
+
+auto vrf_myzone
+iface vrf_myzone
+	vrf-table auto
+	post-up ip route del vrf vrf_myzone unreachable default metric 4278198272
+	post-up ip -6 route del vrf vrf_myzone unreachable default metric 4278198272
+
+auto vrfbr_myzone
+iface vrfbr_myzone
+	bridge-ports vrfvx_myzone
+	bridge_stp off
+	bridge_fd 0
+	mtu 1450
+	vrf vrf_myzone
+
+auto vrfvx_myzone
+iface vrfvx_myzone
+	vxlan-id 1000
+	vxlan-local-tunnelip 192.168.0.1
+	bridge-learning off
+	bridge-arp-nd-suppress on
+	mtu 1450
+
+auto vxlan_myvnet
+iface vxlan_myvnet
+	vxlan-id 100
+	vxlan-local-tunnelip 192.168.0.1
+	bridge-learning off
+	bridge-arp-nd-suppress on
+	mtu 1450
+
+auto vxlan_myvnet2
+iface vxlan_myvnet2
+	vxlan-id 200
+	vxlan-local-tunnelip 192.168.0.1
+	bridge-learning off
+	bridge-arp-nd-suppress on
+	mtu 1450
diff --git a/src/test/zones/evpn/exitnode_snat_vrf_uplink/interfaces b/src/test/zones/evpn/exitnode_snat_vrf_uplink/interfaces
new file mode 100644
index 000000000000..f51116efdde5
--- /dev/null
+++ b/src/test/zones/evpn/exitnode_snat_vrf_uplink/interfaces
@@ -0,0 +1,16 @@
+auto vmbr0
+iface vmbr0 inet static
+	address 192.168.0.1/24
+	gateway 192.168.0.254
+        bridge-ports eth0
+        bridge-stp off
+        bridge-fd 0
+
+iface vmbr0 inet6 static
+        address 2001:db8::2/64
+        gateway 2001:db8::1
+
+auto eth1
+iface eth1 inet static
+	address 203.0.113.10/24
+	vrf vrf_myzone
diff --git a/src/test/zones/evpn/exitnode_snat_vrf_uplink/sdn_config b/src/test/zones/evpn/exitnode_snat_vrf_uplink/sdn_config
new file mode 100644
index 000000000000..ac0db7778083
--- /dev/null
+++ b/src/test/zones/evpn/exitnode_snat_vrf_uplink/sdn_config
@@ -0,0 +1,42 @@
+{
+  version => 1,
+  vnets   => {
+               ids => {
+                        myvnet => { tag => "100", type => "vnet", zone => "myzone" },
+                        myvnet2 => { tag => "200", type => "vnet", zone => "myzone" },
+                      },
+             },
+
+  zones   => {
+               ids => {
+                        myzone => {
+                                    ipam => "pve",
+                                    type => "evpn",
+                                    controller => "evpnctl",
+                                    'vrf-vxlan' => 1000,
+                                    exitnodes => { 'localhost' => 1 },
+                                    route => [ 'prefix=0.0.0.0/0,via=203.0.113.1' ],
+                                  },
+                      },
+             },
+  controllers  => {
+               ids => { evpnctl => { type => "evpn", 'peers' => '192.168.0.1,192.168.0.2,192.168.0.3', asn => "65000" } },
+             },
+
+  subnets => {
+              ids => {
+                        'myzone-10.0.0.0-24' => {
+                                                  'type' => 'subnet',
+                                                  'vnet' => 'myvnet',
+                                                  'gateway' => '10.0.0.1',
+                                                  'snat' => 1
+                                                },
+                        'myzone-2a08:2142:302:3::-64' => {
+                                                  'type' => 'subnet',
+                                                  'vnet' => 'myvnet2',
+                                                  'gateway' => '2a08:2142:302:3::1',
+                                                  'snat' => 1
+                                                },
+                      }
+             }
+}
diff --git a/src/test/zones/simple/vrf_snat_uplink/expected_sdn_interfaces b/src/test/zones/simple/vrf_snat_uplink/expected_sdn_interfaces
new file mode 100644
index 000000000000..f639eb132a64
--- /dev/null
+++ b/src/test/zones/simple/vrf_snat_uplink/expected_sdn_interfaces
@@ -0,0 +1,92 @@
+#version:1
+
+auto vneta
+iface vneta
+	address 10.0.0.1/24
+	post-up iptables -t nat -A POSTROUTING -s '10.0.0.0/24' -o eth1 -j SNAT --to-source 203.0.113.10
+	post-down iptables -t nat -D POSTROUTING -s '10.0.0.0/24' -o eth1 -j SNAT --to-source 203.0.113.10
+	post-up iptables -t raw -I PREROUTING -i fwbr+ -j CT --zone 1
+	post-down iptables -t raw -D PREROUTING -i fwbr+ -j CT --zone 1
+	address 10.1.0.1/24
+	post-up iptables -t nat -A POSTROUTING -s '10.1.0.0/24' -o eth1 -j SNAT --to-source 203.0.113.10
+	post-down iptables -t nat -D POSTROUTING -s '10.1.0.0/24' -o eth1 -j SNAT --to-source 203.0.113.10
+	post-up iptables -t raw -I PREROUTING -i fwbr+ -j CT --zone 1
+	post-down iptables -t raw -D PREROUTING -i fwbr+ -j CT --zone 1
+	address 2001:db8:a::1/64
+	post-up ip6tables -t nat -A POSTROUTING -s '2001:db8:a::/64' -o eth1 -j MASQUERADE
+	post-down ip6tables -t nat -D POSTROUTING -s '2001:db8:a::/64' -o eth1 -j MASQUERADE
+	post-up ip6tables -t raw -I PREROUTING -i fwbr+ -j CT --zone 1
+	post-down ip6tables -t raw -D PREROUTING -i fwbr+ -j CT --zone 1
+	post-up iptables -t raw -I PREROUTING -i vneta -j CT --zone-orig 64008
+	post-down iptables -t raw -D PREROUTING -i vneta -j CT --zone-orig 64008
+	post-up ip6tables -t raw -I PREROUTING -i vneta -j CT --zone-orig 64008
+	post-down ip6tables -t raw -D PREROUTING -i vneta -j CT --zone-orig 64008
+	bridge_ports none
+	bridge_stp off
+	bridge_fd 0
+	ip-forward on
+	ip6-forward on
+	vrf vrf_zonea
+
+auto vnetb
+iface vnetb
+	address 10.0.0.1/24
+	post-up iptables -t nat -A POSTROUTING -s '10.0.0.0/24' -o eth2 -j SNAT --to-source 198.51.100.10
+	post-down iptables -t nat -D POSTROUTING -s '10.0.0.0/24' -o eth2 -j SNAT --to-source 198.51.100.10
+	post-up iptables -t raw -I PREROUTING -i fwbr+ -j CT --zone 1
+	post-down iptables -t raw -D PREROUTING -i fwbr+ -j CT --zone 1
+	post-up iptables -t raw -I PREROUTING -i vnetb -j CT --zone-orig 48540
+	post-down iptables -t raw -D PREROUTING -i vnetb -j CT --zone-orig 48540
+	bridge_ports none
+	bridge_stp off
+	bridge_fd 0
+	ip-forward on
+	vrf vrf_zoneb
+
+auto vnetc
+iface vnetc
+	address 10.0.0.1/24
+	bridge_ports none
+	bridge_stp off
+	bridge_fd 0
+	ip-forward on
+	vrf vrf_zonec
+
+auto vnetd
+iface vnetd
+	address 10.0.0.1/24
+	post-up iptables -t nat -A POSTROUTING -s '10.0.0.0/24' -o eth3 -j SNAT --to-source 10.100.0.4
+	post-down iptables -t nat -D POSTROUTING -s '10.0.0.0/24' -o eth3 -j SNAT --to-source 10.100.0.4
+	post-up iptables -t raw -I PREROUTING -i fwbr+ -j CT --zone 1
+	post-down iptables -t raw -D PREROUTING -i fwbr+ -j CT --zone 1
+	post-up iptables -t raw -I PREROUTING -i vnetd -j CT --zone-orig 27935
+	post-down iptables -t raw -D PREROUTING -i vnetd -j CT --zone-orig 27935
+	bridge_ports none
+	bridge_stp off
+	bridge_fd 0
+	ip-forward on
+	vrf vrf_zoned
+
+auto vrf_zonea
+iface vrf_zonea
+	vrf-table auto
+	post-up ip route add vrf vrf_zonea unreachable default metric 4278198272
+	post-up ip -6 route add vrf vrf_zonea unreachable default metric 4278198272
+
+auto vrf_zoneb
+iface vrf_zoneb
+	vrf-table auto
+	post-up ip route add vrf vrf_zoneb unreachable default metric 4278198272
+	post-up ip -6 route add vrf vrf_zoneb unreachable default metric 4278198272
+
+auto vrf_zonec
+iface vrf_zonec
+	vrf-table auto
+	post-up ip route add vrf vrf_zonec unreachable default metric 4278198272
+	post-up ip -6 route add vrf vrf_zonec unreachable default metric 4278198272
+
+auto vrf_zoned
+iface vrf_zoned
+	vrf-table auto
+	post-up ip route add vrf vrf_zoned unreachable default metric 4278198272
+	post-up ip -6 route add vrf vrf_zoned unreachable default metric 4278198272
diff --git a/src/test/zones/simple/vrf_snat_uplink/interfaces b/src/test/zones/simple/vrf_snat_uplink/interfaces
new file mode 100644
index 000000000000..de646d3f6b43
--- /dev/null
+++ b/src/test/zones/simple/vrf_snat_uplink/interfaces
@@ -0,0 +1,26 @@
+auto vmbr0
+iface vmbr0 inet static
+	address 192.168.0.1/24
+	gateway 192.168.0.254
+        bridge-ports eth0
+        bridge-stp off
+        bridge-fd 0
+
+auto eth1
+iface eth1 inet static
+	address 203.0.113.10/24
+	vrf vrf_zonea
+
+iface eth1 inet6 auto
+	vrf vrf_zonea
+
+auto eth2
+iface eth2 inet static
+	address 198.51.100.10/24
+	vrf vrf_zoneb
+
+auto eth3
+iface eth3 inet static
+	address 10.100.0.4/24
+	gateway 10.100.0.1
+	vrf vrf_zoned
diff --git a/src/test/zones/simple/vrf_snat_uplink/sdn_config b/src/test/zones/simple/vrf_snat_uplink/sdn_config
new file mode 100644
index 000000000000..7cd558dcc671
--- /dev/null
+++ b/src/test/zones/simple/vrf_snat_uplink/sdn_config
@@ -0,0 +1,84 @@
+{
+  version => 1,
+  vnets   => {
+               ids => {
+                        vneta => { type => "vnet", zone => "zonea" },
+                        vnetb => { type => "vnet", zone => "zoneb" },
+                        vnetc => { type => "vnet", zone => "zonec" },
+                        vnetd => { type => "vnet", zone => "zoned" },
+                      },
+             },
+  zones   => {
+               ids => {
+                        zonea => {
+                                   ipam => "pve",
+                                   type => "simple",
+                                   "dedicated-vrf" => 1,
+                                   route => [
+                                     'prefix=0.0.0.0/0,via=203.0.113.1',
+                                     'prefix=::/0,via=fe80::1,iface=eth1',
+                                   ],
+                                 },
+                        zoneb => {
+                                   ipam => "pve",
+                                   type => "simple",
+                                   "dedicated-vrf" => 1,
+                                   route => [
+                                     'prefix=0.0.0.0/0,via=198.51.100.2,distance=10',
+                                     'prefix=0.0.0.0/0,via=198.51.100.1',
+                                   ],
+                                 },
+                        zonec => {
+                                   ipam => "pve",
+                                   type => "simple",
+                                   "dedicated-vrf" => 1,
+                                   route => [ 'prefix=0.0.0.0/0,via=192.168.0.254,nexthop-vrf=default' ],
+                                 },
+                        zoned => {
+                                   ipam => "pve",
+                                   type => "simple",
+                                   "dedicated-vrf" => 1,
+                                 },
+                      },
+             },
+  subnets => {
+               ids => {
+                        'zonea-10.0.0.0-24' => {
+                                                 type => 'subnet',
+                                                 vnet => 'vneta',
+                                                 gateway => '10.0.0.1',
+                                                 snat => 1,
+                                               },
+                        'zonea-10.1.0.0-24' => {
+                                                 type => 'subnet',
+                                                 vnet => 'vneta',
+                                                 gateway => '10.1.0.1',
+                                                 snat => 1,
+                                               },
+                        'zonea-2001:db8:a::-64' => {
+                                                     type => 'subnet',
+                                                     vnet => 'vneta',
+                                                     gateway => '2001:db8:a::1',
+                                                     snat => 1,
+                                                   },
+                        'zoneb-10.0.0.0-24' => {
+                                                 type => 'subnet',
+                                                 vnet => 'vnetb',
+                                                 gateway => '10.0.0.1',
+                                                 snat => 1,
+                                               },
+                        'zonec-10.0.0.0-24' => {
+                                                 type => 'subnet',
+                                                 vnet => 'vnetc',
+                                                 gateway => '10.0.0.1',
+                                                 snat => 1,
+                                               },
+                        'zoned-10.0.0.0-24' => {
+                                                 type => 'subnet',
+                                                 vnet => 'vnetd',
+                                                 gateway => '10.0.0.1',
+                                                 snat => 1,
+                                               },
+                      },
+             },
+}
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 65+ messages in thread

* [PATCH pve-network v3 24/32] sdn: dhcp: only configure DHCP for zones on the local node
  2026-11-16 16:11 [PATCH common/manager/network/proxmox{-ve-rs,-perl-rs,-widget-toolkit} v3 00/32] SDN VRF support Gabriel Goller
                   ` (22 preceding siblings ...)
  2026-11-16 16:11 ` [PATCH pve-network v3 23/32] sdn: zones: SNAT via dedicated uplinks in zone VRFs Gabriel Goller
@ 2026-11-16 16:11 ` Gabriel Goller
  2026-11-16 16:11 ` [PATCH pve-network v3 25/32] sdn: dhcp: run dnsmasq in the zone VRF Gabriel Goller
                   ` (9 subsequent siblings)
  33 siblings, 0 replies; 65+ messages in thread
From: Gabriel Goller @ 2026-11-16 16:11 UTC (permalink / raw)
  To: pve-devel

regenerate_config set up a dnsmasq instance for every zone with DHCP
enabled, even on nodes that are not part of the zone. These instances
did nothing, because the vnet interfaces do not exist on those nodes.

It also meant that every node needed dnsmasq installed as soon as any
zone used DHCP. Otherwise applying the SDN config failed there, even if
none of the node's zones use DHCP.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
 src/PVE/Network/SDN/Dhcp.pm | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/PVE/Network/SDN/Dhcp.pm b/src/PVE/Network/SDN/Dhcp.pm
index f6ce842c8cc2..10d7ee917da5 100644
--- a/src/PVE/Network/SDN/Dhcp.pm
+++ b/src/PVE/Network/SDN/Dhcp.pm
@@ -69,7 +69,16 @@ sub regenerate_config {
 
     my $plugins = PVE::Network::SDN::Dhcp::Plugin->lookup_types();
 
-    my $any_zone_needs_dhcp = grep { $_->{dhcp} } values $zone_cfg->{ids}->%*;
+    my @dhcp_zone_ids;
+    for my $zoneid (sort keys $zone_cfg->{ids}->%*) {
+        my $zone = $zone_cfg->{ids}->{$zoneid};
+        next if !$zone->{dhcp};
+        # the zone's VRF and bridges only exist on its nodes
+        next if defined($zone->{nodes}) && !$zone->{nodes}->{$nodename};
+        push @dhcp_zone_ids, $zoneid;
+    }
+
+    my $any_zone_needs_dhcp = scalar(@dhcp_zone_ids);
 
     foreach my $plugin_name (@$plugins) {
         my $plugin = PVE::Network::SDN::Dhcp::Plugin->lookup($plugin_name);
@@ -77,9 +86,8 @@ sub regenerate_config {
         die "Could not run before_regenerate for DHCP plugin $plugin_name $@\n" if $@;
     }
 
-    foreach my $zoneid (sort keys %{ $zone_cfg->{ids} }) {
+    foreach my $zoneid (@dhcp_zone_ids) {
         my $zone = $zone_cfg->{ids}->{$zoneid};
-        next if !$zone->{dhcp};
 
         my $dhcp_plugin_name = $zone->{dhcp};
         my $dhcp_plugin = PVE::Network::SDN::Dhcp::Plugin->lookup($dhcp_plugin_name);
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 65+ messages in thread

* [PATCH pve-network v3 25/32] sdn: dhcp: run dnsmasq in the zone VRF
  2026-11-16 16:11 [PATCH common/manager/network/proxmox{-ve-rs,-perl-rs,-widget-toolkit} v3 00/32] SDN VRF support Gabriel Goller
                   ` (23 preceding siblings ...)
  2026-11-16 16:11 ` [PATCH pve-network v3 24/32] sdn: dhcp: only configure DHCP for zones on the local node Gabriel Goller
@ 2026-11-16 16:11 ` Gabriel Goller
  2026-11-16 16:11 ` [PATCH proxmox-widget-toolkit v3 26/32] ui: network: allow selecting a VRF for host interfaces Gabriel Goller
                   ` (8 subsequent siblings)
  33 siblings, 0 replies; 65+ messages in thread
From: Gabriel Goller @ 2026-11-16 16:11 UTC (permalink / raw)
  To: pve-devel

DHCP and DNS did not work in Simple zones with a dedicated VRF. If a zone
has more than one vnet with subnets, dnsmasq serves DHCP on a single socket
that is not bound to any interface, and the kernel does not deliver packets
from VRF slaves to such sockets unless net.ipv4.udp_l3mdev_accept is set.
The DNS sockets are bound to the gateway addresses, which fails silently
because the local routes of those addresses are only in the VRF table, so
guests got a resolver that never answered.

Start the dnsmasq instance of such zones through 'ip vrf exec' using a
systemd drop-in, which binds all of its sockets to the zone VRF. This
avoids changing the host-wide sysctl, which would also expose unbound host
services to the zone. Upstream DNS servers have to be reachable from within
the VRF.

The VRF has to exist before dnsmasq starts, so the DHCP config must be
generated after ifreload. pve-manager needs a matching change.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
 src/PVE/Network/SDN/Dhcp/Dnsmasq.pm | 59 ++++++++++++++++++++++++++++-
 1 file changed, 58 insertions(+), 1 deletion(-)

diff --git a/src/PVE/Network/SDN/Dhcp/Dnsmasq.pm b/src/PVE/Network/SDN/Dhcp/Dnsmasq.pm
index 477b700f2429..9bf37307952f 100644
--- a/src/PVE/Network/SDN/Dhcp/Dnsmasq.pm
+++ b/src/PVE/Network/SDN/Dhcp/Dnsmasq.pm
@@ -16,6 +16,10 @@ use PVE::RESTEnvironment qw(log_warn);
 my $DNSMASQ_CONFIG_ROOT = '/etc/dnsmasq.d';
 my $DNSMASQ_DEFAULT_ROOT = '/etc/default';
 my $DNSMASQ_LEASE_ROOT = '/var/lib/misc';
+my $SYSTEMD_UNIT_ROOT = '/etc/systemd/system';
+my $VRF_DROPIN_NAME = '00-pve-sdn-vrf.conf';
+
+my $need_daemon_reload = 0;
 
 sub type {
     return 'dnsmasq';
@@ -193,6 +197,52 @@ sub systemctl_service {
     PVE::Tools::run_command(['systemctl', $action, $service]);
 }
 
+my sub daemon_reload_if_needed {
+    return if !$need_daemon_reload;
+    PVE::Tools::run_command(['systemctl', 'daemon-reload']);
+    $need_daemon_reload = 0;
+}
+
+my sub vrf_dropin_dir {
+    my ($dhcpid) = @_;
+    return "$SYSTEMD_UNIT_ROOT/dnsmasq\@$dhcpid.service.d";
+}
+
+# dnsmasq's DHCP and DNS sockets are not bound to a device, so they don't see
+# traffic from VRF slaves. Starting it via 'ip vrf exec' binds every socket it
+# creates to the zone VRF.
+my sub write_vrf_dropin {
+    my ($dhcpid) = @_;
+
+    my $dir = vrf_dropin_dir($dhcpid);
+    mkdir($dir, 0755) if !-d $dir;
+
+    my $dropin = <<EOF;
+[Service]
+ExecStart=
+ExecStart=/usr/bin/ip vrf exec vrf_$dhcpid /usr/share/dnsmasq/systemd-helper exec "%i"
+EOF
+
+    PVE::Tools::file_set_contents("$dir/$VRF_DROPIN_NAME", $dropin);
+    $need_daemon_reload = 1;
+}
+
+my sub remove_vrf_dropins {
+    PVE::Tools::dir_glob_foreach(
+        $SYSTEMD_UNIT_ROOT,
+        'dnsmasq@.+\.service\.d',
+        sub {
+            my ($dir) = @_;
+            my $file = "$SYSTEMD_UNIT_ROOT/$dir/$VRF_DROPIN_NAME";
+            return if !-e $file;
+
+            unlink($file) or die "failed to remove $file - $!\n";
+            rmdir("$SYSTEMD_UNIT_ROOT/$dir"); # fails if other drop-ins are left
+            $need_daemon_reload = 1;
+        },
+    );
+}
+
 sub before_configure {
     my ($class, $dhcpid, $zone_cfg) = @_;
 
@@ -220,6 +270,8 @@ DBUSCFG
         "/etc/dbus-1/system.d/dnsmasq.$dhcpid.conf", $dbus_config,
     );
 
+    write_vrf_dropin($dhcpid) if $zone_cfg->{'dedicated-vrf'};
+
     my $config_directory = "$DNSMASQ_CONFIG_ROOT/$dhcpid";
 
     mkdir($config_directory, 0755) if !-d $config_directory;
@@ -286,6 +338,7 @@ sub after_configure {
 
     my $service_name = "dnsmasq\@$dhcpid";
 
+    daemon_reload_if_needed();
     systemctl_service('reload', 'dbus');
     systemctl_service('enable', $service_name);
     systemctl_service('restart', $service_name);
@@ -294,6 +347,8 @@ sub after_configure {
 sub before_regenerate {
     my ($class, $noerr) = @_;
 
+    remove_vrf_dropins();
+
     return if !assert_dnsmasq_installed($noerr);
 
     systemctl_service('stop', "dnsmasq@*");
@@ -302,7 +357,9 @@ sub before_regenerate {
 
 sub after_regenerate {
     my ($class) = @_;
-    # noop
+
+    # a drop-in may have been removed without any DHCP zone left to reload
+    daemon_reload_if_needed();
 }
 
 1;
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 65+ messages in thread

* [PATCH proxmox-widget-toolkit v3 26/32] ui: network: allow selecting a VRF for host interfaces
  2026-11-16 16:11 [PATCH common/manager/network/proxmox{-ve-rs,-perl-rs,-widget-toolkit} v3 00/32] SDN VRF support Gabriel Goller
                   ` (24 preceding siblings ...)
  2026-11-16 16:11 ` [PATCH pve-network v3 25/32] sdn: dhcp: run dnsmasq in the zone VRF Gabriel Goller
@ 2026-11-16 16:11 ` Gabriel Goller
  2026-11-16 16:11 ` [PATCH pve-manager v3 27/32] ui: sdn: add VRF zone selection for fabrics Gabriel Goller
                   ` (7 subsequent siblings)
  33 siblings, 0 replies; 65+ messages in thread
From: Gabriel Goller @ 2026-11-16 16:11 UTC (permalink / raw)
  To: pve-devel

Let applications offer VRF membership alongside the other host interface
settings without introducing SDN-specific dependencies into the toolkit.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
 src/node/NetworkEdit.js | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/src/node/NetworkEdit.js b/src/node/NetworkEdit.js
index 1a3e6d3a8666..0ac7b8639574 100644
--- a/src/node/NetworkEdit.js
+++ b/src/node/NetworkEdit.js
@@ -8,6 +8,9 @@ Ext.define('Proxmox.node.NetworkEdit', {
     // Show alternative names below normal name
     showAltNames: false,
 
+    // Optional selector field config for assigning interfaces to a VRF.
+    vrfSelector: undefined,
+
     initComponent: function () {
         let me = this;
 
@@ -299,6 +302,19 @@ Ext.define('Proxmox.node.NetworkEdit', {
             });
         }
 
+        if (me.vrfSelector) {
+            column2.push({
+                ...me.vrfSelector,
+                fieldLabel: gettext('VRF'),
+                emptyText: gettext('No override'),
+                name: 'vrf',
+                nodename: me.nodename,
+                allowBlank: true,
+                skipEmptyText: true,
+                deleteEmpty: !me.isCreate,
+            });
+        }
+
         column2.push({
             xtype: 'textfield',
             fieldLabel: gettext('Comment'),
@@ -472,6 +488,9 @@ Ext.define('Proxmox.node.NetworkEdit', {
                         me.down('field[name=altnames]').setVisible(false);
                     }
                     me.setValues(data);
+                    if (data['vrf-readonly']) {
+                        me.down('field[name=vrf]')?.setDisabled(true);
+                    }
                     me.isValid(); // trigger validation
                 },
             });
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 65+ messages in thread

* [PATCH pve-manager v3 27/32] ui: sdn: add VRF zone selection for fabrics
  2026-11-16 16:11 [PATCH common/manager/network/proxmox{-ve-rs,-perl-rs,-widget-toolkit} v3 00/32] SDN VRF support Gabriel Goller
                   ` (25 preceding siblings ...)
  2026-11-16 16:11 ` [PATCH proxmox-widget-toolkit v3 26/32] ui: network: allow selecting a VRF for host interfaces Gabriel Goller
@ 2026-11-16 16:11 ` Gabriel Goller
  2026-11-16 16:11 ` [PATCH pve-manager v3 28/32] ui: sdn: expose EVPN zones as fabric VRFs Gabriel Goller
                   ` (6 subsequent siblings)
  33 siblings, 0 replies; 65+ messages in thread
From: Gabriel Goller @ 2026-11-16 16:11 UTC (permalink / raw)
  To: pve-devel

Allow BGP and OSPF fabrics to select a simple zone with dedicated-vrf
enabled for routing isolation. An empty selection uses the default VRF.

Put the Dedicated VRF checkbox under Advanced in the simple zone editor.
It is unchecked by default to preserve existing behavior.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
 www/manager6/form/SDNZoneSelector.js   | 16 +++++++++++++++-
 www/manager6/sdn/fabrics/FabricEdit.js | 15 +++++++++++++++
 www/manager6/sdn/zones/SimpleEdit.js   |  9 +++++++++
 3 files changed, 39 insertions(+), 1 deletion(-)

diff --git a/www/manager6/form/SDNZoneSelector.js b/www/manager6/form/SDNZoneSelector.js
index d8a63baeb7bd..56206043271a 100644
--- a/www/manager6/form/SDNZoneSelector.js
+++ b/www/manager6/form/SDNZoneSelector.js
@@ -8,6 +8,9 @@ Ext.define(
         valueField: 'zone',
         displayField: 'zone',
 
+        // Only show simple zones which create a dedicated VRF.
+        vrfOnly: false,
+
         initComponent: function () {
             var me = this;
 
@@ -17,6 +20,13 @@ Ext.define(
                     property: 'zone',
                     direction: 'ASC',
                 },
+                filters: me.vrfOnly
+                    ? [
+                          function (record) {
+                              return record.get('type') === 'simple' && !record.get('default-vrf');
+                          },
+                      ]
+                    : [],
             });
 
             Ext.apply(me, {
@@ -42,7 +52,11 @@ Ext.define(
     function () {
         Ext.define('pve-sdn-zone', {
             extend: 'Ext.data.Model',
-            fields: ['zone', 'type'],
+            fields: [
+                'zone',
+                'type',
+                { name: 'dedicated-vrf', type: 'boolean', defaultValue: false },
+            ],
             proxy: {
                 type: 'proxmox',
                 url: '/api2/json/cluster/sdn/zones',
diff --git a/www/manager6/sdn/fabrics/FabricEdit.js b/www/manager6/sdn/fabrics/FabricEdit.js
index e9e0d1fa6286..69a865ecd7df 100644
--- a/www/manager6/sdn/fabrics/FabricEdit.js
+++ b/www/manager6/sdn/fabrics/FabricEdit.js
@@ -37,6 +37,16 @@ Ext.define('PVE.sdn.Fabric.Fabric.Edit', {
                 disabled: '{!isCreate}',
             },
         },
+        {
+            xtype: 'pveSDNZoneSelector',
+            fieldLabel: gettext('VRF Zone'),
+            labelWidth: 120,
+            name: 'zone',
+            vrfOnly: true,
+            allowBlank: true,
+            skipEmptyText: true,
+            emptyText: gettext('Default VRF'),
+        },
     ],
 
     additionalItems: [],
@@ -50,6 +60,11 @@ Ext.define('PVE.sdn.Fabric.Fabric.Edit', {
         me.autoLoad = !me.isCreate;
         me.method = me.isCreate ? 'POST' : 'PUT';
 
+        let supportsVrf = ['bgp', 'ospf'].includes(me.extraRequestParams.protocol);
+        let vrfZoneField = me.items.find((item) => item.name === 'zone');
+        vrfZoneField.hidden = !supportsVrf;
+        vrfZoneField.disabled = !supportsVrf || !me.isCreate;
+
         if (!me.isCreate) {
             me.url = `${me.baseUrl}/${me.fabricId}`;
         } else {
diff --git a/www/manager6/sdn/zones/SimpleEdit.js b/www/manager6/sdn/zones/SimpleEdit.js
index ba10bb3616ea..9c88668bb5d6 100644
--- a/www/manager6/sdn/zones/SimpleEdit.js
+++ b/www/manager6/sdn/zones/SimpleEdit.js
@@ -20,6 +20,15 @@ Ext.define('PVE.sdn.zones.SimpleInputPanel', {
 
         me.items = [];
         me.advancedItems = [
+            {
+                xtype: 'proxmoxcheckbox',
+                name: 'dedicated-vrf',
+                fieldLabel: gettext('Dedicated VRF'),
+                checked: false,
+                uncheckedValue: 0,
+                defaultValue: 0,
+                deleteDefaultValue: !me.isCreate,
+            },
             {
                 xtype: 'proxmoxcheckbox',
                 name: 'dhcp',
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 65+ messages in thread

* [PATCH pve-manager v3 28/32] ui: sdn: expose EVPN zones as fabric VRFs
  2026-11-16 16:11 [PATCH common/manager/network/proxmox{-ve-rs,-perl-rs,-widget-toolkit} v3 00/32] SDN VRF support Gabriel Goller
                   ` (26 preceding siblings ...)
  2026-11-16 16:11 ` [PATCH pve-manager v3 27/32] ui: sdn: add VRF zone selection for fabrics Gabriel Goller
@ 2026-11-16 16:11 ` Gabriel Goller
  2026-11-16 16:11 ` [PATCH pve-manager v3 29/32] network: allow setting the VRF of host interfaces Gabriel Goller
                   ` (5 subsequent siblings)
  33 siblings, 0 replies; 65+ messages in thread
From: Gabriel Goller @ 2026-11-16 16:11 UTC (permalink / raw)
  To: pve-devel

Include EVPN zones in the fabric VRF selector, since they also provide
a dedicated routing table.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
 www/manager6/form/SDNZoneSelector.js   | 11 +++++++++--
 www/manager6/sdn/fabrics/FabricEdit.js |  5 ++++-
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/www/manager6/form/SDNZoneSelector.js b/www/manager6/form/SDNZoneSelector.js
index 56206043271a..05fd4be8b270 100644
--- a/www/manager6/form/SDNZoneSelector.js
+++ b/www/manager6/form/SDNZoneSelector.js
@@ -8,9 +8,12 @@ Ext.define(
         valueField: 'zone',
         displayField: 'zone',
 
-        // Only show simple zones which create a dedicated VRF.
+        // Only show zones which create a dedicated VRF.
         vrfOnly: false,
 
+        // Hide EVPN zones, e.g. for BGP fabrics, which cannot run in an EVPN zone VRF.
+        excludeEvpn: false,
+
         initComponent: function () {
             var me = this;
 
@@ -23,7 +26,11 @@ Ext.define(
                 filters: me.vrfOnly
                     ? [
                           function (record) {
-                              return record.get('type') === 'simple' && !record.get('default-vrf');
+                              let type = record.get('type');
+                              return (
+                                  (type === 'evpn' && !me.excludeEvpn) ||
+                                  (type === 'simple' && record.get('dedicated-vrf'))
+                              );
                           },
                       ]
                     : [],
diff --git a/www/manager6/sdn/fabrics/FabricEdit.js b/www/manager6/sdn/fabrics/FabricEdit.js
index 69a865ecd7df..fdd6e2ef0ef2 100644
--- a/www/manager6/sdn/fabrics/FabricEdit.js
+++ b/www/manager6/sdn/fabrics/FabricEdit.js
@@ -60,10 +60,13 @@ Ext.define('PVE.sdn.Fabric.Fabric.Edit', {
         me.autoLoad = !me.isCreate;
         me.method = me.isCreate ? 'POST' : 'PUT';
 
-        let supportsVrf = ['bgp', 'ospf'].includes(me.extraRequestParams.protocol);
+        let protocol = me.extraRequestParams.protocol;
+        let supportsVrf = ['bgp', 'ospf'].includes(protocol);
         let vrfZoneField = me.items.find((item) => item.name === 'zone');
         vrfZoneField.hidden = !supportsVrf;
         vrfZoneField.disabled = !supportsVrf || !me.isCreate;
+        // The API rejects BGP fabrics in EVPN zone VRFs.
+        vrfZoneField.excludeEvpn = protocol === 'bgp';
 
         if (!me.isCreate) {
             me.url = `${me.baseUrl}/${me.fabricId}`;
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 65+ messages in thread

* [PATCH pve-manager v3 29/32] network: allow setting the VRF of host interfaces
  2026-11-16 16:11 [PATCH common/manager/network/proxmox{-ve-rs,-perl-rs,-widget-toolkit} v3 00/32] SDN VRF support Gabriel Goller
                   ` (27 preceding siblings ...)
  2026-11-16 16:11 ` [PATCH pve-manager v3 28/32] ui: sdn: expose EVPN zones as fabric VRFs Gabriel Goller
@ 2026-11-16 16:11 ` Gabriel Goller
  2026-11-16 16:11 ` [PATCH pve-manager v3 30/32] ui: sdn: allow static routes for Simple zone VRFs Gabriel Goller
                   ` (4 subsequent siblings)
  33 siblings, 0 replies; 65+ messages in thread
From: Gabriel Goller @ 2026-11-16 16:11 UTC (permalink / raw)
  To: pve-devel

Host interfaces can now be put into a VRF from the network panel. The
VRF field suggests the VRFs of applied SDN zones on this node, but also
accepts other VRF names, for example a VRF configured by hand.

Interfaces that are part of a fabric get their VRF from the fabric, so
the field is read-only for them. Their other settings stay editable.

The duplicate gateway check now only compares interfaces in the same
VRF, because every VRF has its own default route.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
 PVE/API2/Network.pm                  | 41 ++++++++++++------
 www/manager6/form/SDNZoneSelector.js | 63 +++++++++++++++++++++++-----
 www/manager6/node/Config.js          | 12 ++++++
 3 files changed, 93 insertions(+), 23 deletions(-)

diff --git a/PVE/API2/Network.pm b/PVE/API2/Network.pm
index 6f8854822f00..df89d26243d0 100644
--- a/PVE/API2/Network.pm
+++ b/PVE/API2/Network.pm
@@ -165,6 +165,14 @@ my $confdesc = {
         minimum => 1,
         maximum => 4094,
     },
+    vrf => {
+        description => 'VRF master interface.',
+        type => 'string',
+        minLength => 1,
+        maxLength => 15,
+        pattern => '[a-zA-Z0-9_][a-zA-Z0-9_.-]*',
+        optional => 1,
+    },
     gateway => {
         description => 'Default gateway address.',
         type => 'string',
@@ -520,7 +528,9 @@ __PACKAGE__->register_method({
 my $check_duplicate = sub {
     my ($config, $newiface, $key, $name) = @_;
 
+    my $vrf = $config->{$newiface}->{vrf} // '';
     foreach my $iface (keys %$config) {
+        next if ($config->{$iface}->{vrf} // '') ne $vrf;
         raise_param_exc({ $key => "$name already exists on interface '$iface'." })
             if ($newiface ne $iface) && $config->{$iface}->{$key};
     }
@@ -652,11 +662,6 @@ __PACKAGE__->register_method({
             raise_param_exc({ iface => "interface already exists" })
                 if $ifaces->{$iface};
 
-            &$check_duplicate_gateway($ifaces, $iface)
-                if $param->{gateway};
-            &$check_duplicate_gateway6($ifaces, $iface)
-                if $param->{gateway6};
-
             $check_duplicate_ports->($ifaces, $iface, $param);
 
             $map_cidr_to_address_netmask->($param);
@@ -704,6 +709,8 @@ __PACKAGE__->register_method({
                 if $param->{bridge_vids};
 
             $ifaces->{$iface} = $param;
+            $check_duplicate_gateway->($ifaces, $iface) if $param->{gateway};
+            $check_duplicate_gateway6->($ifaces, $iface) if $param->{gateway6};
 
             PVE::INotify::write_file('interfaces', $config);
         };
@@ -769,11 +776,6 @@ __PACKAGE__->register_method({
 
             $map_cidr_to_address_netmask->($param);
 
-            &$check_duplicate_gateway($ifaces, $iface)
-                if $param->{gateway};
-            &$check_duplicate_gateway6($ifaces, $iface)
-                if $param->{gateway6};
-
             $check_duplicate_ports->($ifaces, $iface, $param);
 
             if ($param->{address}) {
@@ -795,6 +797,8 @@ __PACKAGE__->register_method({
             foreach my $k (keys %$param) {
                 $ifaces->{$iface}->{$k} = $param->{$k};
             }
+            $check_duplicate_gateway->($ifaces, $iface) if $ifaces->{$iface}->{gateway};
+            $check_duplicate_gateway6->($ifaces, $iface) if $ifaces->{$iface}->{gateway6};
 
             if (
                 $param->{bridge_vids}
@@ -842,6 +846,12 @@ __PACKAGE__->register_method({
             method => {
                 type => 'string',
             },
+            'vrf-readonly' => {
+                type => 'boolean',
+                optional => 1,
+                description =>
+                    'The VRF field is managed by an SDN fabric and should be disabled in the host network editor.',
+            },
         },
     },
     code => sub {
@@ -855,10 +865,17 @@ __PACKAGE__->register_method({
         raise_param_exc({ iface => "interface does not exist" })
             if !$ifaces->{$iface};
 
+        my $data = { $ifaces->{$iface}->%* };
         my $altnames = extract_altnames($iface);
-        $ifaces->{$iface}->{altnames} = $altnames if defined($altnames);
+        $data->{altnames} = $altnames if defined($altnames);
+
+        if ($have_sdn) {
+            my $fabrics = PVE::Network::SDN::Fabrics::config();
+            $data->{'vrf-readonly'} = 1
+                if $fabrics->is_fabric_interface(PVE::INotify::nodename(), $iface);
+        }
 
-        return $ifaces->{$iface};
+        return $data;
     },
 });
 
diff --git a/www/manager6/form/SDNZoneSelector.js b/www/manager6/form/SDNZoneSelector.js
index 05fd4be8b270..acfc61013616 100644
--- a/www/manager6/form/SDNZoneSelector.js
+++ b/www/manager6/form/SDNZoneSelector.js
@@ -5,6 +5,7 @@ Ext.define(
         alias: ['widget.pveSDNZoneSelector'],
 
         allowBlank: false,
+        // Use 'vrf' to submit the native VRF interface name instead of the zone ID.
         valueField: 'zone',
         displayField: 'zone',
 
@@ -14,6 +15,24 @@ Ext.define(
         // Hide EVPN zones, e.g. for BGP fabrics, which cannot run in an EVPN zone VRF.
         excludeEvpn: false,
 
+        // Only show zones available on this node, if specified.
+        nodename: undefined,
+
+        // Exclude a zone, including its native VRF name when custom input is allowed.
+        excludeZone: undefined,
+
+        // Only show zones from the applied SDN configuration, not pending changes.
+        running: false,
+
+        validator: function (value) {
+            let me = this;
+            let excluded = me.valueField === 'vrf' ? `vrf_${me.excludeZone}` : me.excludeZone;
+            if (me.excludeZone && value === excluded) {
+                return gettext('This zone is not allowed.');
+            }
+            return me.callParent([value]);
+        },
+
         initComponent: function () {
             var me = this;
 
@@ -23,19 +42,32 @@ Ext.define(
                     property: 'zone',
                     direction: 'ASC',
                 },
-                filters: me.vrfOnly
-                    ? [
-                          function (record) {
-                              let type = record.get('type');
-                              return (
-                                  (type === 'evpn' && !me.excludeEvpn) ||
-                                  (type === 'simple' && record.get('dedicated-vrf'))
-                              );
-                          },
-                      ]
-                    : [],
+                filters: [
+                    (record) => !me.excludeZone || record.get('zone') !== me.excludeZone,
+                    function (record) {
+                        let type = record.get('type');
+                        return (
+                            !me.vrfOnly ||
+                            (type === 'evpn' && !me.excludeEvpn) ||
+                            (type === 'simple' && record.get('dedicated-vrf'))
+                        );
+                    },
+                    function (record) {
+                        let nodes = record.get('nodes');
+                        return !me.nodename || !nodes || nodes.split(',').includes(me.nodename);
+                    },
+                ],
             });
 
+            if (me.running) {
+                // Don't touch the shared model proxy, other selectors need the pending config.
+                store.setProxy({
+                    type: 'proxmox',
+                    url: '/api2/json/cluster/sdn/zones',
+                    extraParams: { running: 1 },
+                });
+            }
+
             Ext.apply(me, {
                 store: store,
                 autoSelect: false,
@@ -62,6 +94,15 @@ Ext.define(
             fields: [
                 'zone',
                 'type',
+                'nodes',
+                {
+                    name: 'vrf',
+                    // Preserve custom values in the synthetic records created by ComboBox.
+                    convert: (value, record) => {
+                        let zone = record.get('zone');
+                        return value ?? (zone ? `vrf_${zone}` : value);
+                    },
+                },
                 { name: 'dedicated-vrf', type: 'boolean', defaultValue: false },
             ],
             proxy: {
diff --git a/www/manager6/node/Config.js b/www/manager6/node/Config.js
index 217ee284c078..9f75f9096d5f 100644
--- a/www/manager6/node/Config.js
+++ b/www/manager6/node/Config.js
@@ -196,6 +196,18 @@ Ext.define('PVE.node.Config', {
                     nodename: nodename,
                     editOptions: {
                         enableBridgeVlanIds: true,
+                        vrfSelector: {
+                            xtype: 'pveSDNZoneSelector',
+                            running: true,
+                            vrfOnly: true,
+                            valueField: 'vrf',
+                            displayField: 'vrf',
+                            editable: true,
+                            forceSelection: false,
+                            anyMatch: true,
+                            maxLength: 15,
+                            notFoundIsValid: true,
+                        },
                     },
                     onlineHelp: 'sysadmin_network_configuration',
                 },
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 65+ messages in thread

* [PATCH pve-manager v3 30/32] ui: sdn: allow static routes for Simple zone VRFs
  2026-11-16 16:11 [PATCH common/manager/network/proxmox{-ve-rs,-perl-rs,-widget-toolkit} v3 00/32] SDN VRF support Gabriel Goller
                   ` (28 preceding siblings ...)
  2026-11-16 16:11 ` [PATCH pve-manager v3 29/32] network: allow setting the VRF of host interfaces Gabriel Goller
@ 2026-11-16 16:11 ` Gabriel Goller
  2026-11-16 16:11 ` [PATCH pve-manager v3 31/32] ui: sdn: allow static routes in EVPN zones Gabriel Goller
                   ` (3 subsequent siblings)
  33 siblings, 0 replies; 65+ messages in thread
From: Gabriel Goller @ 2026-11-16 16:11 UTC (permalink / raw)
  To: pve-devel

Allow Simple zones to reach networks outside their directly connected
subnets through static routes. A next-hop VRF can be set when the gateway
is in another routing table, including a manually managed VRF.

Routes can use a gateway, an outgoing interface, or both. IPv6 link-local
gateways require an interface. Keep the routes in a separate tab so the
general zone settings remain easy to use.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
 www/manager6/Makefile                |   1 +
 www/manager6/Toolkit.js              |   2 +-
 www/manager6/sdn/StaticRoutes.js     | 246 +++++++++++++++++++++++++++
 www/manager6/sdn/zones/Base.js       |  22 ++-
 www/manager6/sdn/zones/SimpleEdit.js |  12 ++
 5 files changed, 280 insertions(+), 3 deletions(-)
 create mode 100644 www/manager6/sdn/StaticRoutes.js

diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index e8e2bd0b49e8..349b912b61da 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -305,6 +305,7 @@ JSSRC= 							\
 	sdn/VnetPanel.js				\
 	sdn/SubnetEdit.js				\
 	sdn/SubnetView.js				\
+	sdn/StaticRoutes.js				\
 	sdn/ZoneContentView.js				\
 	sdn/ZoneContentPanel.js				\
 	sdn/ZoneBridgesPanel.js				\
diff --git a/www/manager6/Toolkit.js b/www/manager6/Toolkit.js
index 9cc89184188e..2fea13e4aed3 100644
--- a/www/manager6/Toolkit.js
+++ b/www/manager6/Toolkit.js
@@ -17,7 +17,7 @@ Ext.apply(Ext.form.field.VTypes, {
 
     IP64FullRangeCIDRAddress: function (v) {
         let result = Proxmox.Utils.IP64_cidr_match.exec(v);
-        if (result === null) {
+        if (result === null || result[0] !== v) {
             return false;
         }
         if (result[1] !== undefined) {
diff --git a/www/manager6/sdn/StaticRoutes.js b/www/manager6/sdn/StaticRoutes.js
new file mode 100644
index 000000000000..66bfc0f3608d
--- /dev/null
+++ b/www/manager6/sdn/StaticRoutes.js
@@ -0,0 +1,246 @@
+Ext.define('PVE.sdn.StaticRouteEdit', {
+    extend: 'Proxmox.window.Edit',
+    mixins: ['Proxmox.Mixin.CBind'],
+
+    zone: undefined,
+
+    subject: gettext('Static Route'),
+    width: 450,
+    isAdd: true,
+    url: '#',
+
+    fieldDefaults: {
+        labelWidth: 150,
+    },
+
+    items: [
+        {
+            xtype: 'textfield',
+            name: 'prefix',
+            fieldLabel: gettext('Destination Prefix'),
+            vtype: 'IP64FullRangeCIDRAddress',
+            allowBlank: false,
+        },
+        {
+            xtype: 'proxmoxtextfield',
+            name: 'via',
+            fieldLabel: gettext('Gateway'),
+            vtype: 'IP64Address',
+            skipEmptyText: true,
+            validator: function (value) {
+                let iface = this.up('window').down('[name=iface]')?.getValue();
+                return value || iface
+                    ? true
+                    : gettext('Either a gateway or an interface is required.');
+            },
+            listeners: {
+                change: function (field) {
+                    field.up('window').down('[name=iface]')?.validate();
+                },
+            },
+        },
+        {
+            xtype: 'proxmoxtextfield',
+            name: 'iface',
+            fieldLabel: gettext('Outgoing Interface'),
+            maxLength: 15,
+            regex: /^[^\s,=/]+$/,
+            skipEmptyText: true,
+            validator: function (value) {
+                let via = this.up('window').down('[name=via]')?.getValue();
+                if (!value && !via) {
+                    return gettext('Either a gateway or an interface is required.');
+                }
+                if (!value && /^fe[89ab][0-9a-f]:/i.test(via)) {
+                    return gettext('An interface is required for an IPv6 link-local gateway.');
+                }
+                return true;
+            },
+            listeners: {
+                change: function (field) {
+                    field.up('window').down('[name=via]')?.validate();
+                },
+            },
+        },
+        {
+            xtype: 'proxmoxintegerfield',
+            name: 'distance',
+            fieldLabel: gettext('Distance'),
+            minValue: 1,
+            maxValue: 255,
+            allowBlank: true,
+        },
+        {
+            xtype: 'pveSDNZoneSelector',
+            name: 'nexthop-vrf',
+            fieldLabel: gettext('Next-hop VRF'),
+            cbind: {
+                excludeZone: '{zone}',
+            },
+            vrfOnly: true,
+            valueField: 'vrf',
+            displayField: 'vrf',
+            editable: true,
+            forceSelection: false,
+            anyMatch: true,
+            notFoundIsValid: true,
+            allowBlank: true,
+            maxLength: 15,
+            regex: /^[^\s,=/]+$/,
+            skipEmptyText: true,
+        },
+    ],
+
+    submit: function () {
+        let me = this;
+        if (me.isValid()) {
+            me.onSave(me.getValues());
+            me.close();
+        }
+    },
+});
+
+Ext.define('PVE.sdn.StaticRoutes', {
+    extend: 'Ext.grid.Panel',
+    alias: 'widget.pveSDNStaticRoutes',
+    mixins: ['Ext.form.field.Field'],
+
+    isCreate: false,
+    value: [],
+    height: 250,
+
+    store: {
+        fields: [
+            'route',
+            ...['prefix', 'via', 'iface', 'distance', 'nexthop-vrf'].map((name) => ({
+                name,
+                calculate: (data) => data.route[name],
+            })),
+        ],
+        data: [],
+    },
+
+    viewConfig: {
+        emptyText: gettext('No static routes configured'),
+        deferEmptyText: false,
+    },
+
+    columns: [
+        {
+            text: gettext('Destination Prefix'),
+            dataIndex: 'prefix',
+            flex: 2,
+            renderer: Ext.htmlEncode,
+        },
+        {
+            text: gettext('Gateway'),
+            dataIndex: 'via',
+            flex: 2,
+            renderer: Ext.htmlEncode,
+        },
+        {
+            text: gettext('Interface'),
+            dataIndex: 'iface',
+            flex: 1,
+            renderer: Ext.htmlEncode,
+        },
+        {
+            text: gettext('Distance'),
+            dataIndex: 'distance',
+            width: 80,
+            renderer: Ext.htmlEncode,
+        },
+        {
+            text: gettext('Next-hop VRF'),
+            dataIndex: 'nexthop-vrf',
+            flex: 1,
+            renderer: Ext.htmlEncode,
+        },
+    ],
+
+    editRoute: function (record) {
+        let me = this;
+        let win = Ext.create('PVE.sdn.StaticRouteEdit', {
+            isCreate: !record,
+            zone: me.up('window').down('[name=zone]').getValue(),
+            onSave: function (values) {
+                if (record) {
+                    record.set('route', values);
+                } else {
+                    me.getStore().add({ route: values });
+                }
+            },
+        });
+        if (record) {
+            win.setValues(record.get('route'));
+        }
+        win.show();
+    },
+
+    isEqual: function (value1, value2) {
+        return JSON.stringify(value1) === JSON.stringify(value2);
+    },
+
+    getValue: function () {
+        return this.getStore()
+            .getRange()
+            .map((record) => PVE.Parser.printPropertyString(record.get('route')));
+    },
+
+    setValue: function (value) {
+        let me = this;
+        me.getStore().setData(
+            (value ?? []).map((route) => ({ route: PVE.Parser.parsePropertyString(route) })),
+        );
+        me.checkChange();
+        return me;
+    },
+
+    getSubmitData: function () {
+        let me = this;
+        if (me.disabled || !me.submitValue) {
+            return null;
+        }
+        let value = me.getValue();
+        if (value.length) {
+            return { [me.getName()]: value };
+        }
+        return me.isCreate ? null : { delete: me.getName() };
+    },
+
+    initComponent: function () {
+        let me = this;
+        let sm = Ext.create('Ext.selection.RowModel');
+
+        me.selModel = sm;
+        me.tbar = [
+            {
+                text: gettext('Add'),
+                handler: () => me.editRoute(),
+            },
+            {
+                xtype: 'proxmoxButton',
+                text: gettext('Edit'),
+                disabled: true,
+                selModel: sm,
+                handler: () => me.editRoute(sm.getSelection()[0]),
+            },
+            {
+                xtype: 'proxmoxButton',
+                text: gettext('Remove'),
+                disabled: true,
+                selModel: sm,
+                handler: () => me.getStore().remove(sm.getSelection()),
+            },
+        ];
+
+        me.callParent();
+        me.initField();
+        me.mon(me.getStore(), {
+            datachanged: me.checkChange,
+            update: me.checkChange,
+            scope: me,
+        });
+        me.on('itemdblclick', (grid, record) => me.editRoute(record));
+    },
+});
diff --git a/www/manager6/sdn/zones/Base.js b/www/manager6/sdn/zones/Base.js
index 66f93de0dff2..ebfbc953317d 100644
--- a/www/manager6/sdn/zones/Base.js
+++ b/www/manager6/sdn/zones/Base.js
@@ -45,6 +45,8 @@ Ext.define('PVE.panel.SDNZoneBase', {
                 emptyText: gettext('All') + ' (' + gettext('No restrictions') + ')',
                 multiSelect: true,
                 autoSelect: false,
+                skipEmptyText: true,
+                deleteEmpty: !me.isCreate,
             },
             {
                 xtype: 'pveSDNIpamSelector',
@@ -110,10 +112,26 @@ Ext.define('PVE.sdn.zones.BaseEdit', {
             zone: me.zone,
         });
 
+        let additionalTabs = ipanel.getAdditionalTabs?.() ?? [];
+        let items = [ipanel];
+        if (additionalTabs.length) {
+            ipanel.setTitle(gettext('General'));
+            me.width = 760;
+            me.bodyPadding = 0;
+            items = [
+                {
+                    xtype: 'tabpanel',
+                    bodyPadding: 10,
+                    deferredRender: false,
+                    items: [ipanel, ...additionalTabs],
+                },
+            ];
+        }
+
         Ext.apply(me, {
             subject: PVE.Utils.format_sdnzone_type(me.type),
             isAdd: true,
-            items: [ipanel],
+            items,
         });
 
         me.callParent();
@@ -136,7 +154,7 @@ Ext.define('PVE.sdn.zones.BaseEdit', {
 
                     values.enable = values.disable ? 0 : 1;
 
-                    ipanel.setValues(values);
+                    me.setValues(values);
                 },
             });
         }
diff --git a/www/manager6/sdn/zones/SimpleEdit.js b/www/manager6/sdn/zones/SimpleEdit.js
index 9c88668bb5d6..5b80bfcdbeec 100644
--- a/www/manager6/sdn/zones/SimpleEdit.js
+++ b/www/manager6/sdn/zones/SimpleEdit.js
@@ -3,6 +3,18 @@ Ext.define('PVE.sdn.zones.SimpleInputPanel', {
 
     onlineHelp: 'pvesdn_zone_plugin_simple',
 
+    getAdditionalTabs: function () {
+        return [
+            {
+                xtype: 'pveSDNStaticRoutes',
+                title: gettext('Static Routes'),
+                onlineHelp: this.onlineHelp,
+                name: 'route',
+                isCreate: this.isCreate,
+            },
+        ];
+    },
+
     onGetValues: function (values) {
         var me = this;
 
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 65+ messages in thread

* [PATCH pve-manager v3 31/32] ui: sdn: allow static routes in EVPN zones
  2026-11-16 16:11 [PATCH common/manager/network/proxmox{-ve-rs,-perl-rs,-widget-toolkit} v3 00/32] SDN VRF support Gabriel Goller
                   ` (29 preceding siblings ...)
  2026-11-16 16:11 ` [PATCH pve-manager v3 30/32] ui: sdn: allow static routes for Simple zone VRFs Gabriel Goller
@ 2026-11-16 16:11 ` Gabriel Goller
  2026-11-16 16:11 ` [PATCH pve-manager v3 32/32] network: generate SDN DHCP config after ifreload Gabriel Goller
                   ` (2 subsequent siblings)
  33 siblings, 0 replies; 65+ messages in thread
From: Gabriel Goller @ 2026-11-16 16:11 UTC (permalink / raw)
  To: pve-devel

Let EVPN tenants configure local static routes using the same editor as
Simple zones, without adding route advertisement controls.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
 www/manager6/sdn/zones/Base.js       | 18 ++++++++++++++++++
 www/manager6/sdn/zones/EvpnEdit.js   |  2 ++
 www/manager6/sdn/zones/SimpleEdit.js | 12 +-----------
 3 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/www/manager6/sdn/zones/Base.js b/www/manager6/sdn/zones/Base.js
index ebfbc953317d..12b10f7b48ec 100644
--- a/www/manager6/sdn/zones/Base.js
+++ b/www/manager6/sdn/zones/Base.js
@@ -3,6 +3,24 @@ Ext.define('PVE.panel.SDNZoneBase', {
 
     type: '',
 
+    supportsStaticRoutes: false,
+
+    getAdditionalTabs: function () {
+        if (!this.supportsStaticRoutes) {
+            return [];
+        }
+
+        return [
+            {
+                xtype: 'pveSDNStaticRoutes',
+                title: gettext('Static Routes'),
+                onlineHelp: this.onlineHelp,
+                name: 'route',
+                isCreate: this.isCreate,
+            },
+        ];
+    },
+
     onGetValues: function (values) {
         var me = this;
 
diff --git a/www/manager6/sdn/zones/EvpnEdit.js b/www/manager6/sdn/zones/EvpnEdit.js
index 7229fc140200..bc5bd50a1ff2 100644
--- a/www/manager6/sdn/zones/EvpnEdit.js
+++ b/www/manager6/sdn/zones/EvpnEdit.js
@@ -3,6 +3,8 @@ Ext.define('PVE.sdn.zones.EvpnInputPanel', {
 
     onlineHelp: 'pvesdn_zone_plugin_evpn',
 
+    supportsStaticRoutes: true,
+
     onGetValues: function (values) {
         var me = this;
 
diff --git a/www/manager6/sdn/zones/SimpleEdit.js b/www/manager6/sdn/zones/SimpleEdit.js
index 5b80bfcdbeec..29a7fa5c71d5 100644
--- a/www/manager6/sdn/zones/SimpleEdit.js
+++ b/www/manager6/sdn/zones/SimpleEdit.js
@@ -3,17 +3,7 @@ Ext.define('PVE.sdn.zones.SimpleInputPanel', {
 
     onlineHelp: 'pvesdn_zone_plugin_simple',
 
-    getAdditionalTabs: function () {
-        return [
-            {
-                xtype: 'pveSDNStaticRoutes',
-                title: gettext('Static Routes'),
-                onlineHelp: this.onlineHelp,
-                name: 'route',
-                isCreate: this.isCreate,
-            },
-        ];
-    },
+    supportsStaticRoutes: true,
 
     onGetValues: function (values) {
         var me = this;
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 65+ messages in thread

* [PATCH pve-manager v3 32/32] network: generate SDN DHCP config after ifreload
  2026-11-16 16:11 [PATCH common/manager/network/proxmox{-ve-rs,-perl-rs,-widget-toolkit} v3 00/32] SDN VRF support Gabriel Goller
                   ` (30 preceding siblings ...)
  2026-11-16 16:11 ` [PATCH pve-manager v3 31/32] ui: sdn: allow static routes in EVPN zones Gabriel Goller
@ 2026-11-16 16:11 ` Gabriel Goller
  2026-11-18 18:27 ` [PATCH common/manager/network/proxmox{-ve-rs,-perl-rs,-widget-toolkit} v3 00/32] SDN VRF support Stefan Hanreich
  2026-11-19 20:10 ` Gabriel Goller
  33 siblings, 0 replies; 65+ messages in thread
From: Gabriel Goller @ 2026-11-16 16:11 UTC (permalink / raw)
  To: pve-devel

dnsmasq instances of SDN zones with a dedicated VRF are started inside that
VRF, so the VRF has to be created by ifreload before the DHCP config is
generated and the instances are restarted. Otherwise dnsmasq fails to start
on the first apply after enabling the VRF.

pve-sdn-commit needs the same order. At boot, networking.service brings up
the old SDN config, so the VRF of a zone changed while the node was offline
only exists after its ifreload.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
 PVE/API2/Network.pm | 5 ++++-
 bin/pve-sdn-commit  | 5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/PVE/API2/Network.pm b/PVE/API2/Network.pm
index df89d26243d0..8fb187972587 100644
--- a/PVE/API2/Network.pm
+++ b/PVE/API2/Network.pm
@@ -942,7 +942,6 @@ __PACKAGE__->register_method({
 
             if ($have_sdn) {
                 PVE::Network::SDN::generate_etc_network_config();
-                PVE::Network::SDN::generate_dhcp_config();
                 PVE::Network::SDN::WireGuard::generate_wireguard_config();
             }
 
@@ -954,6 +953,10 @@ __PACKAGE__->register_method({
             };
             PVE::Tools::run_command(['ifreload', '-a'], errfunc => $err);
 
+            # needs the zone VRFs created by ifreload, because dnsmasq is started inside
+            # them with 'ip vrf exec'
+            PVE::Network::SDN::generate_dhcp_config() if $have_sdn;
+
             if (defined($regenerate_frr)) {
                 # SDN (or a manual invocation) is requesting a
                 # specific behavior, so we abide by the parameter set.
diff --git a/bin/pve-sdn-commit b/bin/pve-sdn-commit
index aa7e9b29056a..ab4175b87fa7 100644
--- a/bin/pve-sdn-commit
+++ b/bin/pve-sdn-commit
@@ -108,7 +108,6 @@ my $new_config_has_frr = PVE::Network::SDN::running_config_has_frr();
 my $regenerate_frr = ($previous_config_has_frr || $new_config_has_frr);
 
 PVE::Network::SDN::generate_etc_network_config();
-PVE::Network::SDN::generate_dhcp_config();
 
 my $err = sub {
     my $line = shift;
@@ -119,6 +118,10 @@ my $err = sub {
 
 PVE::Tools::run_command(['ifreload', '-a'], errfunc => $err);
 
+# needs the zone VRFs created by ifreload, because dnsmasq is started inside
+# them with 'ip vrf exec'
+PVE::Network::SDN::generate_dhcp_config();
+
 PVE::Network::SDN::generate_frr_config(1) if $regenerate_frr;
 
 exit 0;
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 65+ messages in thread

* Re: [PATCH proxmox-ve-rs v3 03/32] sdn: add zone references to OSPF and BGP fabrics
  2026-11-16 16:11 ` [PATCH proxmox-ve-rs v3 03/32] sdn: add zone references to OSPF and BGP fabrics Gabriel Goller
@ 2026-11-18 14:10   ` Stefan Hanreich
  2026-11-18 16:55     ` Gabriel Goller
  0 siblings, 1 reply; 65+ messages in thread
From: Stefan Hanreich @ 2026-11-18 14:10 UTC (permalink / raw)
  To: pve-devel

Is there a reason why updating / deleting a zone is implemented here, but
rejected in pve-network? Afaict deleting a zone actually works from the
API as the checks there are insufficient? Can we just add #[updater(skip)]
here and remove zone from the deletable properties?

On 11/16/26 5:13 PM, Gabriel Goller wrote:
> Allow OSPF and BGP fabrics to refer to an SDN zone. The zone provides
> the VRF in which the fabric routing protocol will run. Support setting
> and deleting the reference through the fabric update API.
> 
> Scope prefix overlap checks and OSPF area uniqueness by zone. Different
> VRFs have independent routing tables, so they can reuse addresses and
> OSPF areaas.
> 
> Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
> ---
>  proxmox-ve-config/src/sdn/fabric/mod.rs       | 30 ++++++-
>  .../src/sdn/fabric/section_config/fabric.rs   | 29 ++++++-
>  .../sdn/fabric/section_config/protocol/bgp.rs | 11 ++-
>  .../fabric/section_config/protocol/ospf.rs    | 11 ++-
>  proxmox-ve-config/tests/fabric/main.rs        | 85 ++++++++++++++++++-
>  5 files changed, 158 insertions(+), 8 deletions(-)
> 
> diff --git a/proxmox-ve-config/src/sdn/fabric/mod.rs b/proxmox-ve-config/src/sdn/fabric/mod.rs
> index 79bb1fd91651..7c00a7b27a65 100644
> --- a/proxmox-ve-config/src/sdn/fabric/mod.rs
> +++ b/proxmox-ve-config/src/sdn/fabric/mod.rs
> @@ -773,8 +773,8 @@ impl Validatable for FabricConfig {
>      /// Ensures that:
>      /// - (node, interface) combinations exist only once across all fabrics
>      /// - every entry (fabric) validates
> -    /// - all the ospf fabrics have different areas
> -    /// - IP prefixes of fabrics do not overlap
> +    /// - OSPF areas are unique within each VRF
> +    /// - IP prefixes do not overlap within the same VRF
>      fn validate(&self) -> Result<(), FabricConfigError> {
>          let mut wireguard_interfaces = HashSet::new();
>          let mut wireguard_listen_ports = HashSet::new();
> @@ -789,6 +789,11 @@ impl Validatable for FabricConfig {
>              .flat_map(|(i, f1)| fabrics.iter().skip(i + 1).map(move |f2| (f1, f2)));
>  
>          for (fabric1, fabric2) in cartesian_product {
> +            // Separate VRFs have independent routing tables and may use overlapping address space.
> +            if fabric1.zone() != fabric2.zone() {
> +                continue;
> +            }
> +
>              if let (Some(prefix1), Some(prefix2)) = (fabric1.ip_prefix(), fabric2.ip_prefix()) {
>                  if prefix1.overlaps(&prefix2) {
>                      return Err(FabricConfigError::OverlappingIp4Prefix(
> @@ -815,13 +820,14 @@ impl Validatable for FabricConfig {
>          // additionally, for wireguard check the listen ports of the interfaces as well
>          for entry in self.fabrics.values() {
>              if let FabricEntry::Ospf(entry) = entry {
> -                if !ospf_area.insert(
> +                if !ospf_area.insert((
> +                    entry.fabric_section().properties().zone().cloned(),
>                      entry
>                          .fabric_section()
>                          .properties()
>                          .area()
>                          .get_ipv4_representation(),
> -                ) {
> +                )) {
>                      return Err(FabricConfigError::DuplicateOspfArea);
>                  }
>              }
> @@ -1002,6 +1008,7 @@ impl FabricConfig {
>                      ip6_prefix,
>                      properties:
>                          OspfPropertiesUpdater {
> +                            zone,
>                              area,
>                              route_filter,
>                              redistribute,
> @@ -1017,6 +1024,10 @@ impl FabricConfig {
>                      fabric_section.ip6_prefix = Some(prefix);
>                  }
>  
> +                if let Some(zone) = zone {
> +                    fabric_section.properties.zone = Some(zone);
> +                }
> +
>                  if let Some(area) = area {
>                      fabric_section.properties.area = area;
>                  }
> @@ -1037,6 +1048,9 @@ impl FabricConfig {
>                          FabricDeletableProperties::Ip6Prefix => {
>                              fabric_section.ip6_prefix = None;
>                          }
> +                        FabricDeletableProperties::Protocol(OspfDeletableProperties::Zone) => {
> +                            fabric_section.properties.zone = None;
> +                        }
>                          FabricDeletableProperties::Protocol(
>                              OspfDeletableProperties::RouteFilter,
>                          ) => {
> @@ -1100,6 +1114,7 @@ impl FabricConfig {
>                      ip6_prefix,
>                      properties:
>                          BgpPropertiesUpdater {
> +                            zone,
>                              bfd,
>                              redistribute,
>                              route_map_in,
> @@ -1117,6 +1132,10 @@ impl FabricConfig {
>                      fabric_section.ip6_prefix = Some(prefix);
>                  }
>  
> +                if let Some(zone) = zone {
> +                    fabric_section.properties.zone = Some(zone);
> +                }
> +
>                  if let Some(bfd) = bfd {
>                      fabric_section.properties.bfd = bfd;
>                  }
> @@ -1145,6 +1164,9 @@ impl FabricConfig {
>                          FabricDeletableProperties::Ip6Prefix => {
>                              fabric_section.ip6_prefix = None;
>                          }
> +                        FabricDeletableProperties::Protocol(BgpDeletableProperties::Zone) => {
> +                            fabric_section.properties.zone = None;
> +                        }
>                          FabricDeletableProperties::Protocol(
>                              BgpDeletableProperties::Redistribute,
>                          ) => {
> diff --git a/proxmox-ve-config/src/sdn/fabric/section_config/fabric.rs b/proxmox-ve-config/src/sdn/fabric/section_config/fabric.rs
> index 7e39e46a9341..a17bc8fd7cb2 100644
> --- a/proxmox-ve-config/src/sdn/fabric/section_config/fabric.rs
> +++ b/proxmox-ve-config/src/sdn/fabric/section_config/fabric.rs
> @@ -41,6 +41,24 @@ api_string_type! {
>  proxmox_serde::forward_serialize_to_display!(FabricId);
>  proxmox_serde::forward_deserialize_to_from_str!(FabricId);
>  
> +pub const ZONE_ID_REGEX_STR: &str = r"(?:[a-zA-Z])(?:[a-zA-Z0-9]){0,7}";
> +
> +const_regex! {
> +    pub ZONE_ID_REGEX = concatcp!(r"^", ZONE_ID_REGEX_STR, r"$");
> +}
> +
> +pub const ZONE_ID_FORMAT: ApiStringFormat = ApiStringFormat::Pattern(&ZONE_ID_REGEX);
> +
> +api_string_type! {
> +    /// ID of the SDN zone providing a VRF for a fabric.
> +    #[api(format: &ZONE_ID_FORMAT)]
> +    #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, UpdaterType)]
> +    pub struct ZoneId(String);
> +}
> +
> +proxmox_serde::forward_serialize_to_display!(ZoneId);
> +proxmox_serde::forward_deserialize_to_from_str!(ZoneId);
> +
>  /// A fabric section in an SDN fabric config.
>  ///
>  /// This struct contains all the properties that are required for any fabric, regardless of
> @@ -203,6 +221,15 @@ impl Fabric {
>          }
>      }
>  
> +    /// Get the SDN zone whose VRF contains this fabric.
> +    pub fn zone(&self) -> Option<&ZoneId> {
> +        match self {
> +            Fabric::Ospf(fabric_section) => fabric_section.properties().zone(),
> +            Fabric::Bgp(fabric_section) => fabric_section.properties().zone(),
> +            Fabric::Openfabric(_) | Fabric::WireGuard(_) => None,
> +        }
> +    }
> +
>      /// Get the ip-prefix (IPv4 CIDR) of the [`Fabric`].
>      ///
>      /// This is a common property for all protocols.
> @@ -260,7 +287,7 @@ impl Validatable for Fabric {
>          match self {
>              Fabric::Openfabric(fabric_section) => fabric_section.validate(),
>              Fabric::Ospf(fabric_section) => fabric_section.validate(),
> -            Fabric::WireGuard(_fabric_section) => Ok(()),
> +            Fabric::WireGuard(_) => Ok(()),
>              Fabric::Bgp(fabric_section) => fabric_section.validate(),
>          }
>      }
> diff --git a/proxmox-ve-config/src/sdn/fabric/section_config/protocol/bgp.rs b/proxmox-ve-config/src/sdn/fabric/section_config/protocol/bgp.rs
> index 9623730ab97d..3d300ff328a9 100644
> --- a/proxmox-ve-config/src/sdn/fabric/section_config/protocol/bgp.rs
> +++ b/proxmox-ve-config/src/sdn/fabric/section_config/protocol/bgp.rs
> @@ -11,7 +11,7 @@ use proxmox_schema::{ApiStringFormat, Updater, api, property_string::PropertyStr
>  
>  use crate::common::valid::Validatable;
>  use crate::sdn::fabric::FabricConfigError;
> -use crate::sdn::fabric::section_config::fabric::FabricSection;
> +use crate::sdn::fabric::section_config::fabric::{FabricSection, ZoneId};
>  use crate::sdn::fabric::section_config::interface::InterfaceName;
>  use crate::sdn::fabric::section_config::node::NodeSection;
>  
> @@ -94,6 +94,10 @@ impl ASN {
>  #[derive(Debug, Clone, Serialize, Deserialize, Updater, Hash)]
>  /// Properties for a BGP fabric.
>  pub struct BgpProperties {
> +    /// SDN zone whose VRF contains this fabric.
> +    #[serde(skip_serializing_if = "Option::is_none")]
> +    pub(crate) zone: Option<ZoneId>,
> +
>      /// enable BFD for this fabric
>      #[serde(default, deserialize_with = "proxmox_serde::perl::deserialize_bool")]
>      pub(crate) bfd: bool,
> @@ -119,6 +123,10 @@ pub struct BgpProperties {
>  }
>  
>  impl BgpProperties {
> +    pub fn zone(&self) -> Option<&ZoneId> {
> +        self.zone.as_ref()
> +    }
> +
>      pub fn bfd(&self) -> bool {
>          self.bfd
>      }
> @@ -140,6 +148,7 @@ impl Validatable for FabricSection<BgpProperties> {
>  #[derive(Debug, Clone, Serialize, Deserialize)]
>  #[serde(rename_all = "snake_case")]
>  pub enum BgpDeletableProperties {
> +    Zone,
>      Redistribute,
>      RouteFilter,
>      RouteMapIn,
> diff --git a/proxmox-ve-config/src/sdn/fabric/section_config/protocol/ospf.rs b/proxmox-ve-config/src/sdn/fabric/section_config/protocol/ospf.rs
> index 26be07546964..0c84adb5b732 100644
> --- a/proxmox-ve-config/src/sdn/fabric/section_config/protocol/ospf.rs
> +++ b/proxmox-ve-config/src/sdn/fabric/section_config/protocol/ospf.rs
> @@ -10,7 +10,7 @@ use proxmox_schema::{ApiStringFormat, Updater, api, property_string::PropertyStr
>  
>  use crate::common::valid::Validatable;
>  use crate::sdn::fabric::FabricConfigError;
> -use crate::sdn::fabric::section_config::fabric::FabricSection;
> +use crate::sdn::fabric::section_config::fabric::{FabricSection, ZoneId};
>  use crate::sdn::fabric::section_config::interface::InterfaceName;
>  use crate::sdn::fabric::section_config::node::NodeSection;
>  
> @@ -99,6 +99,10 @@ mod frr {
>  #[derive(Debug, Clone, Serialize, Deserialize, Updater, Hash)]
>  /// Properties for an Ospf fabric.
>  pub struct OspfProperties {
> +    /// SDN zone whose VRF contains this fabric.
> +    #[serde(skip_serializing_if = "Option::is_none")]
> +    pub(crate) zone: Option<ZoneId>,
> +
>      /// OSPF area
>      pub(crate) area: Area,
>  
> @@ -115,6 +119,10 @@ pub struct OspfProperties {
>  }
>  
>  impl OspfProperties {
> +    pub fn zone(&self) -> Option<&ZoneId> {
> +        self.zone.as_ref()
> +    }
> +
>      pub fn set_area(&mut self, value: Area) {
>          self.area = value;
>      }
> @@ -151,6 +159,7 @@ impl Validatable for FabricSection<OspfProperties> {
>  #[derive(Debug, Clone, Serialize, Deserialize)]
>  #[serde(rename_all = "snake_case")]
>  pub enum OspfDeletableProperties {
> +    Zone,
>      RouteFilter,
>      Redistribute,
>  }
> diff --git a/proxmox-ve-config/tests/fabric/main.rs b/proxmox-ve-config/tests/fabric/main.rs
> index ee59e9a2ea44..aa76adb9819f 100644
> --- a/proxmox-ve-config/tests/fabric/main.rs
> +++ b/proxmox-ve-config/tests/fabric/main.rs
> @@ -5,7 +5,12 @@ use std::str::FromStr;
>  use proxmox_frr::ser::bgp::{AddressFamilies, BgpRouter, CommonAddressFamilyOptions, L2vpnEvpnAF};
>  use proxmox_frr::ser::{FrrConfig, VrfName, serializer::dump};
>  use proxmox_ve_config::sdn::fabric::{
> -    FabricConfig, frr::build_fabric, section_config::node::NodeId,
> +    FabricConfig,
> +    frr::build_fabric,
> +    section_config::{
> +        fabric::{FabricId, FabricUpdater},
> +        node::NodeId,
> +    },
>  };
>  
>  mod helper;
> @@ -165,6 +170,84 @@ fn openfabric_ipv6_only() {
>      insta::assert_snapshot!(helper::reference_name!("pve"), output);
>  }
>  
> +#[test]
> +fn vrf_prefix_overlap_is_scoped_by_zone() {
> +    let raw = r#"
> +ospf_fabric: first
> +        area 0
> +        ip_prefix 10.0.0.0/24
> +        zone zoneone
> +
> +ospf_fabric: second
> +        area 1
> +        ip_prefix 10.0.0.0/24
> +        zone zonetwo
> +
> +ospf_node: first_pve
> +        interfaces name=eth0
> +        ip 10.0.0.1
> +
> +ospf_node: second_pve
> +        interfaces name=eth1
> +        ip 10.0.0.1
> +"#;
> +
> +    assert!(FabricConfig::parse_section_config(raw).is_ok());
> +    assert!(
> +        FabricConfig::parse_section_config(&raw.replace("zone zonetwo", "zone zoneone")).is_err()
> +    );
> +}
> +
> +#[test]
> +fn update_protocol_zone() {
> +    for (protocol, raw) in [
> +        (
> +            "ospf",
> +            r#"
> +ospf_fabric: test
> +        area 0
> +        ip_prefix 10.0.0.0/24
> +"#,
> +        ),
> +        (
> +            "bgp",
> +            r#"
> +bgp_fabric: test
> +        bfd 0
> +        ip_prefix 10.0.0.0/24
> +"#,
> +        ),
> +    ] {
> +        let mut config = FabricConfig::parse_section_config(raw)
> +            .unwrap()
> +            .into_inner();
> +        let updater: FabricUpdater =
> +            serde_json::from_value(serde_json::json!({ "protocol": protocol, "zone": "myzone" }))
> +                .unwrap();
> +        let id = FabricId::from_str("test").unwrap();
> +
> +        config.update_fabric(&id, updater).unwrap();
> +        assert_eq!(
> +            config
> +                .get_fabric(&id)
> +                .unwrap()
> +                .fabric()
> +                .zone()
> +                .unwrap()
> +                .as_str(),
> +            "myzone"
> +        );
> +
> +        let updater: FabricUpdater = serde_json::from_value(serde_json::json!({
> +            "protocol": protocol,
> +            "delete": ["zone"],
> +        }))
> +        .unwrap();
> +        config.update_fabric(&id, updater).unwrap();
> +        assert!(config.get_fabric(&id).unwrap().fabric().zone().is_none());
> +    }
> +}
> +
>  #[test]
>  fn bgp_default() {
>      let config = FabricConfig::parse_section_config(helper::get_fabrics_config!()).unwrap();





^ permalink raw reply	[flat|nested] 65+ messages in thread

* Re: [PATCH pve-common v3 01/32] interfaces: preserve VRF membership across address family changes
  2026-11-16 16:11 ` [PATCH pve-common v3 01/32] interfaces: preserve VRF membership across address family changes Gabriel Goller
@ 2026-11-18 14:13   ` Stefan Hanreich
  2026-11-18 15:41     ` Gabriel Goller
  0 siblings, 1 reply; 65+ messages in thread
From: Stefan Hanreich @ 2026-11-18 14:13 UTC (permalink / raw)
  To: pve-devel

Can we additionally deny VRF for all OVS types for now?
We should also check if an interface is part of a fabric?

On 11/16/26 5:12 PM, Gabriel Goller wrote:
> Store VRF membership as an interface option, not an address family
> option. Otherwise, switching from IPv4 to IPv6-only can drop the VRF
> assignment when the IPv4 stanza is removed.
> 
> Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
> ---
>  src/PVE/Network/Interfaces.pm | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/src/PVE/Network/Interfaces.pm b/src/PVE/Network/Interfaces.pm
> index 8aed1ab3c473..bfaab278d556 100644
> --- a/src/PVE/Network/Interfaces.pm
> +++ b/src/PVE/Network/Interfaces.pm
> @@ -134,7 +134,7 @@ my $check_mtu = sub($ifaces, $parent, $child) {
>  #       gateway6 => IP,
>  #       comments6 => [ "..." ],
>  #
> -#       <known options>, # like bridge_ports, ovs_*
> +#       <known options>, # interface-wide (shared by inet/inet6): bridge_ports, ovs_*, vrf
>  #
>  #       # extra/unknown options stored by-family:
>  #       options => { <inet options>... }
> @@ -226,6 +226,7 @@ sub __read_etc_network_interfaces($fh, $ip_links = undef, $active_ifaces = undef
>  
>                      my $simple_options = {
>                          'mtu' => 1,
> +                        'vrf' => 1,
>                          'ovs_type' => 1,
>                          'ovs_options' => 1,
>                          'ovs_bridge' => 1,
> @@ -904,6 +905,7 @@ sub __write_etc_network_interfaces($config, $ifupdown2 = undef) {
>              $n->{autostart} = 1;
>  
>              die "bond '$iface' - unable to find slave '$p'\n" if !$n;
> +            die "bond '$iface' - slave '$p' cannot have a VRF master\n" if $n->{vrf};
>              die
>                  "bond '$iface' - wrong interface type on slave '$p' ('$n->{type}' != 'eth or bond')\n"
>                  if ($n->{type} ne 'eth' && $n->{type} ne 'bond');
> @@ -1027,6 +1029,7 @@ sub __write_etc_network_interfaces($config, $ifupdown2 = undef) {
>                  }
>                  my $n = $ifaces_copy->{$p};
>                  die "bridge '$iface' - unable to find bridge port '$p'\n" if !$n;
> +                die "bridge '$iface' - port '$p' cannot have a VRF master\n" if $n->{vrf};
>                  die "iface $p - ip address can't be set on interface if bridged in $iface\n"
>                      if ($n->{method} && $n->{method} eq 'static' && $n->{address} ne '0.0.0.0')
>                      || ($n->{method6} && $n->{method6} eq 'static' && $n->{address6} ne '::');





^ permalink raw reply	[flat|nested] 65+ messages in thread

* Re: [PATCH proxmox-ve-rs v3 02/32] frr: add VRF-aware OSPF rendering
  2026-11-16 16:11 ` [PATCH proxmox-ve-rs v3 02/32] frr: add VRF-aware OSPF rendering Gabriel Goller
@ 2026-11-18 14:41   ` Stefan Hanreich
  2026-11-18 16:21     ` Gabriel Goller
  0 siblings, 1 reply; 65+ messages in thread
From: Stefan Hanreich @ 2026-11-18 14:41 UTC (permalink / raw)
  To: pve-devel

On 11/16/26 5:12 PM, Gabriel Goller wrote:
> Add an optional VRF name and render it in the FRR interface declaration.
> Keep OSPF router configuration for custom VRFs separately from the
> router in the default routing table (like we do with BGP).
> 
> Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
> ---
>  proxmox-frr-templates/templates/fabricd.jinja   |  2 +-
>  proxmox-frr-templates/templates/interface.jinja |  6 +++++-
>  proxmox-frr-templates/templates/isisd.jinja     |  2 +-
>  proxmox-frr-templates/templates/ospfd.jinja     | 12 +++++++++++-
>  proxmox-frr/src/ser/mod.rs                      |  6 ++++++
>  5 files changed, 24 insertions(+), 4 deletions(-)
> 
> diff --git a/proxmox-frr-templates/templates/fabricd.jinja b/proxmox-frr-templates/templates/fabricd.jinja
> index 068959a97e0e..04283180679e 100644
> --- a/proxmox-frr-templates/templates/fabricd.jinja
> +++ b/proxmox-frr-templates/templates/fabricd.jinja
> @@ -6,7 +6,7 @@ router openfabric {{ router_name }}
>  exit
>  {% endfor %}
>  {% for interface_name, interface_config in openfabric.interfaces|items %}
> -{% call interface(interface_name, interface_config.addresses_v4, interface_config.addresses_v6) %}
> +{% call interface(interface_name, interface_config.addresses_v4, interface_config.addresses_v6, interface_config.vrf) %}
>  {% if interface_config.fabric_id and interface_config.is_ipv4 %}
>   ip router openfabric {{ interface_config.fabric_id }}
>  {% endif %}
> diff --git a/proxmox-frr-templates/templates/interface.jinja b/proxmox-frr-templates/templates/interface.jinja
> index 4c5014844fc8..e52b05681bb8 100644
> --- a/proxmox-frr-templates/templates/interface.jinja
> +++ b/proxmox-frr-templates/templates/interface.jinja
> @@ -1,6 +1,10 @@
> -{% macro interface(name, addresses_v4, addresses_v6) %}
> +{% macro interface(name, addresses_v4, addresses_v6, vrf) %}
>  !
> +{% if vrf %}
> +interface {{ name }} vrf {{ vrf }}
> +{% else %}
>  interface {{ name }}
> +{% endif %}
>  {% for address in addresses_v6 %}
>   ipv6 address {{address}}
>  {% endfor %}
> diff --git a/proxmox-frr-templates/templates/isisd.jinja b/proxmox-frr-templates/templates/isisd.jinja
> index e3c9292d575c..2d369d75eee6 100644
> --- a/proxmox-frr-templates/templates/isisd.jinja
> +++ b/proxmox-frr-templates/templates/isisd.jinja
> @@ -20,7 +20,7 @@ router isis {{ router_name }}
>  exit
>  {% endfor %}
>  {% for interface_name, interface_config in isis.interfaces|items %}
> -{% call interface(interface_name, interface_config.addresses_v4, interface_config.addresses_v6) %}
> +{% call interface(interface_name, interface_config.addresses_v4, interface_config.addresses_v6, interface_config.vrf) %}
>  {% if interface_config.domain and interface_config.is_ipv4 %}
>   ip router isis {{ interface_config.domain }}
>  {% endif %}
> diff --git a/proxmox-frr-templates/templates/ospfd.jinja b/proxmox-frr-templates/templates/ospfd.jinja
> index 427ed7f9ddb4..5d440f2ff663 100644
> --- a/proxmox-frr-templates/templates/ospfd.jinja
> +++ b/proxmox-frr-templates/templates/ospfd.jinja
> @@ -9,8 +9,18 @@ router ospf
>  {% endfor %}
>  exit
>  {% endif %}
> +{% for vrf_name, router in ospf.vrf_router|items %}
> +!
> +router ospf vrf {{ vrf_name }}
> + ospf router-id {{ router.router_id }}
> +{% for redistribution in router.redistribute %}
> + redistribute {{ redistribution.source }}{% if redistribution.metric is defined %} metric {{ redistribution.metric }}{% endif %}{% if redistribution.route_map is defined %} route-map {{ redistribution.route_map }}{% endif %}
> +
> +{% endfor %}
> +exit
> +{% endfor %}
>  {% for interface_name, interface_config in ospf.interfaces|items %}
> -{% call interface(interface_name, interface_config.addresses_v4, interface_config.addresses_v6) %}
> +{% call interface(interface_name, interface_config.addresses_v4, interface_config.addresses_v6, interface_config.vrf) %}
>   ip ospf area {{ interface_config.area }}
>  {% if interface_config.passive %}
>   ip ospf passive
> diff --git a/proxmox-frr/src/ser/mod.rs b/proxmox-frr/src/ser/mod.rs
> index 0f2b52138cf3..cd3025213fb9 100644
> --- a/proxmox-frr/src/ser/mod.rs
> +++ b/proxmox-frr/src/ser/mod.rs
> @@ -135,6 +135,8 @@ pub struct Interface<T> {
>      pub addresses_v4: Vec<Ipv4Cidr>,
>      #[serde(default)]
>      pub addresses_v6: Vec<Ipv6Cidr>,
> +    #[serde(default)]
> +    pub vrf: Option<VrfName>,

would it be better to add this to the concrete interface types that actually support it?

>  
>      #[serde(flatten)]
>      pub properties: T,
> @@ -144,6 +146,7 @@ impl From<openfabric::OpenfabricInterface> for Interface<openfabric::OpenfabricI
>          Interface {
>              addresses_v4: Vec::new(),
>              addresses_v6: Vec::new(),
> +            vrf: None,

instead of setting it to None for protocols where it isn't supported?

>              properties: value,
>          }
>      }
> @@ -154,6 +157,7 @@ impl From<ospf::OspfInterface> for Interface<ospf::OspfInterface> {
>          Interface {
>              addresses_v4: Vec::new(),
>              addresses_v6: Vec::new(),
> +            vrf: None,
>              properties: value,
>          }
>      }
> @@ -248,6 +252,8 @@ pub struct OspfFrrConfig {
>      #[serde(default)]
>      pub router: Option<ospf::OspfRouter>,
>      #[serde(default)]
> +    pub vrf_router: BTreeMap<VrfName, ospf::OspfRouter>,

can we handle this the same as in BGP where the default VRF is just an entry in the map?

> +    #[serde(default)]
>      pub interfaces: BTreeMap<InterfaceName, Interface<ospf::OspfInterface>>,
>  }
>  





^ permalink raw reply	[flat|nested] 65+ messages in thread

* Re: [PATCH proxmox-ve-rs v3 04/32] sdn: generate fabric routing configuration in zone VRFs
  2026-11-16 16:11 ` [PATCH proxmox-ve-rs v3 04/32] sdn: generate fabric routing configuration in zone VRFs Gabriel Goller
@ 2026-11-18 14:53   ` Stefan Hanreich
  2026-11-18 17:26     ` Gabriel Goller
  0 siblings, 1 reply; 65+ messages in thread
From: Stefan Hanreich @ 2026-11-18 14:53 UTC (permalink / raw)
  To: pve-devel

On 11/16/26 5:12 PM, Gabriel Goller wrote:
> Map a fabric zone to the corresponding vrf_<zone> FRR instance. Generate
> OSPF routers and interfaces in that VRF, and store BGP routers under the
> same VRF name. Keep fabrics without a zone in the default routing table.
> 
> Collect OSPF redistribution rules on the router for the selected VRF so
> that several fabrics in one VRF contribute to the same OSPF instance.

should we just disallow multiple fabrics in the same zone (except default)
for now? Save us a lot of hassle and complexity, and could be introduced
later if so desired?




^ permalink raw reply	[flat|nested] 65+ messages in thread

* Re: [PATCH proxmox-ve-rs v3 06/32] tests: fabrics: add test for fabrics in VRFs
  2026-11-16 16:11 ` [PATCH proxmox-ve-rs v3 06/32] tests: fabrics: add test for fabrics in VRFs Gabriel Goller
@ 2026-11-18 15:01   ` Stefan Hanreich
  2026-11-18 17:33     ` Gabriel Goller
  0 siblings, 1 reply; 65+ messages in thread
From: Stefan Hanreich @ 2026-11-18 15:01 UTC (permalink / raw)
  To: pve-devel

I can think of a few additional scenarios worth testing:

* add a fabric in the default VRF
* redistributions
* route filters enabled
* IPv6

On 11/16/26 5:13 PM, Gabriel Goller wrote:
> Add an integration test covering OSPF and BGP fabrics assigned to
> multiple SDN zone VRFs.
> 
> Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
> ---
>  .../tests/fabric/cfg/vrf/fabrics.cfg          |  43 ++++++
>  .../tests/fabric/cfg/vrf/route-maps.cfg       |  15 ++
>  proxmox-ve-config/tests/fabric/helper.rs      |  20 +++
>  proxmox-ve-config/tests/fabric/main.rs        | 115 +++++++++++++--
>  .../fabric/snapshots/fabric__vrf_pve.snap     | 134 ++++++++++++++++++
>  5 files changed, 314 insertions(+), 13 deletions(-)
>  create mode 100644 proxmox-ve-config/tests/fabric/cfg/vrf/fabrics.cfg
>  create mode 100644 proxmox-ve-config/tests/fabric/cfg/vrf/route-maps.cfg
>  create mode 100644 proxmox-ve-config/tests/fabric/snapshots/fabric__vrf_pve.snap
> 
> diff --git a/proxmox-ve-config/tests/fabric/cfg/vrf/fabrics.cfg b/proxmox-ve-config/tests/fabric/cfg/vrf/fabrics.cfg
> new file mode 100644
> index 000000000000..05a1cb57642a
> --- /dev/null
> +++ b/proxmox-ve-config/tests/fabric/cfg/vrf/fabrics.cfg
> @@ -0,0 +1,43 @@
> +ospf_fabric: ospfred
> +        area 0
> +        ip_prefix 10.0.0.0/24
> +        zone red
> +
> +ospf_fabric: ospfblue
> +        area 0
> +        ip_prefix 10.0.0.0/24
> +        zone blue
> +
> +ospf_node: ospfred_pve
> +        interfaces name=ens18
> +        ip 10.0.0.1
> +
> +ospf_node: ospfblue_pve
> +        interfaces name=ens19
> +        ip 10.0.0.1
> +
> +bgp_fabric: bgpred
> +        bfd 0
> +        ip_prefix 10.1.0.0/24
> +        route_map_in red-in
> +        route_map_out red-out
> +        zone red
> +
> +bgp_fabric: bgpblue
> +        bfd 0
> +        ip_prefix 10.1.0.0/24
> +        route_map_in blue-in
> +        route_map_out blue-out
> +        zone blue
> +
> +bgp_node: bgpred_pve
> +        asn 65001
> +        interfaces name=ens20
> +        ip 10.1.0.1
> +        role internal
> +
> +bgp_node: bgpblue_pve
> +        asn 65002
> +        interfaces name=ens21
> +        ip 10.1.0.1
> +        role internal
> diff --git a/proxmox-ve-config/tests/fabric/cfg/vrf/route-maps.cfg b/proxmox-ve-config/tests/fabric/cfg/vrf/route-maps.cfg
> new file mode 100644
> index 000000000000..b382fc369b51
> --- /dev/null
> +++ b/proxmox-ve-config/tests/fabric/cfg/vrf/route-maps.cfg
> @@ -0,0 +1,15 @@
> +route-map-entry: blue-in_10
> +        action permit
> +        set key=local-preference,value=200
> +
> +route-map-entry: blue-out_10
> +        action permit
> +        set key=metric,value=20
> +
> +route-map-entry: red-in_10
> +        action permit
> +        set key=local-preference,value=100
> +
> +route-map-entry: red-out_10
> +        action permit
> +        set key=metric,value=10
> diff --git a/proxmox-ve-config/tests/fabric/helper.rs b/proxmox-ve-config/tests/fabric/helper.rs
> index 93404b8eb7af..ec464d334a4c 100644
> --- a/proxmox-ve-config/tests/fabric/helper.rs
> +++ b/proxmox-ve-config/tests/fabric/helper.rs
> @@ -18,6 +18,24 @@ macro_rules! get_fabrics_config {
>      }};
>  }
>  
> +#[allow(unused_macros)]
> +macro_rules! get_route_maps_config {
> +    () => {{
> +        fn f() {}
> +        fn type_name_of<T>(_: T) -> &'static str {
> +            std::any::type_name::<T>()
> +        }
> +        let mut name = type_name_of(f);
> +
> +        name = match &name[..name.len() - 3].rfind(':') {
> +            Some(pos) => &name[pos + 1..name.len() - 3],
> +            None => &name[..name.len() - 3],
> +        };
> +        let real_filename = format!("tests/fabric/cfg/{name}/route-maps.cfg");
> +        &std::fs::read_to_string(real_filename).expect("cannot find route-map config file")
> +    }};
> +}
> +
>  #[allow(unused_macros)]
>  macro_rules! reference_name {
>      ($suffix:expr) => {{
> @@ -40,4 +58,6 @@ macro_rules! reference_name {
>  #[allow(unused_imports)]
>  pub(crate) use get_fabrics_config;
>  #[allow(unused_imports)]
> +pub(crate) use get_route_maps_config;
> +#[allow(unused_imports)]
>  pub(crate) use reference_name;
> diff --git a/proxmox-ve-config/tests/fabric/main.rs b/proxmox-ve-config/tests/fabric/main.rs
> index 05210000adf5..de83eb3425a7 100644
> --- a/proxmox-ve-config/tests/fabric/main.rs
> +++ b/proxmox-ve-config/tests/fabric/main.rs
> @@ -3,15 +3,21 @@ use std::net::Ipv4Addr;
>  use std::str::FromStr;
>  
>  use proxmox_frr::ser::bgp::{AddressFamilies, BgpRouter, CommonAddressFamilyOptions, L2vpnEvpnAF};
> -use proxmox_frr::ser::route_map::RouteMapName;
> -use proxmox_frr::ser::{FrrConfig, FrrProtocol, FrrWord, VrfName, serializer::dump};
> -use proxmox_ve_config::sdn::fabric::{
> -    FabricConfig,
> -    frr::build_fabric,
> -    section_config::{
> -        fabric::{FabricId, FabricUpdater},
> -        node::NodeId,
> +use proxmox_frr::ser::route_map::{AccessAction, RouteMapEntry, RouteMapName};
> +use proxmox_frr::ser::{
> +    FrrConfig, FrrProtocol, FrrWord, IpProtocolRouteMap, VrfName, serializer::dump,
> +};
> +use proxmox_section_config::typed::ApiSectionDataEntry;
> +use proxmox_ve_config::sdn::{
> +    fabric::{
> +        FabricConfig,
> +        frr::build_fabric,
> +        section_config::{
> +            fabric::{FabricId, FabricUpdater},
> +            node::NodeId,
> +        },
>      },
> +    route_map::{RouteMap, frr::build_frr_route_maps},
>  };
>  
>  mod helper;
> @@ -274,9 +280,31 @@ bgp_node: bgp_pve
>  "#;
>      let config = FabricConfig::parse_section_config(raw).unwrap();
>      let mut frr_config = FrrConfig::default();
> +    let correct_src = RouteMapName::new("correct_src").unwrap();
> +    let correct_src_entry = RouteMapEntry {
> +        seq: 1,
> +        action: AccessAction::Permit,
> +        matches: Vec::new(),
> +        sets: Vec::new(),
> +        custom_frr_config: Vec::new(),
> +        call: None,
> +        exit_action: None,
> +    };
> +    frr_config
> +        .routemaps
> +        .insert(correct_src.clone(), vec![correct_src_entry.clone()]);
> +    frr_config.protocol_routemaps.insert(
> +        FrrProtocol::Bgp,
> +        IpProtocolRouteMap {
> +            v4: Some(correct_src.clone()),
> +            v6: None,
> +        },
> +    );
>  
>      build_fabric(NodeId::from_str("pve").unwrap(), config, &mut frr_config).unwrap();
>  
> +    assert_eq!(frr_config.routemaps[&correct_src], vec![correct_src_entry]);
> +
>      let ospf_routemap = &frr_config.vrf_protocol_routemaps
>          [&VrfName::Custom(FrrWord::new("vrf_zoneone").unwrap())][&FrrProtocol::Ospf];
>      assert_eq!(
> @@ -295,14 +323,75 @@ bgp_node: bgp_pve
>              .get(&FrrProtocol::Ospf)
>              .is_none()
>      );
> -    assert!(
> -        frr_config
> -            .protocol_routemaps
> -            .get(&FrrProtocol::Bgp)
> -            .is_none()
> +    assert_eq!(
> +        frr_config.protocol_routemaps[&FrrProtocol::Bgp].v4,
> +        Some(correct_src)
>      );
>  }
>  
> +#[test]
> +fn ospf_router_id_is_selected_per_vrf() {
> +    let raw = r#"
> +ospf_fabric: red
> +        area 0
> +        ip_prefix 10.0.0.0/24
> +        zone red
> +
> +ospf_node: red_pve
> +        interfaces name=eth0
> +        ip 10.0.0.1
> +
> +ospf_fabric: blue
> +        area 0
> +        ip_prefix 10.0.0.0/24
> +        zone blue
> +
> +ospf_node: blue_pve
> +        interfaces name=eth1
> +        ip 10.0.0.2
> +
> +ospf_node: blue_pve2
> +        interfaces name=eth1
> +        ip 10.0.0.1
> +"#;
> +    let config = FabricConfig::parse_section_config(raw).unwrap();
> +    let mut frr_config = FrrConfig::default();
> +
> +    build_fabric(NodeId::from_str("pve").unwrap(), config, &mut frr_config).unwrap();
> +
> +    let router_id = |vrf: &str| {
> +        frr_config.ospf.vrf_router[&VrfName::Custom(FrrWord::new(vrf).unwrap())].router_id
> +    };
> +    assert_eq!(router_id("vrf_red"), Ipv4Addr::new(10, 0, 0, 1));
> +    assert_eq!(router_id("vrf_blue"), Ipv4Addr::new(10, 0, 0, 2));
> +}
> +
> +#[test]
> +fn vrf() {
> +    let config = FabricConfig::parse_section_config(helper::get_fabrics_config!()).unwrap();
> +    let route_maps =
> +        RouteMap::parse_section_config("route-maps.cfg", helper::get_route_maps_config!()).unwrap();
> +    let mut frr_config = FrrConfig::default();
> +
> +    build_frr_route_maps(
> +        route_maps
> +            .into_iter()
> +            .map(|(_, route_map_entry)| route_map_entry),
> +        &mut frr_config,
> +    )
> +    .unwrap();
> +    build_fabric(
> +        NodeId::from_str("pve").expect("invalid nodeid"),
> +        config,
> +        &mut frr_config,
> +    )
> +    .unwrap();
> +
> +    let output = dump(&frr_config).expect("error dumping stuff");
> +
> +    insta::assert_snapshot!(helper::reference_name!("pve"), output);
> +}
> +
>  #[test]
>  fn bgp_default() {
>      let config = FabricConfig::parse_section_config(helper::get_fabrics_config!()).unwrap();
> diff --git a/proxmox-ve-config/tests/fabric/snapshots/fabric__vrf_pve.snap b/proxmox-ve-config/tests/fabric/snapshots/fabric__vrf_pve.snap
> new file mode 100644
> index 000000000000..84973240deb4
> --- /dev/null
> +++ b/proxmox-ve-config/tests/fabric/snapshots/fabric__vrf_pve.snap
> @@ -0,0 +1,134 @@
> +---
> +source: proxmox-ve-config/tests/fabric/main.rs
> +expression: output
> +---
> +!
> +router bgp 65002 vrf vrf_blue
> + bgp router-id 10.1.0.1
> + no bgp default ipv4-unicast
> + neighbor bgpblue peer-group
> + neighbor bgpblue remote-as external
> + neighbor ens21 interface peer-group bgpblue
> + !
> + address-family ipv4 unicast
> +  network 10.1.0.1/32
> +  neighbor bgpblue activate
> +  neighbor bgpblue soft-reconfiguration inbound
> +  neighbor bgpblue route-map pve_bgp_bgpblue_in in
> +  neighbor bgpblue route-map blue-out out
> + exit-address-family
> +exit
> +!
> +router bgp 65001 vrf vrf_red
> + bgp router-id 10.1.0.1
> + no bgp default ipv4-unicast
> + neighbor bgpred peer-group
> + neighbor bgpred remote-as external
> + neighbor ens20 interface peer-group bgpred
> + !
> + address-family ipv4 unicast
> +  network 10.1.0.1/32
> +  neighbor bgpred activate
> +  neighbor bgpred soft-reconfiguration inbound
> +  neighbor bgpred route-map pve_bgp_bgpred_in in
> +  neighbor bgpred route-map red-out out
> + exit-address-family
> +exit
> +!
> +router ospf vrf vrf_blue
> + ospf router-id 10.0.0.1
> +exit
> +!
> +router ospf vrf vrf_red
> + ospf router-id 10.0.0.1
> +exit
> +!
> +interface dummy_ospfblue vrf vrf_blue
> + ip ospf area 0
> + ip ospf passive
> +exit
> +!
> +interface dummy_ospfred vrf vrf_red
> + ip ospf area 0
> + ip ospf passive
> +exit
> +!
> +interface ens18 vrf vrf_red
> + ip ospf area 0
> + ip ospf network point-to-point
> +exit
> +!
> +interface ens19 vrf vrf_blue
> + ip ospf area 0
> + ip ospf network point-to-point
> +exit
> +!
> +access-list pve_bgp_bgpblue_ips permit 10.1.0.0/24
> +!
> +access-list pve_bgp_bgpred_ips permit 10.1.0.0/24
> +!
> +access-list pve_ospf_ospfblue_ips permit 10.0.0.0/24
> +!
> +access-list pve_ospf_ospfred_ips permit 10.0.0.0/24
> +!
> +route-map blue-in permit 10
> + set local-preference 200
> +exit
> +!
> +route-map blue-out permit 10
> + set metric 20
> +exit
> +!
> +route-map pve_bgp_bgpblue_in permit 10
> + match ip address pve_bgp_bgpblue_ips
> + call blue-in
> +exit
> +!
> +route-map pve_bgp_bgpred_in permit 10
> + match ip address pve_bgp_bgpred_ips
> + call red-in
> +exit
> +!
> +route-map pve_bgp_vrf_blue permit 100
> + match ip address pve_bgp_bgpblue_ips
> + set src 10.1.0.1
> +exit
> +!
> +route-map pve_bgp_vrf_blue permit 65535
> +exit
> +!
> +route-map pve_bgp_vrf_red permit 110
> + match ip address pve_bgp_bgpred_ips
> + set src 10.1.0.1
> +exit
> +!
> +route-map pve_bgp_vrf_red permit 65535
> +exit
> +!
> +route-map pve_ospf_vrf_blue permit 120
> + match ip address pve_ospf_ospfblue_ips
> + set src 10.0.0.1
> +exit
> +!
> +route-map pve_ospf_vrf_red permit 130
> + match ip address pve_ospf_ospfred_ips
> + set src 10.0.0.1
> +exit
> +!
> +route-map red-in permit 10
> + set local-preference 100
> +exit
> +!
> +route-map red-out permit 10
> + set metric 10
> +exit
> +!
> +vrf vrf_blue
> + ip protocol bgp route-map pve_bgp_vrf_blue
> + ip protocol ospf route-map pve_ospf_vrf_blue
> +exit-vrf
> +!
> +vrf vrf_red
> + ip protocol bgp route-map pve_bgp_vrf_red
> + ip protocol ospf route-map pve_ospf_vrf_red
> +exit-vrf





^ permalink raw reply	[flat|nested] 65+ messages in thread

* Re: [PATCH proxmox-ve-rs v3 07/32] sdn: allow static routes in simple zone VRFs
  2026-11-16 16:11 ` [PATCH proxmox-ve-rs v3 07/32] sdn: allow static routes in simple zone VRFs Gabriel Goller
@ 2026-11-18 15:29   ` Stefan Hanreich
  2026-11-18 18:10     ` Gabriel Goller
  0 siblings, 1 reply; 65+ messages in thread
From: Stefan Hanreich @ 2026-11-18 15:29 UTC (permalink / raw)
  To: pve-devel



On 11/16/26 5:16 PM, Gabriel Goller wrote:
> Allow simple zones to reach upstream networks through zone-wide static
> routes, without requiring node-local FRR overrides. Install routes in
> vrf_<zone> when dedicated-vrf is enabled, or in the default routing table
> otherwise. Only generate routes on nodes that belong to the zone.
> 
> Support IPv4 and IPv6 routes, with an optional outgoing interface,
> administrative distance and next-hop VRF. The next-hop VRF only selects
> where to resolve the gateway; the route still belongs to the zone.
> 
> Reject prefixes with host bits set, since staticd normalizes them and
> frr-reload would otherwise replace them on every reload. Keep the perl
> vrf field as the outgoing interface for existing EVPN routes, separate
> from the VRF in which the route is installed.

Can't we just normalize them ourselves before writing them out and then
accept anything with host bits set?

[...]

> +/// Routing-related properties of a single SDN zone.
> +#[derive(Clone, Debug, Deserialize)]
> +pub struct ZoneRoutes {
> +    #[serde(rename = "type")]
> +    pub ty: String,
> +    #[serde(
> +        default,
> +        rename = "dedicated-vrf",
> +        deserialize_with = "proxmox_serde::perl::deserialize_bool"
> +    )]
> +    pub dedicated_vrf: bool,
> +    pub nodes: Option<BTreeMap<String, serde_json::Value>>,
> +    #[serde(default)]
> +    pub route: Vec<PropertyString<StaticRoute>>,

We need to write this property canonicalized in Perl, as otherwise this can cause
deserialization issues with values the API accepts, as I've learned the hard way D:

> +}
> +
> +#[cfg(feature = "frr")]
> +impl ZoneRoutesConfig {
> +    /// Generate routes only on nodes participating in the zone.
> +    pub fn routes_for_node(&self, node: &str) -> Result<Vec<proxmox_frr::ser::IpRoute>, Error> {

can we skip invalid routes instead of erroring out here? It'd abort the whole FRR config
generation..

> +        use proxmox_frr::ser::{InterfaceName as FrrInterfaceName, IpOrInterface, IpRoute};
> +
> +        let to_frr = |name: &InterfaceName| FrrInterfaceName::try_from(name.as_str());
> +
> +        let mut routes = Vec::new();
> +        for (zone, config) in &self.ids {
> +            if config.route.is_empty() {
> +                continue;
> +            }
> +            if config.ty != "simple" {
> +                bail!("static routes are only supported in simple zones (zone '{zone}')");
> +            }
> +            if config
> +                .nodes
> +                .as_ref()
> +                .is_some_and(|nodes| !nodes.contains_key(node))
> +            {
> +                continue;
> +            }
> +            let destination_vrf = config
> +                .dedicated_vrf
> +                .then(|| FrrInterfaceName::try_from(format!("vrf_{zone}")))
> +                .transpose()?;
> +            for route in &config.route {
> +                route.validate()?;
> +                let mut frr_route = IpRoute::new(route.prefix, route.via.map(IpOrInterface::Ip));
> +                frr_route.iface = route.iface.as_ref().map(to_frr).transpose()?;
> +                frr_route.distance = route.distance;
> +                frr_route.nexthop_vrf = route.nexthop_vrf.as_ref().map(to_frr).transpose()?;
> +                frr_route.destination_vrf = destination_vrf.clone();
> +                routes.push(frr_route);
> +            }
> +        }
> +        Ok(routes)
> +    }
> +}




^ permalink raw reply	[flat|nested] 65+ messages in thread

* Re: [PATCH proxmox-ve-rs v3 08/32] sdn: support static routes in EVPN zone VRFs
  2026-11-16 16:11 ` [PATCH proxmox-ve-rs v3 08/32] sdn: support static routes in EVPN " Gabriel Goller
@ 2026-11-18 15:32   ` Stefan Hanreich
  2026-11-19 13:12     ` Gabriel Goller
  0 siblings, 1 reply; 65+ messages in thread
From: Stefan Hanreich @ 2026-11-18 15:32 UTC (permalink / raw)
  To: pve-devel

what could be an interesting option: create static routes only on exit nodes
as that'd have the use-case of creating routes to uplinks on exit nodes only,
whereas all other nodes have the exit-nodes as default route.

On 11/16/26 5:12 PM, Gabriel Goller wrote:
> Allow EVPN zones to reach networks behind appliances or external routers
> using the same zone-wide static routes as simple zones. EVPN routes
> always belong to vrf_<zone>, without requiring the dedicated-vrf option
> used by simple zones.
> 
> Generate routes on all nodes that belong to the zone, not just exit
> nodes. This does not enable redistribution of static routes, so adding
> a route does not by itself advertise it to other nodes.
> 
> Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
> ---
>  proxmox-ve-config/src/sdn/static_route.rs     | 11 +++--
>  proxmox-ve-config/tests/static_routes/main.rs | 40 ++++++++++++++++++-
>  ...tatic_routes__evpn_zone_routes_to_frr.snap | 12 ++++++
>  3 files changed, 56 insertions(+), 7 deletions(-)
>  create mode 100644 proxmox-ve-config/tests/static_routes/snapshots/static_routes__evpn_zone_routes_to_frr.snap
> 
> diff --git a/proxmox-ve-config/src/sdn/static_route.rs b/proxmox-ve-config/src/sdn/static_route.rs
> index eab6300374ff..0a5e0b3939f4 100644
> --- a/proxmox-ve-config/src/sdn/static_route.rs
> +++ b/proxmox-ve-config/src/sdn/static_route.rs
> @@ -1,4 +1,4 @@
> -//! Static routes stored as repeatable property strings in simple SDN zones.
> +//! Static routes stored as repeatable property strings in Simple and EVPN SDN zones.
>  
>  use std::collections::BTreeMap;
>  use std::net::IpAddr;
> @@ -22,7 +22,7 @@ use crate::sdn::fabric::section_config::interface::InterfaceName;
>  )]
>  #[derive(Clone, Debug, Serialize, Deserialize)]
>  #[serde(rename_all = "kebab-case", deny_unknown_fields)]
> -/// A static route in a simple zone. The destination VRF is determined by the zone.
> +/// A static route in a Simple or EVPN zone. The destination VRF is determined by the zone.
>  pub struct StaticRoute {
>      /// Destination prefix, including 0.0.0.0/0 or ::/0 for a default route.
>      pub prefix: Cidr,
> @@ -119,8 +119,8 @@ impl ZoneRoutesConfig {
>              if config.route.is_empty() {
>                  continue;
>              }
> -            if config.ty != "simple" {
> -                bail!("static routes are only supported in simple zones (zone '{zone}')");
> +            if !matches!(config.ty.as_str(), "simple" | "evpn") {
> +                bail!("static routes are only supported in Simple and EVPN zones (zone '{zone}')");
>              }
>              if config
>                  .nodes
> @@ -129,8 +129,7 @@ impl ZoneRoutesConfig {
>              {
>                  continue;
>              }
> -            let destination_vrf = config
> -                .dedicated_vrf
> +            let destination_vrf = (config.ty == "evpn" || config.dedicated_vrf)
>                  .then(|| FrrInterfaceName::try_from(format!("vrf_{zone}")))
>                  .transpose()?;
>              for route in &config.route {
> diff --git a/proxmox-ve-config/tests/static_routes/main.rs b/proxmox-ve-config/tests/static_routes/main.rs
> index a0daf38449ff..f198a3bf3353 100644
> --- a/proxmox-ve-config/tests/static_routes/main.rs
> +++ b/proxmox-ve-config/tests/static_routes/main.rs
> @@ -59,6 +59,44 @@ fn simple_zone_routes_to_frr() -> Result<(), Error> {
>      Ok(())
>  }
>  
> +#[test]
> +fn evpn_zone_routes_to_frr() -> Result<(), Error> {
> +    let zones: ZoneRoutesConfig = serde_json::from_value(json!({"ids": {
> +        "blue": {
> +            "type": "evpn",
> +            "nodes": {"pve1": 1, "pve2": 1},
> +            "exitnodes": {"pve1": 1},
> +            "route": [
> +                "prefix=0.0.0.0/0,via=10.10.0.2",
> +                "prefix=172.20.0.0/16,via=192.0.2.1,distance=200,nexthop-vrf=default",
> +                "prefix=::/0,via=fe80::1,iface=vnetblue",
> +                "prefix=198.51.100.0/24,iface=uplink0"
> +            ]
> +        },
> +        "disabled": {
> +            "type": "evpn",
> +            "nodes": {},
> +            "route": ["prefix=192.0.2.0/24,iface=unused0"]
> +        }
> +    }}))?;
> +    let config = FrrConfig {
> +        ip_routes: zones.routes_for_node("pve1")?,
> +        ..Default::default()
> +    };
> +    // EVPN always uses the zone VRF, without requiring the Simple-only dedicated-vrf flag.
> +    let output = dump(&config)?;
> +    insta::assert_snapshot!(output);
> +
> +    // Routes apply to every zone node, not just exit nodes. FRR resolves local interfaces.
> +    let other = FrrConfig {
> +        ip_routes: zones.routes_for_node("pve2")?,
> +        ..Default::default()
> +    };
> +    assert_eq!(dump(&other)?, output);
> +    assert!(zones.routes_for_node("pve3")?.is_empty());
> +    Ok(())
> +}
> +
>  #[test]
>  fn validate_route_properties() {
>      for value in [
> @@ -109,7 +147,7 @@ fn validate_route_properties() {
>  
>  #[test]
>  fn reject_routes_in_other_zone_types() -> Result<(), Error> {
> -    for ty in ["vlan", "qinq", "vxlan", "evpn", "faucet"] {
> +    for ty in ["vlan", "qinq", "vxlan", "faucet"] {
>          let zones: ZoneRoutesConfig = serde_json::from_value(json!({"ids": {
>              "zone1": {"type": ty, "route": ["prefix=0.0.0.0/0,via=192.0.2.1"]}
>          }}))?;
> diff --git a/proxmox-ve-config/tests/static_routes/snapshots/static_routes__evpn_zone_routes_to_frr.snap b/proxmox-ve-config/tests/static_routes/snapshots/static_routes__evpn_zone_routes_to_frr.snap
> new file mode 100644
> index 000000000000..0301559a6d77
> --- /dev/null
> +++ b/proxmox-ve-config/tests/static_routes/snapshots/static_routes__evpn_zone_routes_to_frr.snap
> @@ -0,0 +1,12 @@
> +---
> +source: proxmox-ve-config/tests/static_routes/main.rs
> +expression: output
> +---
> +!
> +ip route 0.0.0.0/0 10.10.0.2 vrf vrf_blue
> +!
> +ip route 172.20.0.0/16 192.0.2.1 200 nexthop-vrf default vrf vrf_blue
> +!
> +ipv6 route ::/0 fe80::1 vnetblue vrf vrf_blue
> +!
> +ip route 198.51.100.0/24 uplink0 vrf vrf_blue





^ permalink raw reply	[flat|nested] 65+ messages in thread

* Re: [PATCH pve-common v3 01/32] interfaces: preserve VRF membership across address family changes
  2026-11-18 14:13   ` Stefan Hanreich
@ 2026-11-18 15:41     ` Gabriel Goller
  0 siblings, 0 replies; 65+ messages in thread
From: Gabriel Goller @ 2026-11-18 15:41 UTC (permalink / raw)
  To: Stefan Hanreich; +Cc: pve-devel

On 18.11.2026 15:13, Stefan Hanreich wrote:
> Can we additionally deny VRF for all OVS types for now?

Done here in pve-common.

> We should also check if an interface is part of a fabric?

Also makes sense, done in pve-network on the api endpoint. We need to read/parse
the fabric config for this but oh well :(

> [snip]

Thanks for the review!




^ permalink raw reply	[flat|nested] 65+ messages in thread

* Re: [PATCH proxmox-perl-rs v3 10/32] pve-rs: fabrics: make per-fabric status queries VRF-aware
  2026-11-16 16:11 ` [PATCH proxmox-perl-rs v3 10/32] pve-rs: fabrics: make per-fabric status queries VRF-aware Gabriel Goller
@ 2026-11-18 15:42   ` Stefan Hanreich
  2026-11-19 13:30     ` Gabriel Goller
  0 siblings, 1 reply; 65+ messages in thread
From: Stefan Hanreich @ 2026-11-18 15:42 UTC (permalink / raw)
  To: pve-devel


On 11/16/26 5:13 PM, Gabriel Goller wrote:
> Use the fabric VRF in FRR route, neighbor, and interface queries for
> OSPF and BGP.
> 
> Keep the existing commands for fabrics in the default routing table.
> 
> Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
> ---
>  pve-rs/src/bindings/sdn/fabrics.rs | 63 +++++++++++++++++++-----------
>  1 file changed, 41 insertions(+), 22 deletions(-)
> 
> diff --git a/pve-rs/src/bindings/sdn/fabrics.rs b/pve-rs/src/bindings/sdn/fabrics.rs
> index b7c2d91e5471..381de692acfc 100644
> --- a/pve-rs/src/bindings/sdn/fabrics.rs
> +++ b/pve-rs/src/bindings/sdn/fabrics.rs
> @@ -841,6 +841,7 @@ pub mod pve_rs_sdn_fabrics {
>          };
>  
>          let fabric = config.get_fabric(&fabric_id)?;
> +        let vrf = fabric.fabric_vrf_name();
>          match fabric {
>              FabricEntry::Openfabric(_) => {
>                  let openfabric_ipv4_routes_string = String::from_utf8(
> @@ -878,12 +879,12 @@ pub mod pve_rs_sdn_fabrics {
>                  )
>              }
>              FabricEntry::Ospf(_) => {
> -                let ospf_routes_string = String::from_utf8(
> -                    Command::new("sh")
> -                        .args(["-c", "vtysh -c 'show ip route ospf json'"])
> -                        .output()?
> -                        .stdout,
> -                )?;
> +                let command = match &vrf {
> +                    Some(vrf) => format!("vtysh -c 'show ip route vrf {vrf} ospf json'"),

not a pressing issue as it inserts the zone name, but we really shouldn't interpolate this into
a string here, it's easily avoidable.

> +                    None => "vtysh -c 'show ip route ospf json'".to_string(),
> +                };
> +                let ospf_routes_string =
> +                    String::from_utf8(Command::new("sh").args(["-c", &command]).output()?.stdout)?;
>                  let ospf_routes: proxmox_frr::de::Routes = if ospf_routes_string.is_empty() {
>                      proxmox_frr::de::Routes::default()
>                  } else {
> @@ -895,10 +896,18 @@ pub mod pve_rs_sdn_fabrics {
>              }
>              FabricEntry::WireGuard(_) => Ok(Vec::new()),
>              FabricEntry::Bgp(_) => {
> +                let ipv4_command = match &vrf {
> +                    Some(vrf) => format!("vtysh -c 'show ip route vrf {vrf} bgp json'"),

and here

> +                    None => "vtysh -c 'show ip route bgp json'".to_string(),
> +                };
> +                let ipv6_command = match &vrf {
> +                    Some(vrf) => format!("vtysh -c 'show ipv6 route vrf {vrf} bgp json'"),

and here

> +                    None => "vtysh -c 'show ipv6 route bgp json'".to_string(),
> +                };
>                  let bgp_ipv4_routes_string = String::from_utf8(
>                      Command::new("sh")
>                          .env("VTYSH_HISTFILE", "/dev/null")
> -                        .args(["-c", "vtysh -c 'show ip route bgp json'"])
> +                        .args(["-c", &ipv4_command])
>                          .output()?
>                          .stdout,
>                  )?;
> @@ -906,7 +915,7 @@ pub mod pve_rs_sdn_fabrics {
>                  let bgp_ipv6_routes_string = String::from_utf8(
>                      Command::new("sh")
>                          .env("VTYSH_HISTFILE", "/dev/null")
> -                        .args(["-c", "vtysh -c 'show ipv6 route bgp json'"])
> +                        .args(["-c", &ipv6_command])
>                          .output()?
>                          .stdout,
>                  )?;
> @@ -941,6 +950,7 @@ pub mod pve_rs_sdn_fabrics {
>          };
>  
>          let fabric = config.get_fabric(&fabric_id)?;
> +        let vrf = fabric.fabric_vrf_name();
>  
>          match fabric {
>              FabricEntry::Openfabric(_) => {
> @@ -961,12 +971,12 @@ pub mod pve_rs_sdn_fabrics {
>                  status::get_neighbors_openfabric(fabric_id, openfabric_neighbors).map(|v| v.into())
>              }
>              FabricEntry::Ospf(fabric) => {
> -                let ospf_neighbors_string = String::from_utf8(
> -                    Command::new("sh")
> -                        .args(["-c", "vtysh -c 'show ip ospf neighbor json'"])
> -                        .output()?
> -                        .stdout,
> -                )?;
> +                let command = match &vrf {
> +                    Some(vrf) => format!("vtysh -c 'show ip ospf vrf {vrf} neighbor json'"),

and here

> +                    None => "vtysh -c 'show ip ospf neighbor json'".to_string(),
> +                };
> +                let ospf_neighbors_string =
> +                    String::from_utf8(Command::new("sh").args(["-c", &command]).output()?.stdout)?;
>                  let ospf_neighbors: proxmox_frr::de::ospf::Neighbors =
>                      if ospf_neighbors_string.is_empty() {
>                          proxmox_frr::de::ospf::Neighbors::default()
> @@ -985,10 +995,14 @@ pub mod pve_rs_sdn_fabrics {
>              }
>              FabricEntry::WireGuard(_) => Ok(status::NeighborStatus::WireGuard(Vec::new())),
>              FabricEntry::Bgp(_) => {
> +                let command = match &vrf {
> +                    Some(vrf) => format!("vtysh -c 'show bgp vrf {vrf} neighbors json'"),

and here

> +                    None => "vtysh -c 'show bgp neighbors json'".to_string(),
> +                };
>                  let bgp_neighbors_string = String::from_utf8(
>                      Command::new("sh")
>                          .env("VTYSH_HISTFILE", "/dev/null")
> -                        .args(["-c", "vtysh -c 'show bgp neighbors json'"])
> +                        .args(["-c", &command])
>                          .output()?
>                          .stdout,
>                  )?;
> @@ -1018,6 +1032,7 @@ pub mod pve_rs_sdn_fabrics {
>          };
>  
>          let fabric = config.get_fabric(&fabric_id)?;
> +        let vrf = fabric.fabric_vrf_name();
>  
>          match fabric {
>              FabricEntry::Openfabric(_) => {
> @@ -1039,12 +1054,12 @@ pub mod pve_rs_sdn_fabrics {
>                      .map(|v| v.into())
>              }
>              FabricEntry::Ospf(fabric) => {
> -                let ospf_interfaces_string = String::from_utf8(
> -                    Command::new("sh")
> -                        .args(["-c", "vtysh -c 'show ip ospf interface json'"])
> -                        .output()?
> -                        .stdout,
> -                )?;
> +                let command = match &vrf {
> +                    Some(vrf) => format!("vtysh -c 'show ip ospf vrf {vrf} interface json'"),

and here

> +                    None => "vtysh -c 'show ip ospf interface json'".to_string(),
> +                };
> +                let ospf_interfaces_string =
> +                    String::from_utf8(Command::new("sh").args(["-c", &command]).output()?.stdout)?;
>                  let ospf_interfaces: proxmox_frr::de::ospf::Interfaces =
>                      if ospf_interfaces_string.is_empty() {
>                          proxmox_frr::de::ospf::Interfaces::default()
> @@ -1063,10 +1078,14 @@ pub mod pve_rs_sdn_fabrics {
>              }
>              FabricEntry::WireGuard(_) => Ok(status::InterfaceStatus::WireGuard(Vec::new())),
>              FabricEntry::Bgp(_) => {
> +                let command = match &vrf {
> +                    Some(vrf) => format!("vtysh -c 'show bgp vrf {vrf} neighbors json'"),

and here

> +                    None => "vtysh -c 'show bgp neighbors json'".to_string(),
> +                };
>                  let bgp_neighbors_string = String::from_utf8(
>                      Command::new("sh")
>                          .env("VTYSH_HISTFILE", "/dev/null")
> -                        .args(["-c", "vtysh -c 'show bgp neighbors json'"])
> +                        .args(["-c", &command])
>                          .output()?
>                          .stdout,
>                  )?;





^ permalink raw reply	[flat|nested] 65+ messages in thread

* Re: [PATCH pve-network v3 14/32] sdn: evpn: add unreachable IPv6 default route to zone VRFs
  2026-11-16 16:11 ` [PATCH pve-network v3 14/32] sdn: evpn: add unreachable IPv6 default route to zone VRFs Gabriel Goller
@ 2026-11-18 16:08   ` Stefan Hanreich
  2026-11-18 16:39     ` Stefan Hanreich
  0 siblings, 1 reply; 65+ messages in thread
From: Stefan Hanreich @ 2026-11-18 16:08 UTC (permalink / raw)
  To: pve-devel

could be added upfront independentenly

Reviewed-by: Stefan Hanreich <s.hanreich@proxmox.com>

On 11/16/26 5:17 PM, Gabriel Goller wrote:
> Without a family flag, ip route only adds the IPv4 unreachable default
> route. IPv6 lookups that find no route in the VRF table therefore fall
> through to the main table on non-exit nodes, e.g. before FRR has
> installed the default route from the exit nodes.
> 
> Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
> ---
>  src/PVE/Network/SDN/Zones/EvpnPlugin.pm               | 11 ++++-------
>  .../evpn/advertise_subnets/expected_sdn_interfaces    |  1 +
>  src/test/zones/evpn/auto_mode/expected_sdn_interfaces |  1 +
>  src/test/zones/evpn/bgp_ebgp/expected_sdn_interfaces  |  1 +
>  .../evpn/bgp_ebgp_multihop/expected_sdn_interfaces    |  1 +
>  .../bgp_ebgp_reverse_order/expected_sdn_interfaces    |  1 +
>  .../expected_sdn_interfaces                           |  1 +
>  .../zones/evpn/bgp_fabric/expected_sdn_interfaces     |  1 +
>  .../zones/evpn/bgp_loopback/expected_sdn_interfaces   |  1 +
>  .../evpn/bgp_multipath_relax/expected_sdn_interfaces  |  1 +
>  .../evpn/combined_bgp_isis/expected_sdn_interfaces    |  1 +
>  .../expected_sdn_interfaces                           |  1 +
>  src/test/zones/evpn/ebgp/expected_sdn_interfaces      |  1 +
>  .../expected_sdn_interfaces                           |  1 +
>  .../expected_sdn_interfaces                           |  1 +
>  .../expected_sdn_interfaces                           |  2 ++
>  .../zones/evpn/ebgp_loopback/expected_sdn_interfaces  |  1 +
>  .../expected_sdn_interfaces                           |  1 +
>  .../expected_sdn_interfaces                           |  2 ++
>  src/test/zones/evpn/exitnode/expected_sdn_interfaces  |  1 +
>  .../exitnode_local_routing/expected_sdn_interfaces    |  1 +
>  .../expected_sdn_interfaces                           |  1 +
>  .../evpn/exitnode_primary/expected_sdn_interfaces     |  1 +
>  .../zones/evpn/exitnode_snat/expected_sdn_interfaces  |  1 +
>  .../evpn/exitnodenullroute/expected_sdn_interfaces    |  2 ++
>  .../evpn/frr_local_merge/expected_sdn_interfaces      |  1 +
>  .../expected_sdn_interfaces                           |  1 +
>  src/test/zones/evpn/ipv4/expected_sdn_interfaces      |  1 +
>  src/test/zones/evpn/ipv4ipv6/expected_sdn_interfaces  |  1 +
>  .../evpn/ipv4ipv6nogateway/expected_sdn_interfaces    |  1 +
>  src/test/zones/evpn/ipv6/expected_sdn_interfaces      |  1 +
>  .../zones/evpn/ipv6underlay/expected_sdn_interfaces   |  1 +
>  src/test/zones/evpn/isis/expected_sdn_interfaces      |  1 +
>  .../zones/evpn/isis_loopback/expected_sdn_interfaces  |  1 +
>  .../evpn/multipath_relax/expected_sdn_interfaces      |  1 +
>  .../zones/evpn/multiplezones/expected_sdn_interfaces  |  2 ++
>  .../evpn/openfabric_fabric/expected_sdn_interfaces    |  1 +
>  .../openfabric_fabric_ipv6/expected_sdn_interfaces    |  1 +
>  .../expected_sdn_interfaces                           |  1 +
>  .../zones/evpn/ospf_fabric/expected_sdn_interfaces    |  1 +
>  src/test/zones/evpn/routemap/expected_sdn_interfaces  |  1 +
>  .../evpn/routemap_exit_node/expected_sdn_interfaces   |  1 +
>  .../evpn/routemap_prefix_list/expected_sdn_interfaces |  1 +
>  src/test/zones/evpn/rt_import/expected_sdn_interfaces |  1 +
>  src/test/zones/evpn/vxlanport/expected_sdn_interfaces |  1 +
>  45 files changed, 52 insertions(+), 7 deletions(-)
> 
> diff --git a/src/PVE/Network/SDN/Zones/EvpnPlugin.pm b/src/PVE/Network/SDN/Zones/EvpnPlugin.pm
> index c31b6c6a2bfd..45a628d6a69d 100644
> --- a/src/PVE/Network/SDN/Zones/EvpnPlugin.pm
> +++ b/src/PVE/Network/SDN/Zones/EvpnPlugin.pm
> @@ -317,13 +317,10 @@ sub generate_sdn_config {
>          #vrf interface
>          @iface_config = ();
>          push @iface_config, "vrf-table auto";
> -        if (!$is_evpn_gateway) {
> -            push @iface_config,
> -                "post-up ip route add vrf $vrf_iface unreachable default metric 4278198272";
> -        } else {
> -            push @iface_config,
> -                "post-up ip route del vrf $vrf_iface unreachable default metric 4278198272";
> -        }
> +        my $route_action = $is_evpn_gateway ? 'del' : 'add';
> +        push @iface_config,
> +            "post-up ip route $route_action vrf $vrf_iface unreachable default metric 4278198272",
> +            "post-up ip -6 route $route_action vrf $vrf_iface unreachable default metric 4278198272";
>  
>          push(@{ $config->{$vrf_iface} }, @iface_config) if !$config->{$vrf_iface};
>  
> diff --git a/src/test/zones/evpn/advertise_subnets/expected_sdn_interfaces b/src/test/zones/evpn/advertise_subnets/expected_sdn_interfaces
> index 9d1c64c0f3fa..4ff3c840dcb8 100644
> --- a/src/test/zones/evpn/advertise_subnets/expected_sdn_interfaces
> +++ b/src/test/zones/evpn/advertise_subnets/expected_sdn_interfaces
> @@ -16,6 +16,7 @@ auto vrf_myzone
>  iface vrf_myzone
>  	vrf-table auto
>  	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
> +	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
>  
>  auto vrfbr_myzone
>  iface vrfbr_myzone
> diff --git a/src/test/zones/evpn/auto_mode/expected_sdn_interfaces b/src/test/zones/evpn/auto_mode/expected_sdn_interfaces
> index 4cf13e05e688..c898bc2a5976 100644
> --- a/src/test/zones/evpn/auto_mode/expected_sdn_interfaces
> +++ b/src/test/zones/evpn/auto_mode/expected_sdn_interfaces
> @@ -15,6 +15,7 @@ auto vrf_myzone
>  iface vrf_myzone
>  	vrf-table auto
>  	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
> +	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
>  
>  auto vrfbr_myzone
>  iface vrfbr_myzone
> diff --git a/src/test/zones/evpn/bgp_ebgp/expected_sdn_interfaces b/src/test/zones/evpn/bgp_ebgp/expected_sdn_interfaces
> index 4cf13e05e688..c898bc2a5976 100644
> --- a/src/test/zones/evpn/bgp_ebgp/expected_sdn_interfaces
> +++ b/src/test/zones/evpn/bgp_ebgp/expected_sdn_interfaces
> @@ -15,6 +15,7 @@ auto vrf_myzone
>  iface vrf_myzone
>  	vrf-table auto
>  	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
> +	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
>  
>  auto vrfbr_myzone
>  iface vrfbr_myzone
> diff --git a/src/test/zones/evpn/bgp_ebgp_multihop/expected_sdn_interfaces b/src/test/zones/evpn/bgp_ebgp_multihop/expected_sdn_interfaces
> index 4cf13e05e688..c898bc2a5976 100644
> --- a/src/test/zones/evpn/bgp_ebgp_multihop/expected_sdn_interfaces
> +++ b/src/test/zones/evpn/bgp_ebgp_multihop/expected_sdn_interfaces
> @@ -15,6 +15,7 @@ auto vrf_myzone
>  iface vrf_myzone
>  	vrf-table auto
>  	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
> +	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
>  
>  auto vrfbr_myzone
>  iface vrfbr_myzone
> diff --git a/src/test/zones/evpn/bgp_ebgp_reverse_order/expected_sdn_interfaces b/src/test/zones/evpn/bgp_ebgp_reverse_order/expected_sdn_interfaces
> index 4cf13e05e688..c898bc2a5976 100644
> --- a/src/test/zones/evpn/bgp_ebgp_reverse_order/expected_sdn_interfaces
> +++ b/src/test/zones/evpn/bgp_ebgp_reverse_order/expected_sdn_interfaces
> @@ -15,6 +15,7 @@ auto vrf_myzone
>  iface vrf_myzone
>  	vrf-table auto
>  	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
> +	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
>  
>  auto vrfbr_myzone
>  iface vrfbr_myzone
> diff --git a/src/test/zones/evpn/bgp_evpn_routemap_prefix_list/expected_sdn_interfaces b/src/test/zones/evpn/bgp_evpn_routemap_prefix_list/expected_sdn_interfaces
> index 4cf13e05e688..c898bc2a5976 100644
> --- a/src/test/zones/evpn/bgp_evpn_routemap_prefix_list/expected_sdn_interfaces
> +++ b/src/test/zones/evpn/bgp_evpn_routemap_prefix_list/expected_sdn_interfaces
> @@ -15,6 +15,7 @@ auto vrf_myzone
>  iface vrf_myzone
>  	vrf-table auto
>  	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
> +	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
>  
>  auto vrfbr_myzone
>  iface vrfbr_myzone
> diff --git a/src/test/zones/evpn/bgp_fabric/expected_sdn_interfaces b/src/test/zones/evpn/bgp_fabric/expected_sdn_interfaces
> index fd16853cd00e..816ddda444e7 100644
> --- a/src/test/zones/evpn/bgp_fabric/expected_sdn_interfaces
> +++ b/src/test/zones/evpn/bgp_fabric/expected_sdn_interfaces
> @@ -16,6 +16,7 @@ auto vrf_evpn
>  iface vrf_evpn
>  	vrf-table auto
>  	post-up ip route add vrf vrf_evpn unreachable default metric 4278198272
> +	post-up ip -6 route add vrf vrf_evpn unreachable default metric 4278198272
>  
>  auto vrfbr_evpn
>  iface vrfbr_evpn
> diff --git a/src/test/zones/evpn/bgp_loopback/expected_sdn_interfaces b/src/test/zones/evpn/bgp_loopback/expected_sdn_interfaces
> index 4cf13e05e688..c898bc2a5976 100644
> --- a/src/test/zones/evpn/bgp_loopback/expected_sdn_interfaces
> +++ b/src/test/zones/evpn/bgp_loopback/expected_sdn_interfaces
> @@ -15,6 +15,7 @@ auto vrf_myzone
>  iface vrf_myzone
>  	vrf-table auto
>  	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
> +	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
>  
>  auto vrfbr_myzone
>  iface vrfbr_myzone
> diff --git a/src/test/zones/evpn/bgp_multipath_relax/expected_sdn_interfaces b/src/test/zones/evpn/bgp_multipath_relax/expected_sdn_interfaces
> index 4cf13e05e688..c898bc2a5976 100644
> --- a/src/test/zones/evpn/bgp_multipath_relax/expected_sdn_interfaces
> +++ b/src/test/zones/evpn/bgp_multipath_relax/expected_sdn_interfaces
> @@ -15,6 +15,7 @@ auto vrf_myzone
>  iface vrf_myzone
>  	vrf-table auto
>  	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
> +	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
>  
>  auto vrfbr_myzone
>  iface vrfbr_myzone
> diff --git a/src/test/zones/evpn/combined_bgp_isis/expected_sdn_interfaces b/src/test/zones/evpn/combined_bgp_isis/expected_sdn_interfaces
> index 4cf13e05e688..c898bc2a5976 100644
> --- a/src/test/zones/evpn/combined_bgp_isis/expected_sdn_interfaces
> +++ b/src/test/zones/evpn/combined_bgp_isis/expected_sdn_interfaces
> @@ -15,6 +15,7 @@ auto vrf_myzone
>  iface vrf_myzone
>  	vrf-table auto
>  	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
> +	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
>  
>  auto vrfbr_myzone
>  iface vrfbr_myzone
> diff --git a/src/test/zones/evpn/disable_arp_nd_suppression/expected_sdn_interfaces b/src/test/zones/evpn/disable_arp_nd_suppression/expected_sdn_interfaces
> index bbde90648dbb..102a6a0f7cb3 100644
> --- a/src/test/zones/evpn/disable_arp_nd_suppression/expected_sdn_interfaces
> +++ b/src/test/zones/evpn/disable_arp_nd_suppression/expected_sdn_interfaces
> @@ -16,6 +16,7 @@ auto vrf_myzone
>  iface vrf_myzone
>  	vrf-table auto
>  	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
> +	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
>  
>  auto vrfbr_myzone
>  iface vrfbr_myzone
> diff --git a/src/test/zones/evpn/ebgp/expected_sdn_interfaces b/src/test/zones/evpn/ebgp/expected_sdn_interfaces
> index 4cf13e05e688..c898bc2a5976 100644
> --- a/src/test/zones/evpn/ebgp/expected_sdn_interfaces
> +++ b/src/test/zones/evpn/ebgp/expected_sdn_interfaces
> @@ -15,6 +15,7 @@ auto vrf_myzone
>  iface vrf_myzone
>  	vrf-table auto
>  	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
> +	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
>  
>  auto vrfbr_myzone
>  iface vrfbr_myzone
> diff --git a/src/test/zones/evpn/ebgp_evpn_ibgp_wan_evpn_ebgp/expected_sdn_interfaces b/src/test/zones/evpn/ebgp_evpn_ibgp_wan_evpn_ebgp/expected_sdn_interfaces
> index 7481d3655ca9..492e0c61a317 100644
> --- a/src/test/zones/evpn/ebgp_evpn_ibgp_wan_evpn_ebgp/expected_sdn_interfaces
> +++ b/src/test/zones/evpn/ebgp_evpn_ibgp_wan_evpn_ebgp/expected_sdn_interfaces
> @@ -15,6 +15,7 @@ auto vrf_myzone
>  iface vrf_myzone
>  	vrf-table auto
>  	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
> +	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
>  
>  auto vrfbr_myzone
>  iface vrfbr_myzone
> diff --git a/src/test/zones/evpn/ebgp_evpn_ibgp_wan_evpn_ebgp_rt_import/expected_sdn_interfaces b/src/test/zones/evpn/ebgp_evpn_ibgp_wan_evpn_ebgp_rt_import/expected_sdn_interfaces
> index 7481d3655ca9..492e0c61a317 100644
> --- a/src/test/zones/evpn/ebgp_evpn_ibgp_wan_evpn_ebgp_rt_import/expected_sdn_interfaces
> +++ b/src/test/zones/evpn/ebgp_evpn_ibgp_wan_evpn_ebgp_rt_import/expected_sdn_interfaces
> @@ -15,6 +15,7 @@ auto vrf_myzone
>  iface vrf_myzone
>  	vrf-table auto
>  	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
> +	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
>  
>  auto vrfbr_myzone
>  iface vrfbr_myzone
> diff --git a/src/test/zones/evpn/ebgp_evpn_ibgp_wan_evpn_ebgp_rt_import_mixed/expected_sdn_interfaces b/src/test/zones/evpn/ebgp_evpn_ibgp_wan_evpn_ebgp_rt_import_mixed/expected_sdn_interfaces
> index 39f3beb14c58..4b2202402722 100644
> --- a/src/test/zones/evpn/ebgp_evpn_ibgp_wan_evpn_ebgp_rt_import_mixed/expected_sdn_interfaces
> +++ b/src/test/zones/evpn/ebgp_evpn_ibgp_wan_evpn_ebgp_rt_import_mixed/expected_sdn_interfaces
> @@ -26,11 +26,13 @@ auto vrf_myzone
>  iface vrf_myzone
>  	vrf-table auto
>  	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
> +	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
>  
>  auto vrf_myzone2
>  iface vrf_myzone2
>  	vrf-table auto
>  	post-up ip route add vrf vrf_myzone2 unreachable default metric 4278198272
> +	post-up ip -6 route add vrf vrf_myzone2 unreachable default metric 4278198272
>  
>  auto vrfbr_myzone
>  iface vrfbr_myzone
> diff --git a/src/test/zones/evpn/ebgp_loopback/expected_sdn_interfaces b/src/test/zones/evpn/ebgp_loopback/expected_sdn_interfaces
> index 4cf13e05e688..c898bc2a5976 100644
> --- a/src/test/zones/evpn/ebgp_loopback/expected_sdn_interfaces
> +++ b/src/test/zones/evpn/ebgp_loopback/expected_sdn_interfaces
> @@ -15,6 +15,7 @@ auto vrf_myzone
>  iface vrf_myzone
>  	vrf-table auto
>  	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
> +	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
>  
>  auto vrfbr_myzone
>  iface vrfbr_myzone
> diff --git a/src/test/zones/evpn/evpn_cluster_ibgp_uplink_ebgp/expected_sdn_interfaces b/src/test/zones/evpn/evpn_cluster_ibgp_uplink_ebgp/expected_sdn_interfaces
> index 4cf13e05e688..c898bc2a5976 100644
> --- a/src/test/zones/evpn/evpn_cluster_ibgp_uplink_ebgp/expected_sdn_interfaces
> +++ b/src/test/zones/evpn/evpn_cluster_ibgp_uplink_ebgp/expected_sdn_interfaces
> @@ -15,6 +15,7 @@ auto vrf_myzone
>  iface vrf_myzone
>  	vrf-table auto
>  	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
> +	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
>  
>  auto vrfbr_myzone
>  iface vrfbr_myzone
> diff --git a/src/test/zones/evpn/evpn_multiple_zones_cluster_ibgp_uplink_ebgp/expected_sdn_interfaces b/src/test/zones/evpn/evpn_multiple_zones_cluster_ibgp_uplink_ebgp/expected_sdn_interfaces
> index 88706b7c1a5d..7a5477a4e65d 100644
> --- a/src/test/zones/evpn/evpn_multiple_zones_cluster_ibgp_uplink_ebgp/expected_sdn_interfaces
> +++ b/src/test/zones/evpn/evpn_multiple_zones_cluster_ibgp_uplink_ebgp/expected_sdn_interfaces
> @@ -26,11 +26,13 @@ auto vrf_myzone
>  iface vrf_myzone
>  	vrf-table auto
>  	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
> +	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
>  
>  auto vrf_myzone2
>  iface vrf_myzone2
>  	vrf-table auto
>  	post-up ip route add vrf vrf_myzone2 unreachable default metric 4278198272
> +	post-up ip -6 route add vrf vrf_myzone2 unreachable default metric 4278198272
>  
>  auto vrfbr_myzone
>  iface vrfbr_myzone
> diff --git a/src/test/zones/evpn/exitnode/expected_sdn_interfaces b/src/test/zones/evpn/exitnode/expected_sdn_interfaces
> index 5ab308477596..5dcfc83fce9a 100644
> --- a/src/test/zones/evpn/exitnode/expected_sdn_interfaces
> +++ b/src/test/zones/evpn/exitnode/expected_sdn_interfaces
> @@ -15,6 +15,7 @@ auto vrf_myzone
>  iface vrf_myzone
>  	vrf-table auto
>  	post-up ip route del vrf vrf_myzone unreachable default metric 4278198272
> +	post-up ip -6 route del vrf vrf_myzone unreachable default metric 4278198272
>  
>  auto vrfbr_myzone
>  iface vrfbr_myzone
> diff --git a/src/test/zones/evpn/exitnode_local_routing/expected_sdn_interfaces b/src/test/zones/evpn/exitnode_local_routing/expected_sdn_interfaces
> index 301f5b30202a..511cec67fdc3 100644
> --- a/src/test/zones/evpn/exitnode_local_routing/expected_sdn_interfaces
> +++ b/src/test/zones/evpn/exitnode_local_routing/expected_sdn_interfaces
> @@ -15,6 +15,7 @@ auto vrf_myzone
>  iface vrf_myzone
>  	vrf-table auto
>  	post-up ip route del vrf vrf_myzone unreachable default metric 4278198272
> +	post-up ip -6 route del vrf vrf_myzone unreachable default metric 4278198272
>  
>  auto vrfbr_myzone
>  iface vrfbr_myzone
> diff --git a/src/test/zones/evpn/exitnode_local_routing_ipv6/expected_sdn_interfaces b/src/test/zones/evpn/exitnode_local_routing_ipv6/expected_sdn_interfaces
> index b46d4e7b6ea0..1c3b94a75fad 100644
> --- a/src/test/zones/evpn/exitnode_local_routing_ipv6/expected_sdn_interfaces
> +++ b/src/test/zones/evpn/exitnode_local_routing_ipv6/expected_sdn_interfaces
> @@ -15,6 +15,7 @@ auto vrf_myzone
>  iface vrf_myzone
>  	vrf-table auto
>  	post-up ip route del vrf vrf_myzone unreachable default metric 4278198272
> +	post-up ip -6 route del vrf vrf_myzone unreachable default metric 4278198272
>  
>  auto vrfbr_myzone
>  iface vrfbr_myzone
> diff --git a/src/test/zones/evpn/exitnode_primary/expected_sdn_interfaces b/src/test/zones/evpn/exitnode_primary/expected_sdn_interfaces
> index 5ab308477596..5dcfc83fce9a 100644
> --- a/src/test/zones/evpn/exitnode_primary/expected_sdn_interfaces
> +++ b/src/test/zones/evpn/exitnode_primary/expected_sdn_interfaces
> @@ -15,6 +15,7 @@ auto vrf_myzone
>  iface vrf_myzone
>  	vrf-table auto
>  	post-up ip route del vrf vrf_myzone unreachable default metric 4278198272
> +	post-up ip -6 route del vrf vrf_myzone unreachable default metric 4278198272
>  
>  auto vrfbr_myzone
>  iface vrfbr_myzone
> diff --git a/src/test/zones/evpn/exitnode_snat/expected_sdn_interfaces b/src/test/zones/evpn/exitnode_snat/expected_sdn_interfaces
> index 0d7d17412f0b..57ac29823da1 100644
> --- a/src/test/zones/evpn/exitnode_snat/expected_sdn_interfaces
> +++ b/src/test/zones/evpn/exitnode_snat/expected_sdn_interfaces
> @@ -34,6 +34,7 @@ auto vrf_myzone
>  iface vrf_myzone
>  	vrf-table auto
>  	post-up ip route del vrf vrf_myzone unreachable default metric 4278198272
> +	post-up ip -6 route del vrf vrf_myzone unreachable default metric 4278198272
>  
>  auto vrfbr_myzone
>  iface vrfbr_myzone
> diff --git a/src/test/zones/evpn/exitnodenullroute/expected_sdn_interfaces b/src/test/zones/evpn/exitnodenullroute/expected_sdn_interfaces
> index 4bf5ccf96f91..ee2f2e77ebe7 100644
> --- a/src/test/zones/evpn/exitnodenullroute/expected_sdn_interfaces
> +++ b/src/test/zones/evpn/exitnodenullroute/expected_sdn_interfaces
> @@ -34,11 +34,13 @@ auto vrf_myzone
>  iface vrf_myzone
>  	vrf-table auto
>  	post-up ip route del vrf vrf_myzone unreachable default metric 4278198272
> +	post-up ip -6 route del vrf vrf_myzone unreachable default metric 4278198272
>  
>  auto vrf_myzone2
>  iface vrf_myzone2
>  	vrf-table auto
>  	post-up ip route del vrf vrf_myzone2 unreachable default metric 4278198272
> +	post-up ip -6 route del vrf vrf_myzone2 unreachable default metric 4278198272
>  
>  auto vrfbr_myzone
>  iface vrfbr_myzone
> diff --git a/src/test/zones/evpn/frr_local_merge/expected_sdn_interfaces b/src/test/zones/evpn/frr_local_merge/expected_sdn_interfaces
> index c7ddf44ef6d3..eb74308f4545 100644
> --- a/src/test/zones/evpn/frr_local_merge/expected_sdn_interfaces
> +++ b/src/test/zones/evpn/frr_local_merge/expected_sdn_interfaces
> @@ -16,6 +16,7 @@ auto vrf_myzone
>  iface vrf_myzone
>  	vrf-table auto
>  	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
> +	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
>  
>  auto vrfbr_myzone
>  iface vrfbr_myzone
> diff --git a/src/test/zones/evpn/frr_local_merge_router_without_exit/expected_sdn_interfaces b/src/test/zones/evpn/frr_local_merge_router_without_exit/expected_sdn_interfaces
> index 169f32d38951..ece76710d341 100644
> --- a/src/test/zones/evpn/frr_local_merge_router_without_exit/expected_sdn_interfaces
> +++ b/src/test/zones/evpn/frr_local_merge_router_without_exit/expected_sdn_interfaces
> @@ -16,6 +16,7 @@ auto vrf_evpnz
>  iface vrf_evpnz
>  	vrf-table auto
>  	post-up ip route add vrf vrf_evpnz unreachable default metric 4278198272
> +	post-up ip -6 route add vrf vrf_evpnz unreachable default metric 4278198272
>  
>  auto vrfbr_evpnz
>  iface vrfbr_evpnz
> diff --git a/src/test/zones/evpn/ipv4/expected_sdn_interfaces b/src/test/zones/evpn/ipv4/expected_sdn_interfaces
> index 9d1c64c0f3fa..4ff3c840dcb8 100644
> --- a/src/test/zones/evpn/ipv4/expected_sdn_interfaces
> +++ b/src/test/zones/evpn/ipv4/expected_sdn_interfaces
> @@ -16,6 +16,7 @@ auto vrf_myzone
>  iface vrf_myzone
>  	vrf-table auto
>  	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
> +	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
>  
>  auto vrfbr_myzone
>  iface vrfbr_myzone
> diff --git a/src/test/zones/evpn/ipv4ipv6/expected_sdn_interfaces b/src/test/zones/evpn/ipv4ipv6/expected_sdn_interfaces
> index 7a5d741b067c..e54a453a280c 100644
> --- a/src/test/zones/evpn/ipv4ipv6/expected_sdn_interfaces
> +++ b/src/test/zones/evpn/ipv4ipv6/expected_sdn_interfaces
> @@ -18,6 +18,7 @@ auto vrf_myzone
>  iface vrf_myzone
>  	vrf-table auto
>  	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
> +	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
>  
>  auto vrfbr_myzone
>  iface vrfbr_myzone
> diff --git a/src/test/zones/evpn/ipv4ipv6nogateway/expected_sdn_interfaces b/src/test/zones/evpn/ipv4ipv6nogateway/expected_sdn_interfaces
> index 378fa77fa368..2e8dc2a9c869 100644
> --- a/src/test/zones/evpn/ipv4ipv6nogateway/expected_sdn_interfaces
> +++ b/src/test/zones/evpn/ipv4ipv6nogateway/expected_sdn_interfaces
> @@ -14,6 +14,7 @@ auto vrf_myzone
>  iface vrf_myzone
>  	vrf-table auto
>  	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
> +	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
>  
>  auto vrfbr_myzone
>  iface vrfbr_myzone
> diff --git a/src/test/zones/evpn/ipv6/expected_sdn_interfaces b/src/test/zones/evpn/ipv6/expected_sdn_interfaces
> index b2bdbfefd810..5d9ecfef0225 100644
> --- a/src/test/zones/evpn/ipv6/expected_sdn_interfaces
> +++ b/src/test/zones/evpn/ipv6/expected_sdn_interfaces
> @@ -16,6 +16,7 @@ auto vrf_myzone
>  iface vrf_myzone
>  	vrf-table auto
>  	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
> +	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
>  
>  auto vrfbr_myzone
>  iface vrfbr_myzone
> diff --git a/src/test/zones/evpn/ipv6underlay/expected_sdn_interfaces b/src/test/zones/evpn/ipv6underlay/expected_sdn_interfaces
> index 3b91f75eb3dd..00a66c8a276b 100644
> --- a/src/test/zones/evpn/ipv6underlay/expected_sdn_interfaces
> +++ b/src/test/zones/evpn/ipv6underlay/expected_sdn_interfaces
> @@ -16,6 +16,7 @@ auto vrf_myzone
>  iface vrf_myzone
>  	vrf-table auto
>  	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
> +	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
>  
>  auto vrfbr_myzone
>  iface vrfbr_myzone
> diff --git a/src/test/zones/evpn/isis/expected_sdn_interfaces b/src/test/zones/evpn/isis/expected_sdn_interfaces
> index 4cf13e05e688..c898bc2a5976 100644
> --- a/src/test/zones/evpn/isis/expected_sdn_interfaces
> +++ b/src/test/zones/evpn/isis/expected_sdn_interfaces
> @@ -15,6 +15,7 @@ auto vrf_myzone
>  iface vrf_myzone
>  	vrf-table auto
>  	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
> +	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
>  
>  auto vrfbr_myzone
>  iface vrfbr_myzone
> diff --git a/src/test/zones/evpn/isis_loopback/expected_sdn_interfaces b/src/test/zones/evpn/isis_loopback/expected_sdn_interfaces
> index e595dc93f60a..1f8a7989e0fd 100644
> --- a/src/test/zones/evpn/isis_loopback/expected_sdn_interfaces
> +++ b/src/test/zones/evpn/isis_loopback/expected_sdn_interfaces
> @@ -15,6 +15,7 @@ auto vrf_myzone
>  iface vrf_myzone
>  	vrf-table auto
>  	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
> +	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
>  
>  auto vrfbr_myzone
>  iface vrfbr_myzone
> diff --git a/src/test/zones/evpn/multipath_relax/expected_sdn_interfaces b/src/test/zones/evpn/multipath_relax/expected_sdn_interfaces
> index 4cf13e05e688..c898bc2a5976 100644
> --- a/src/test/zones/evpn/multipath_relax/expected_sdn_interfaces
> +++ b/src/test/zones/evpn/multipath_relax/expected_sdn_interfaces
> @@ -15,6 +15,7 @@ auto vrf_myzone
>  iface vrf_myzone
>  	vrf-table auto
>  	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
> +	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
>  
>  auto vrfbr_myzone
>  iface vrfbr_myzone
> diff --git a/src/test/zones/evpn/multiplezones/expected_sdn_interfaces b/src/test/zones/evpn/multiplezones/expected_sdn_interfaces
> index e279b0a5770f..933d99277dba 100644
> --- a/src/test/zones/evpn/multiplezones/expected_sdn_interfaces
> +++ b/src/test/zones/evpn/multiplezones/expected_sdn_interfaces
> @@ -26,11 +26,13 @@ auto vrf_myzone
>  iface vrf_myzone
>  	vrf-table auto
>  	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
> +	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
>  
>  auto vrf_myzone2
>  iface vrf_myzone2
>  	vrf-table auto
>  	post-up ip route add vrf vrf_myzone2 unreachable default metric 4278198272
> +	post-up ip -6 route add vrf vrf_myzone2 unreachable default metric 4278198272
>  
>  auto vrfbr_myzone
>  iface vrfbr_myzone
> diff --git a/src/test/zones/evpn/openfabric_fabric/expected_sdn_interfaces b/src/test/zones/evpn/openfabric_fabric/expected_sdn_interfaces
> index 7460b12ce686..02cb79a8beb2 100644
> --- a/src/test/zones/evpn/openfabric_fabric/expected_sdn_interfaces
> +++ b/src/test/zones/evpn/openfabric_fabric/expected_sdn_interfaces
> @@ -16,6 +16,7 @@ auto vrf_evpn
>  iface vrf_evpn
>  	vrf-table auto
>  	post-up ip route add vrf vrf_evpn unreachable default metric 4278198272
> +	post-up ip -6 route add vrf vrf_evpn unreachable default metric 4278198272
>  
>  auto vrfbr_evpn
>  iface vrfbr_evpn
> diff --git a/src/test/zones/evpn/openfabric_fabric_ipv6/expected_sdn_interfaces b/src/test/zones/evpn/openfabric_fabric_ipv6/expected_sdn_interfaces
> index d01771386658..d3b0fe83d588 100644
> --- a/src/test/zones/evpn/openfabric_fabric_ipv6/expected_sdn_interfaces
> +++ b/src/test/zones/evpn/openfabric_fabric_ipv6/expected_sdn_interfaces
> @@ -16,6 +16,7 @@ auto vrf_evpn
>  iface vrf_evpn
>  	vrf-table auto
>  	post-up ip route add vrf vrf_evpn unreachable default metric 4278198272
> +	post-up ip -6 route add vrf vrf_evpn unreachable default metric 4278198272
>  
>  auto vrfbr_evpn
>  iface vrfbr_evpn
> diff --git a/src/test/zones/evpn/openfabric_fabric_ipv6_only/expected_sdn_interfaces b/src/test/zones/evpn/openfabric_fabric_ipv6_only/expected_sdn_interfaces
> index 51507d7d3fbe..abcad331ef10 100644
> --- a/src/test/zones/evpn/openfabric_fabric_ipv6_only/expected_sdn_interfaces
> +++ b/src/test/zones/evpn/openfabric_fabric_ipv6_only/expected_sdn_interfaces
> @@ -16,6 +16,7 @@ auto vrf_evpn
>  iface vrf_evpn
>  	vrf-table auto
>  	post-up ip route add vrf vrf_evpn unreachable default metric 4278198272
> +	post-up ip -6 route add vrf vrf_evpn unreachable default metric 4278198272
>  
>  auto vrfbr_evpn
>  iface vrfbr_evpn
> diff --git a/src/test/zones/evpn/ospf_fabric/expected_sdn_interfaces b/src/test/zones/evpn/ospf_fabric/expected_sdn_interfaces
> index 2543304a47ba..7ad2cb4cf812 100644
> --- a/src/test/zones/evpn/ospf_fabric/expected_sdn_interfaces
> +++ b/src/test/zones/evpn/ospf_fabric/expected_sdn_interfaces
> @@ -16,6 +16,7 @@ auto vrf_evpn
>  iface vrf_evpn
>  	vrf-table auto
>  	post-up ip route add vrf vrf_evpn unreachable default metric 4278198272
> +	post-up ip -6 route add vrf vrf_evpn unreachable default metric 4278198272
>  
>  auto vrfbr_evpn
>  iface vrfbr_evpn
> diff --git a/src/test/zones/evpn/routemap/expected_sdn_interfaces b/src/test/zones/evpn/routemap/expected_sdn_interfaces
> index 4cf13e05e688..c898bc2a5976 100644
> --- a/src/test/zones/evpn/routemap/expected_sdn_interfaces
> +++ b/src/test/zones/evpn/routemap/expected_sdn_interfaces
> @@ -15,6 +15,7 @@ auto vrf_myzone
>  iface vrf_myzone
>  	vrf-table auto
>  	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
> +	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
>  
>  auto vrfbr_myzone
>  iface vrfbr_myzone
> diff --git a/src/test/zones/evpn/routemap_exit_node/expected_sdn_interfaces b/src/test/zones/evpn/routemap_exit_node/expected_sdn_interfaces
> index 5ab308477596..5dcfc83fce9a 100644
> --- a/src/test/zones/evpn/routemap_exit_node/expected_sdn_interfaces
> +++ b/src/test/zones/evpn/routemap_exit_node/expected_sdn_interfaces
> @@ -15,6 +15,7 @@ auto vrf_myzone
>  iface vrf_myzone
>  	vrf-table auto
>  	post-up ip route del vrf vrf_myzone unreachable default metric 4278198272
> +	post-up ip -6 route del vrf vrf_myzone unreachable default metric 4278198272
>  
>  auto vrfbr_myzone
>  iface vrfbr_myzone
> diff --git a/src/test/zones/evpn/routemap_prefix_list/expected_sdn_interfaces b/src/test/zones/evpn/routemap_prefix_list/expected_sdn_interfaces
> index 4cf13e05e688..c898bc2a5976 100644
> --- a/src/test/zones/evpn/routemap_prefix_list/expected_sdn_interfaces
> +++ b/src/test/zones/evpn/routemap_prefix_list/expected_sdn_interfaces
> @@ -15,6 +15,7 @@ auto vrf_myzone
>  iface vrf_myzone
>  	vrf-table auto
>  	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
> +	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
>  
>  auto vrfbr_myzone
>  iface vrfbr_myzone
> diff --git a/src/test/zones/evpn/rt_import/expected_sdn_interfaces b/src/test/zones/evpn/rt_import/expected_sdn_interfaces
> index 9d1c64c0f3fa..4ff3c840dcb8 100644
> --- a/src/test/zones/evpn/rt_import/expected_sdn_interfaces
> +++ b/src/test/zones/evpn/rt_import/expected_sdn_interfaces
> @@ -16,6 +16,7 @@ auto vrf_myzone
>  iface vrf_myzone
>  	vrf-table auto
>  	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
> +	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
>  
>  auto vrfbr_myzone
>  iface vrfbr_myzone
> diff --git a/src/test/zones/evpn/vxlanport/expected_sdn_interfaces b/src/test/zones/evpn/vxlanport/expected_sdn_interfaces
> index d511bf99eca1..18b6074a9b2e 100644
> --- a/src/test/zones/evpn/vxlanport/expected_sdn_interfaces
> +++ b/src/test/zones/evpn/vxlanport/expected_sdn_interfaces
> @@ -16,6 +16,7 @@ auto vrf_myzone
>  iface vrf_myzone
>  	vrf-table auto
>  	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
> +	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
>  
>  auto vrfbr_myzone
>  iface vrfbr_myzone





^ permalink raw reply	[flat|nested] 65+ messages in thread

* Re: [PATCH pve-network v3 15/32] sdn: add optional VRFs for simple zones
  2026-11-16 16:11 ` [PATCH pve-network v3 15/32] sdn: add optional VRFs for simple zones Gabriel Goller
@ 2026-11-18 16:18   ` Stefan Hanreich
  2026-11-19 13:44     ` Gabriel Goller
  0 siblings, 1 reply; 65+ messages in thread
From: Stefan Hanreich @ 2026-11-18 16:18 UTC (permalink / raw)
  To: pve-devel



On 11/16/26 5:16 PM, Gabriel Goller wrote:
> Allow simple zones to isolate routing with dedicated-vrf. It is
> disabled by default to preserve existing behavior.
> 
> Create the VRF even when the zone has no VNets, so fabrics can use it
> without requiring a VNet.
> 
> Add unreachable IPv4 and IPv6 default routes with the highest metric
> to the VRF, as EVPN does on non-exit nodes. Otherwise lookups that find
> no route in the VRF table fall through to the main table, e.g. if no
> default route is configured or before FRR has installed it.
> 
> Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
> ---
>  src/PVE/API2/Network/SDN/Zones.pm             |  6 ++++
>  src/PVE/Network/SDN/Zones.pm                  | 19 +++++++++--
>  src/PVE/Network/SDN/Zones/EvpnPlugin.pm       |  5 +--
>  src/PVE/Network/SDN/Zones/Plugin.pm           | 11 ++++++
>  src/PVE/Network/SDN/Zones/SimplePlugin.pm     | 32 +++++++++++++++--
>  .../hetzner-vrf/expected_sdn_interfaces       | 27 +++++++++++++++
>  src/test/zones/simple/hetzner-vrf/interfaces  |  6 ++++
>  src/test/zones/simple/hetzner-vrf/sdn_config  | 34 +++++++++++++++++++
>  .../simple/vrf-empty/expected_sdn_interfaces  |  7 ++++
>  src/test/zones/simple/vrf-empty/interfaces    |  2 ++
>  src/test/zones/simple/vrf-empty/sdn_config    | 12 +++++++
>  .../zones/simple/vrf/expected_sdn_interfaces  | 14 ++++++++
>  src/test/zones/simple/vrf/interfaces          |  2 ++
>  src/test/zones/simple/vrf/sdn_config          | 17 ++++++++++
>  14 files changed, 187 insertions(+), 7 deletions(-)
>  create mode 100644 src/test/zones/simple/hetzner-vrf/expected_sdn_interfaces
>  create mode 100644 src/test/zones/simple/hetzner-vrf/interfaces
>  create mode 100644 src/test/zones/simple/hetzner-vrf/sdn_config
>  create mode 100644 src/test/zones/simple/vrf-empty/expected_sdn_interfaces
>  create mode 100644 src/test/zones/simple/vrf-empty/interfaces
>  create mode 100644 src/test/zones/simple/vrf-empty/sdn_config
>  create mode 100644 src/test/zones/simple/vrf/expected_sdn_interfaces
>  create mode 100644 src/test/zones/simple/vrf/interfaces
>  create mode 100644 src/test/zones/simple/vrf/sdn_config
> 
> diff --git a/src/PVE/API2/Network/SDN/Zones.pm b/src/PVE/API2/Network/SDN/Zones.pm
> index 74b10f032bf4..38d950fda076 100644
> --- a/src/PVE/API2/Network/SDN/Zones.pm
> +++ b/src/PVE/API2/Network/SDN/Zones.pm
> @@ -61,6 +61,12 @@ my $ZONE_PROPERTIES = {
>          optional => 1,
>          description => 'Name of DHCP server backend for this zone.',
>      },
> +    'dedicated-vrf' => {
> +        type => 'boolean',
> +        default => 0,
> +        optional => 1,
> +        description => 'Create a dedicated VRF for a simple zone.',
> +    },
>      'rt-import' => {
>          type => 'string',
>          optional => 1,
> diff --git a/src/PVE/Network/SDN/Zones.pm b/src/PVE/Network/SDN/Zones.pm
> index c189652a79eb..cf81c002c4a5 100644
> --- a/src/PVE/Network/SDN/Zones.pm
> +++ b/src/PVE/Network/SDN/Zones.pm
> @@ -124,6 +124,9 @@ sub generate_etc_network_config {
>      my $controller_cfg = $cfg->{controllers};
>      return if !$vnet_cfg && !$zone_cfg;
>  
> +    my $vnet_ids = $vnet_cfg ? ($vnet_cfg->{ids} // {}) : {};
> +    my $zone_ids = $zone_cfg ? ($zone_cfg->{ids} // {}) : {};
> +
>      my $interfaces_config = PVE::INotify::read_file('interfaces');
>      my $bridge_ports = PVE::IPRoute2::get_bridge_port_mapping();
>  
> @@ -131,8 +134,18 @@ sub generate_etc_network_config {
>      my $config = {};
>      my $nodename = PVE::INotify::nodename();
>  
> -    for my $id (sort keys %{ $vnet_cfg->{ids} }) {
> -        my $vnet = $vnet_cfg->{ids}->{$id};
> +    for my $zone_id (sort keys %$zone_ids) {
> +        my $plugin_config = $zone_ids->{$zone_id};
> +        next if $plugin_config->{type} ne 'simple';
> +        next if defined($plugin_config->{nodes}) && !$plugin_config->{nodes}->{$nodename};
> +
> +        PVE::Network::SDN::Zones::SimplePlugin->generate_zone_config(

fine for now, but shouldn't we make this a method of the ZonePlugin?

> +            $plugin_config, $zone_id, $config,
> +        );
> +    }
> +
> +    for my $id (sort keys %$vnet_ids) {
> +        my $vnet = $vnet_ids->{$id};
>          my $zone = $vnet->{zone};
>  
>          if (!$zone) {
> @@ -140,7 +153,7 @@ sub generate_etc_network_config {
>              next;
>          }
>  
> -        my $plugin_config = $zone_cfg->{ids}->{$zone};
> +        my $plugin_config = $zone_ids->{$zone};
>  
>          if (!defined($plugin_config)) {
>              warn "can't generate vnet '$id': zone $zone don't exist\n";
> diff --git a/src/PVE/Network/SDN/Zones/EvpnPlugin.pm b/src/PVE/Network/SDN/Zones/EvpnPlugin.pm
> index 45a628d6a69d..534ac9ffa5b1 100644
> --- a/src/PVE/Network/SDN/Zones/EvpnPlugin.pm
> +++ b/src/PVE/Network/SDN/Zones/EvpnPlugin.pm
> @@ -319,8 +319,9 @@ sub generate_sdn_config {
>          push @iface_config, "vrf-table auto";
>          my $route_action = $is_evpn_gateway ? 'del' : 'add';
>          push @iface_config,
> -            "post-up ip route $route_action vrf $vrf_iface unreachable default metric 4278198272",
> -            "post-up ip -6 route $route_action vrf $vrf_iface unreachable default metric 4278198272";
> +            PVE::Network::SDN::Zones::Plugin::vrf_unreachable_default_cmds(
> +                $vrf_iface, $route_action,
> +            );
>  
>          push(@{ $config->{$vrf_iface} }, @iface_config) if !$config->{$vrf_iface};
>  
> diff --git a/src/PVE/Network/SDN/Zones/Plugin.pm b/src/PVE/Network/SDN/Zones/Plugin.pm
> index f3844ffda3b5..b3b4261c58af 100644
> --- a/src/PVE/Network/SDN/Zones/Plugin.pm
> +++ b/src/PVE/Network/SDN/Zones/Plugin.pm
> @@ -99,6 +99,17 @@ sub encode_value {
>      return $value;
>  }
>  
> +# Unreachable IPv4 and IPv6 default routes with the highest metric, so that
> +# lookups without a matching route in the VRF table do not fall through to the
> +# main table. $action is 'add' or 'del'.
> +sub vrf_unreachable_default_cmds {
> +    my ($vrf_iface, $action) = @_;
> +
> +    return map {
> +        "post-up ip${_} route $action vrf $vrf_iface unreachable default metric 4278198272"
> +    } ('', ' -6');
> +}
> +
>  sub generate_sdn_config {
>      my (
>          $class,
> diff --git a/src/PVE/Network/SDN/Zones/SimplePlugin.pm b/src/PVE/Network/SDN/Zones/SimplePlugin.pm
> index 347eee9a46ba..bc591839819d 100644
> --- a/src/PVE/Network/SDN/Zones/SimplePlugin.pm
> +++ b/src/PVE/Network/SDN/Zones/SimplePlugin.pm
> @@ -35,6 +35,11 @@ sub properties {
>              type => 'string',
>              enum => PVE::Network::SDN::Dhcp->plugin_types(),
>          },
> +        'dedicated-vrf' => {
> +            description => 'Create a dedicated VRF for the zone.',
> +            type => 'boolean',
> +            default => 0,
> +        },
>      };
>  }
>  
> @@ -47,15 +52,34 @@ sub options {
>          dnszone => { optional => 1 },
>          ipam => { optional => 1 },
>          dhcp => { optional => 1 },
> +        'dedicated-vrf' => { optional => 1 },
>      };
>  }
>  
> +sub generate_zone_config {
> +    my ($class, $plugin_config, $zone_id, $config) = @_;
> +
> +    if ($plugin_config->{'dedicated-vrf'}) {
> +        my $vrf_iface = "vrf_$zone_id";
> +        if (!defined($config->{$vrf_iface})) {
> +            $config->{$vrf_iface} = [
> +                'vrf-table auto',
> +                PVE::Network::SDN::Zones::Plugin::vrf_unreachable_default_cmds(
> +                    $vrf_iface, 'add',
> +                ),
> +            ];
> +        }
> +    }
> +
> +    return $config;
> +}
> +
>  # Plugin implementation
>  sub generate_sdn_config {
>      my (
>          $class,
>          $plugin_config,
> -        $zoneid,
> +        $zone_id,
>          $vnetid,
>          $vnet,
>          $controller,
> @@ -110,7 +134,10 @@ sub generate_sdn_config {
>          }
>  
>          #add route for /32 pointtopoint
> -        push @iface_config, "up ip route add $cidr dev $vnetid" if $mask == 32 && $ipversion == 4;
> +        if ($mask == 32 && $ipversion == 4) {
> +            my $vrf = $plugin_config->{'dedicated-vrf'} ? " vrf vrf_$zone_id" : '';
> +            push @iface_config, "up ip route add $cidr dev $vnetid$vrf";
> +        }
>          if ($subnet->{snat}) {
>              #find outgoing interface
>              my ($outip, $outiface);
> @@ -150,6 +177,7 @@ sub generate_sdn_config {
>      push @iface_config, "alias $alias" if $alias;
>      push @iface_config, "ip-forward on" if $enable_forward_v4;
>      push @iface_config, "ip6-forward on" if $enable_forward_v6;
> +    push @iface_config, "vrf vrf_$zone_id" if $plugin_config->{'dedicated-vrf'};
>  
>      push @{ $config->{$vnetid} }, @iface_config;
>  
> diff --git a/src/test/zones/simple/hetzner-vrf/expected_sdn_interfaces b/src/test/zones/simple/hetzner-vrf/expected_sdn_interfaces
> new file mode 100644
> index 000000000000..a94d091dcf50
> --- /dev/null
> +++ b/src/test/zones/simple/hetzner-vrf/expected_sdn_interfaces
> @@ -0,0 +1,27 @@
> +#version:1
> +
> +auto myvnet
> +iface myvnet
> +	address 144.76.100.65/29
> +	bridge_ports none
> +	bridge_stp off
> +	bridge_fd 0
> +	ip-forward on
> +	vrf vrf_myzone
> +
> +auto myvnet2
> +iface myvnet2
> +	address 144.76.0.1/32
> +	up ip route add 144.76.200.65/32 dev myvnet2 vrf vrf_myzone
> +	up ip route add 144.76.200.66/32 dev myvnet2 vrf vrf_myzone
> +	bridge_ports none
> +	bridge_stp off
> +	bridge_fd 0
> +	ip-forward on
> +	vrf vrf_myzone
> +
> +auto vrf_myzone
> +iface vrf_myzone
> +	vrf-table auto
> +	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
> +	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
> diff --git a/src/test/zones/simple/hetzner-vrf/interfaces b/src/test/zones/simple/hetzner-vrf/interfaces
> new file mode 100644
> index 000000000000..53e894aaa4ef
> --- /dev/null
> +++ b/src/test/zones/simple/hetzner-vrf/interfaces
> @@ -0,0 +1,6 @@
> +auto eth0
> +iface eth0 inet static
> +  address 144.76.0.1
> +  netmask 255.255.255.255
> +  pointopoint 172.31.1.1
> +  gateway 172.31.1.1
> diff --git a/src/test/zones/simple/hetzner-vrf/sdn_config b/src/test/zones/simple/hetzner-vrf/sdn_config
> new file mode 100644
> index 000000000000..847c42da81a4
> --- /dev/null
> +++ b/src/test/zones/simple/hetzner-vrf/sdn_config
> @@ -0,0 +1,34 @@
> +{
> +  version => 1,
> +  vnets   => {
> +               ids => {
> +                        myvnet => { type => "vnet", zone => "myzone" },
> +                        myvnet2 => { type => "vnet", zone => "myzone" },
> +                      },
> +             },
> +  zones   => {
> +               ids => { myzone => { ipam => "pve", type => "simple", "dedicated-vrf" => 1 } },
> +             },
> +
> +  subnets => {
> +                ids => {
> +                        'myzone-144.76.100.64-29' => {
> +                                                        'type' => 'subnet',
> +                                                        'vnet' => 'myvnet',
> +                                                        'gateway' => '144.76.100.65',
> +                                                },
> +                        'myzone-144.76.200.65-32' => {
> +                                                        'type' => 'subnet',
> +                                                        'vnet' => 'myvnet2',
> +                                                        'gateway' => '144.76.0.1',
> +                                                },
> +                        'myzone-144.76.200.66-32' => {
> +                                                        'type' => 'subnet',
> +                                                        'vnet' => 'myvnet2',
> +                                                        'gateway' => '144.76.0.1',
> +                                                },
> +                }
> +             }
> +}
> +
> +
> diff --git a/src/test/zones/simple/vrf-empty/expected_sdn_interfaces b/src/test/zones/simple/vrf-empty/expected_sdn_interfaces
> new file mode 100644
> index 000000000000..d3b7de26d460
> --- /dev/null
> +++ b/src/test/zones/simple/vrf-empty/expected_sdn_interfaces
> @@ -0,0 +1,7 @@
> +#version:1
> +
> +auto vrf_myzone
> +iface vrf_myzone
> +	vrf-table auto
> +	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
> +	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
> diff --git a/src/test/zones/simple/vrf-empty/interfaces b/src/test/zones/simple/vrf-empty/interfaces
> new file mode 100644
> index 000000000000..f1bd92ed2b43
> --- /dev/null
> +++ b/src/test/zones/simple/vrf-empty/interfaces
> @@ -0,0 +1,2 @@
> +auto lo
> +iface lo inet loopback
> diff --git a/src/test/zones/simple/vrf-empty/sdn_config b/src/test/zones/simple/vrf-empty/sdn_config
> new file mode 100644
> index 000000000000..32fd5ea50432
> --- /dev/null
> +++ b/src/test/zones/simple/vrf-empty/sdn_config
> @@ -0,0 +1,12 @@
> +{
> +  version => 1,
> +  vnets   => { ids => {} },
> +  zones   => {
> +               ids => {
> +                        myzone => {
> +                                    type => "simple",
> +                                    "dedicated-vrf" => 1,
> +                                  },
> +                      },
> +             },
> +}
> diff --git a/src/test/zones/simple/vrf/expected_sdn_interfaces b/src/test/zones/simple/vrf/expected_sdn_interfaces
> new file mode 100644
> index 000000000000..777adafa9f48
> --- /dev/null
> +++ b/src/test/zones/simple/vrf/expected_sdn_interfaces
> @@ -0,0 +1,14 @@
> +#version:1
> +
> +auto myvnet
> +iface myvnet
> +	bridge_ports none
> +	bridge_stp off
> +	bridge_fd 0
> +	vrf vrf_myzone
> +
> +auto vrf_myzone
> +iface vrf_myzone
> +	vrf-table auto
> +	post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
> +	post-up ip -6 route add vrf vrf_myzone unreachable default metric 4278198272
> diff --git a/src/test/zones/simple/vrf/interfaces b/src/test/zones/simple/vrf/interfaces
> new file mode 100644
> index 000000000000..f1bd92ed2b43
> --- /dev/null
> +++ b/src/test/zones/simple/vrf/interfaces
> @@ -0,0 +1,2 @@
> +auto lo
> +iface lo inet loopback
> diff --git a/src/test/zones/simple/vrf/sdn_config b/src/test/zones/simple/vrf/sdn_config
> new file mode 100644
> index 000000000000..c57074e1bf4a
> --- /dev/null
> +++ b/src/test/zones/simple/vrf/sdn_config
> @@ -0,0 +1,17 @@
> +{
> +  version => 1,
> +  vnets   => {
> +               ids => {
> +                        myvnet => { type => "vnet", zone => "myzone" },
> +                      },
> +             },
> +  zones   => {
> +               ids => {
> +                        myzone => {
> +                                    ipam => "pve",
> +                                    type => "simple",
> +                                    "dedicated-vrf" => 1,
> +                                  },
> +                      },
> +             },
> +}





^ permalink raw reply	[flat|nested] 65+ messages in thread

* Re: [PATCH proxmox-ve-rs v3 02/32] frr: add VRF-aware OSPF rendering
  2026-11-18 14:41   ` Stefan Hanreich
@ 2026-11-18 16:21     ` Gabriel Goller
  0 siblings, 0 replies; 65+ messages in thread
From: Gabriel Goller @ 2026-11-18 16:21 UTC (permalink / raw)
  To: Stefan Hanreich; +Cc: pve-devel

On 18.11.2026 15:41, Stefan Hanreich wrote:
> On 11/16/26 5:12 PM, Gabriel Goller wrote:
> > [snip]
> > diff --git a/proxmox-frr/src/ser/mod.rs b/proxmox-frr/src/ser/mod.rs
> > index 0f2b52138cf3..cd3025213fb9 100644
> > --- a/proxmox-frr/src/ser/mod.rs
> > +++ b/proxmox-frr/src/ser/mod.rs
> > @@ -135,6 +135,8 @@ pub struct Interface<T> {
> >      pub addresses_v4: Vec<Ipv4Cidr>,
> >      #[serde(default)]
> >      pub addresses_v6: Vec<Ipv6Cidr>,
> > +    #[serde(default)]
> > +    pub vrf: Option<VrfName>,
> 
> would it be better to add this to the concrete interface types that actually support it?

Done, added it to OspfInterface.

> >  
> >      #[serde(flatten)]
> >      pub properties: T,
> > @@ -144,6 +146,7 @@ impl From<openfabric::OpenfabricInterface> for Interface<openfabric::OpenfabricI
> >          Interface {
> >              addresses_v4: Vec::new(),
> >              addresses_v6: Vec::new(),
> > +            vrf: None,
> 
> instead of setting it to None for protocols where it isn't supported?

Makes sense.

> >              properties: value,
> >          }
> >      }
> > @@ -154,6 +157,7 @@ impl From<ospf::OspfInterface> for Interface<ospf::OspfInterface> {
> >          Interface {
> >              addresses_v4: Vec::new(),
> >              addresses_v6: Vec::new(),
> > +            vrf: None,
> >              properties: value,
> >          }
> >      }
> > @@ -248,6 +252,8 @@ pub struct OspfFrrConfig {
> >      #[serde(default)]
> >      pub router: Option<ospf::OspfRouter>,
> >      #[serde(default)]
> > +    pub vrf_router: BTreeMap<VrfName, ospf::OspfRouter>,
> 
> can we handle this the same as in BGP where the default VRF is just an entry in the map?

Also done.

> > +    #[serde(default)]
> >      pub interfaces: BTreeMap<InterfaceName, Interface<ospf::OspfInterface>>,
> >  }

Thanks for the review!




^ permalink raw reply	[flat|nested] 65+ messages in thread

* Re: [PATCH pve-network v3 16/32] sdn: allow fabrics to use simple zone VRFs
  2026-11-16 16:11 ` [PATCH pve-network v3 16/32] sdn: allow fabrics to use simple zone VRFs Gabriel Goller
@ 2026-11-18 16:27   ` Stefan Hanreich
  2026-11-19 14:14     ` Gabriel Goller
  0 siblings, 1 reply; 65+ messages in thread
From: Stefan Hanreich @ 2026-11-18 16:27 UTC (permalink / raw)
  To: pve-devel

generally we should check in the API for where we should use the new _checked helpers
and which validate_property_references methods should get extended? Here are some,
and there are probably other in this series as well - please re-check this!


On 11/16/26 5:15 PM, Gabriel Goller wrote:
> Let BGP and OSPF fabrics use a simple zone with dedicated-vrf enabled
> to keep their routes separate from the default VRF.
> 
> The zone must be enabled on every fabric node. Prevent zone changes
> or deletion that would leave a fabric without its VRF. A fabric's zone
> cannot be changed after creation, since that resets all its sessions
> anyway and other objects rely on the fabric staying in its VRF.
> 
> Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
> ---
>  src/PVE/API2/Network/SDN/Fabrics/Fabric.pm    | 57 ++++++++++++++++---
>  .../API2/Network/SDN/Fabrics/FabricNode.pm    | 18 ++++++
>  src/PVE/API2/Network/SDN/Zones.pm             | 28 +++++++++
>  src/PVE/Network/SDN/Controllers/BgpPlugin.pm  |  2 +-
>  src/PVE/Network/SDN/Fabrics.pm                | 26 +++++++++
>  5 files changed, 122 insertions(+), 9 deletions(-)
> 
> diff --git a/src/PVE/API2/Network/SDN/Fabrics/Fabric.pm b/src/PVE/API2/Network/SDN/Fabrics/Fabric.pm
> index bbc33e047154..20b7b1f98e4b 100644
> --- a/src/PVE/API2/Network/SDN/Fabrics/Fabric.pm
> +++ b/src/PVE/API2/Network/SDN/Fabrics/Fabric.pm
> @@ -6,13 +6,51 @@ use warnings;
>  use PVE::Network::SDN;
>  use PVE::Network::SDN::Controllers;
>  use PVE::Network::SDN::Fabrics;
> +use PVE::Network::SDN::Zones;
>  
> +use PVE::Exception qw(raise_param_exc);
>  use PVE::JSONSchema qw(get_standard_option);
>  use PVE::Tools qw(extract_param);
>  
>  use PVE::RESTHandler;
>  use base qw(PVE::RESTHandler);
>  
> +sub validate_fabric_zone {
> +    my ($fabric, $config) = @_;
> +
> +    my $protocol = $fabric->{protocol} // '';
> +    if ($protocol eq 'bgp' && !$fabric->{zone}) {
> +        my $controller_cfg = PVE::Network::SDN::Controllers::config();
> +        for my $controller_id (keys %{ $controller_cfg->{ids} // {} }) {
> +            my $controller = $controller_cfg->{ids}->{$controller_id};
> +            if ($controller->{type} eq 'bgp') {
> +                die "cannot configure a BGP fabric while BGP controller '$controller_id' exists:"
> +                    . " both target the default-VRF BGP router\n";
> +            }
> +        }
> +    }
> +
> +    my $zone_id = $fabric->{zone};
> +    return if !$zone_id;
> +
> +    raise_param_exc({ zone => 'VRF zones are only supported for BGP and OSPF fabrics' })
> +        if $protocol !~ /^(?:bgp|ospf)$/;
> +
> +    my $zone = PVE::Network::SDN::Zones::get_zone($zone_id);

should this use get_zone_checked instead?

> +
> +    raise_param_exc({ zone => "zone '$zone_id' does not exist" }) if !$zone;
> +    raise_param_exc({ zone => "zone '$zone_id' is not a simple zone" })
> +        if $zone->{type} ne 'simple';
> +    raise_param_exc({ zone => "zone '$zone_id' is configured to use the default VRF" })
> +        if $zone->{'default-vrf'} // 1;

Isn't that dedicated-vrf?

> +
> +    if ($config) {
> +        PVE::Network::SDN::Fabrics::assert_fabric_nodes_in_zone(
> +            $config, $fabric->{id}, $zone_id, $zone,
> +        );
> +    }
> +}
> +
>  __PACKAGE__->register_method({
>      name => 'index',
>      path => '',
> @@ -129,6 +167,8 @@ __PACKAGE__->register_method({
>      protected => 1,
>      permissions => {
>          check => ['perm', '/sdn/fabrics', ['SDN.Allocate']],
> +        description => "Assigning a VRF zone additionally requires 'SDN.Allocate' on"
> +            . " '/sdn/zones/<zone>'.",
>      },
>      parameters => {
>          properties => PVE::Network::SDN::Fabrics::fabric_properties(0),
> @@ -148,14 +188,10 @@ __PACKAGE__->register_method({
>                  my $digest = extract_param($param, 'digest');
>                  PVE::Tools::assert_if_modified($config->digest(), $digest) if $digest;
>  
> -                if (($param->{protocol} // '') eq 'bgp') {
> -                    my $controller_cfg = PVE::Network::SDN::Controllers::config();
> -                    for my $id (keys %{ $controller_cfg->{ids} // {} }) {
> -                        die "cannot add a BGP fabric while BGP controller '$id' exists:"
> -                            . " both target the default-VRF BGP router\n"
> -                            if $controller_cfg->{ids}->{$id}->{type} eq 'bgp';
> -                    }
> -                }
> +                PVE::Network::SDN::Zones::api_get_zone_checked($param->{zone}, ['SDN.Allocate'])
> +                    if $param->{zone};
> +
> +                validate_fabric_zone($param);
>  
>                  my $privs = ['SDN.Use', 'SDN.Allocate'];
>                  PVE::Network::SDN::Fabrics::api_validate_property_references($param, $privs);
> @@ -200,7 +236,12 @@ __PACKAGE__->register_method({
>                  my $privs = ['SDN.Use', 'SDN.Allocate'];
>                  PVE::Network::SDN::Fabrics::api_validate_property_references($param, $privs);

does this fn also cover the zone permissions now?

>  
> +                my $old_zone = $config->get_fabric($id)->{zone} // '';
> +                raise_param_exc({ zone => "cannot change the VRF zone of an existing fabric" })
> +                    if defined($param->{zone}) && $param->{zone} ne $old_zone;

this doesn't deny deleting the zone param.

> +
>                  $config->update_fabric($id, $param);
> +                validate_fabric_zone($config->get_fabric($id), $config);
>                  PVE::Network::SDN::Fabrics::write_config($config);
>              },
>              "updating fabric failed",
> diff --git a/src/PVE/API2/Network/SDN/Fabrics/FabricNode.pm b/src/PVE/API2/Network/SDN/Fabrics/FabricNode.pm
> index 7a148b550f7d..eb3b429075e5 100644
> --- a/src/PVE/API2/Network/SDN/Fabrics/FabricNode.pm
> +++ b/src/PVE/API2/Network/SDN/Fabrics/FabricNode.pm
> @@ -9,6 +9,7 @@ use PVE::Tools qw(extract_param run_command);
>  use PVE::Network::SDN;
>  use PVE::Network::SDN::Fabrics;
>  use PVE::Network::SDN::WireGuard;
> +use PVE::Network::SDN::Zones;
>  use PVE::RS::SDN::Fabrics;
>  
>  use PVE::RESTHandler;
> @@ -138,6 +139,21 @@ my sub is_internal_wireguard_node {
>      return $node->{protocol} eq 'wireguard' && $node->{role} eq 'internal';
>  }
>  
> +my sub validate_node_fabric_zone {
> +    my ($config, $fabric_id, $node_id) = @_;
> +
> +    my $fabric = $config->get_fabric($fabric_id);
> +    my $zone_id = $fabric->{zone};
> +    return if !$zone_id;
> +
> +    my $zone = PVE::Network::SDN::Zones::get_zone($zone_id);

should this use get_zone_checked instead?

> +
> +    die "zone '$zone_id' does not exist\n" if !$zone;
> +    PVE::Network::SDN::Fabrics::assert_fabric_node_in_zone(
> +        $fabric_id, $node_id, $zone_id, $zone,
> +    );
> +}
> +
>  __PACKAGE__->register_method({
>      name => 'add_node',
>      path => '',
> @@ -169,6 +185,8 @@ __PACKAGE__->register_method({
>                  my $digest = extract_param($param, 'digest');
>                  PVE::Tools::assert_if_modified($config->digest(), $digest) if $digest;
>  
> +                validate_node_fabric_zone($config, $param->{fabric_id}, $param->{node_id});
> +
>                  if (is_internal_wireguard_node($param) && $param->{interfaces}) {
>                      my $private_keys = PVE::Network::SDN::WireGuard::private_keys();
>  
> diff --git a/src/PVE/API2/Network/SDN/Zones.pm b/src/PVE/API2/Network/SDN/Zones.pm
> index 38d950fda076..e4f4b174466e 100644
> --- a/src/PVE/API2/Network/SDN/Zones.pm
> +++ b/src/PVE/API2/Network/SDN/Zones.pm
> @@ -11,6 +11,7 @@ use PVE::SafeSyslog;
>  use PVE::Tools qw(extract_param);
>  
>  use PVE::Network::SDN::Dns;
> +use PVE::Network::SDN::Fabrics;
>  use PVE::Network::SDN::Subnets;
>  use PVE::Network::SDN::Vnets;
>  use PVE::Network::SDN;
> @@ -363,6 +364,13 @@ sub create_etc_interfaces_sdn_dir {
>      mkdir("/etc/pve/sdn");
>  }
>  
> +sub fabrics_using_zone {
> +    my ($zone_id, $fabric_config) = @_;
> +
> +    my $fabrics = $fabric_config->list_fabrics();
> +    return grep { ($fabrics->{$_}->{zone} // '') eq $zone_id } sort keys $fabrics->%*;
> +}
> +
>  __PACKAGE__->register_method({
>      name => 'create',
>      protected => 1,
> @@ -475,6 +483,22 @@ __PACKAGE__->register_method({
>  
>                  $scfg->{$_} = $opts->{$_} for keys $opts->%*;
>  
> +                my $fabric_config = PVE::Network::SDN::Fabrics::config();
> +                my @fabric_ids = fabrics_using_zone($id, $fabric_config);
> +
> +                if (@fabric_ids && $scfg->{type} eq 'simple' && !$scfg->{'dedicated-vrf'}) {
> +                    raise_param_exc({
> +                        'dedicated-vrf' =>
> +                            "zone is still used as VRF by fabric '$fabric_ids[0]'",
> +                    });
> +                }
> +
> +                for my $fabric_id (@fabric_ids) {
> +                    PVE::Network::SDN::Fabrics::assert_fabric_nodes_in_zone(
> +                        $fabric_config, $fabric_id, $id, $scfg,
> +                    );
> +                }
> +
>                  my $new_ipam = $scfg->{ipam};
>                  if (!$new_ipam != !$old_ipam || (($new_ipam // '') ne ($old_ipam // ''))) {
>                      # don't allow ipam change if subnet are defined for now, need to implement resync ipam content
> @@ -547,6 +571,10 @@ __PACKAGE__->register_method({
>                  my $plugin = PVE::Network::SDN::Zones::Plugin->lookup($scfg->{type});
>                  my $vnet_cfg = PVE::Network::SDN::Vnets::config();
>  
> +                my $fabric_config = PVE::Network::SDN::Fabrics::config();
> +                my @fabric_ids = fabrics_using_zone($id, $fabric_config);
> +                die "zone is still used as VRF by fabric '$fabric_ids[0]'\n" if @fabric_ids;
> +
>                  $plugin->on_delete_hook($id, $vnet_cfg);
>  
>                  delete $cfg->{ids}->{$id};
> diff --git a/src/PVE/Network/SDN/Controllers/BgpPlugin.pm b/src/PVE/Network/SDN/Controllers/BgpPlugin.pm
> index 537b46229e58..328246ce7d77 100644
> --- a/src/PVE/Network/SDN/Controllers/BgpPlugin.pm
> +++ b/src/PVE/Network/SDN/Controllers/BgpPlugin.pm
> @@ -209,7 +209,7 @@ sub on_update_hook {
>      for my $id (keys %$fabrics) {
>          die "cannot configure a BGP controller while BGP fabric '$id' exists:"
>              . " both target the default-VRF BGP router\n"
> -            if $fabrics->{$id}->{protocol} eq 'bgp';
> +            if $fabrics->{$id}->{protocol} eq 'bgp' && !$fabrics->{$id}->{zone};
>      }
>  
>      my $controller = $controller_cfg->{ids}->{$controllerid};
> diff --git a/src/PVE/Network/SDN/Fabrics.pm b/src/PVE/Network/SDN/Fabrics.pm
> index 41119b2ec782..e7cec1fe9582 100644
> --- a/src/PVE/Network/SDN/Fabrics.pm
> +++ b/src/PVE/Network/SDN/Fabrics.pm
> @@ -229,6 +229,23 @@ sub write_config {
>      cfs_write_file("sdn/fabrics.cfg", $config->to_raw(), 1);
>  }
>  
> +sub assert_fabric_node_in_zone {
> +    my ($fabric_id, $node_id, $zone_id, $zone) = @_;
> +
> +    return if !defined($zone->{nodes}) || $zone->{nodes}->{$node_id};
> +
> +    die "fabric '$fabric_id' contains node '$node_id', which is not enabled for zone '$zone_id'\n";
> +}
> +
> +sub assert_fabric_nodes_in_zone {
> +    my ($config, $fabric_id, $zone_id, $zone) = @_;
> +
> +    my $nodes = $config->list_nodes_fabric($fabric_id);
> +    for my $node_id (sort keys $nodes->%*) {
> +        assert_fabric_node_in_zone($fabric_id, $node_id, $zone_id, $zone);
> +    }
> +}
> +
>  sub get_frr_daemon_status {
>      my ($fabric_config) = @_;
>  
> @@ -512,6 +529,15 @@ sub fabric_properties {
>          protocol => get_standard_option('pve-sdn-fabric-protocol'),
>          digest => get_standard_option('pve-config-digest'),
>          'lock-token' => get_standard_option('pve-sdn-lock-token'),
> +        zone => get_standard_option(
> +            'pve-sdn-zone-id',
> +            {
> +                description => 'Simple zone whose VRF contains this fabric.',
> +                'type-property' => 'protocol',
> +                'instance-types' => ['bgp', 'ospf'],
> +                optional => 1,
> +            },
> +        ),
>          ip_prefix => {
>              type => 'string',
>              format => 'CIDR',





^ permalink raw reply	[flat|nested] 65+ messages in thread

* Re: [PATCH pve-network v3 17/32] sdn: require underlay fabrics to use the default VRF
  2026-11-16 16:11 ` [PATCH pve-network v3 17/32] sdn: require underlay fabrics to use the default VRF Gabriel Goller
@ 2026-11-18 16:30   ` Stefan Hanreich
  2026-11-19 14:33     ` Gabriel Goller
  0 siblings, 1 reply; 65+ messages in thread
From: Stefan Hanreich @ 2026-11-18 16:30 UTC (permalink / raw)
  To: pve-devel

On 11/16/26 5:14 PM, Gabriel Goller wrote:
> EVPN controllers and VXLAN zones set up their VTEPs and BGP peering in
> the default VRF, so an underlay fabric in a zone VRF breaks them. A
> fabric's VRF cannot change after creation, so checking the fabric when
> a controller or zone references it is enough.
> 
> Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
> ---
>  src/PVE/Network/SDN/Controllers/EvpnPlugin.pm |  2 ++
>  src/PVE/Network/SDN/Fabrics.pm                | 10 ++++++++++
>  src/PVE/Network/SDN/Zones/VxlanPlugin.pm      |  5 +++++
>  3 files changed, 17 insertions(+)
> 
> diff --git a/src/PVE/Network/SDN/Controllers/EvpnPlugin.pm b/src/PVE/Network/SDN/Controllers/EvpnPlugin.pm
> index 4220cb6721e5..67afe936ecc9 100644
> --- a/src/PVE/Network/SDN/Controllers/EvpnPlugin.pm
> +++ b/src/PVE/Network/SDN/Controllers/EvpnPlugin.pm
> @@ -688,6 +688,8 @@ sub on_update_hook {
>          die "must have exactly one of peers / fabric defined"
>              if ($controller->{peers} && $controller->{fabric})
>              || !($controller->{peers} || $controller->{fabric});
> +        PVE::Network::SDN::Fabrics::assert_underlay_fabric($controller->{fabric})
> +            if $controller->{fabric};
>          if ($controller->{peers}) {
>              my @peers = PVE::Tools::split_list($controller->{peers});
>              my $family;
> diff --git a/src/PVE/Network/SDN/Fabrics.pm b/src/PVE/Network/SDN/Fabrics.pm
> index e7cec1fe9582..a9ea0b74301e 100644
> --- a/src/PVE/Network/SDN/Fabrics.pm
> +++ b/src/PVE/Network/SDN/Fabrics.pm
> @@ -246,6 +246,16 @@ sub assert_fabric_nodes_in_zone {
>      }
>  }
>  
> +sub assert_underlay_fabric {
> +    my ($fabric_id) = @_;
> +
> +    my $fabric = eval { config()->get_fabric($fabric_id) };
> +    die "fabric '$fabric_id' does not exist\n" if !$fabric;
> +    die "fabric '$fabric_id' is in the VRF of zone '$fabric->{zone}', underlay fabrics must use"
> +        . " the default VRF\n"
> +        if $fabric->{zone};

potentially needs permissions checks here to at least prevent information leaks?

> +}
> +
>  sub get_frr_daemon_status {
>      my ($fabric_config) = @_;
>  
> diff --git a/src/PVE/Network/SDN/Zones/VxlanPlugin.pm b/src/PVE/Network/SDN/Zones/VxlanPlugin.pm
> index b8b1ef0eeb7f..059bc90f4211 100644
> --- a/src/PVE/Network/SDN/Zones/VxlanPlugin.pm
> +++ b/src/PVE/Network/SDN/Zones/VxlanPlugin.pm
> @@ -167,6 +167,11 @@ sub on_update_hook {
>              fabric => "must have exactly one of peers / fabric defined",
>          });
>      }
> +
> +    if ($zone->{fabric}) {
> +        eval { PVE::Network::SDN::Fabrics::assert_underlay_fabric($zone->{fabric}) };
> +        raise_param_exc({ fabric => "$@" }) if $@;
> +    }
>  }
>  
>  sub vnet_update_hook {





^ permalink raw reply	[flat|nested] 65+ messages in thread

* Re: [PATCH pve-network v3 14/32] sdn: evpn: add unreachable IPv6 default route to zone VRFs
  2026-11-18 16:08   ` Stefan Hanreich
@ 2026-11-18 16:39     ` Stefan Hanreich
  2026-11-19 13:38       ` Gabriel Goller
  0 siblings, 1 reply; 65+ messages in thread
From: Stefan Hanreich @ 2026-11-18 16:39 UTC (permalink / raw)
  To: pve-devel

On 11/18/26 5:08 PM, Stefan Hanreich wrote:
> could be added upfront independentenly
> 
> Reviewed-by: Stefan Hanreich <s.hanreich@proxmox.com>
on second thought: how does this behave if IPv6 is disabled?




^ permalink raw reply	[flat|nested] 65+ messages in thread

* Re: [PATCH pve-network v3 21/32] sdn: simple: support static routes in zone routing tables
  2026-11-16 16:11 ` [PATCH pve-network v3 21/32] sdn: simple: support static routes in zone routing tables Gabriel Goller
@ 2026-11-18 16:49   ` Stefan Hanreich
  2026-11-19 14:53     ` Gabriel Goller
  0 siblings, 1 reply; 65+ messages in thread
From: Stefan Hanreich @ 2026-11-18 16:49 UTC (permalink / raw)
  To: pve-devel

On 11/16/26 5:16 PM, Gabriel Goller wrote:
> Allow simple zones to reach outside networks through static routes,
> without needing a fabric. Routes use the zone's dedicated VRF, or the
> default routing table if dedicated-vrf is disabled.
> 
> Support IPv4 and IPv6 routes, including default routes, with a gateway
> or an outgoing interface. nexthop-vrf allows a gateway in another VRF,
> e.g. the default VRF, without moving the uplink into the zone.
> 
> Routes are managed by FRR, so zones with static routes need FRR even
> without a controller or fabric. This requires the matching pve-rs
> support for route validation and FRR config generation.
> 
> Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
> ---
>  src/PVE/API2/Network/SDN/Zones.pm         |   9 ++
>  src/PVE/Network/SDN.pm                    |  22 ++-
>  src/PVE/Network/SDN/Zones/Plugin.pm       |  55 +++++++
>  src/PVE/Network/SDN/Zones/SimplePlugin.pm |   1 +
>  src/test/Makefile                         |   5 +-
>  src/test/run_test_static_routes.pl        | 178 ++++++++++++++++++++++
>  6 files changed, 266 insertions(+), 4 deletions(-)
>  create mode 100644 src/test/run_test_static_routes.pl
> 
> diff --git a/src/PVE/API2/Network/SDN/Zones.pm b/src/PVE/API2/Network/SDN/Zones.pm
> index e4f4b174466e..8df1bf8527fd 100644
> --- a/src/PVE/API2/Network/SDN/Zones.pm
> +++ b/src/PVE/API2/Network/SDN/Zones.pm
> @@ -68,6 +68,15 @@ my $ZONE_PROPERTIES = {
>          optional => 1,
>          description => 'Create a dedicated VRF for a simple zone.',
>      },
> +    route => {
> +        type => 'array',
> +        optional => 1,
> +        description => 'Static routes in the zone routing table. Simple zone only.',
> +        items => {
> +            type => 'string',
> +            format => 'pve-sdn-static-route',
> +        },
> +    },
>      'rt-import' => {
>          type => 'string',
>          optional => 1,
> diff --git a/src/PVE/Network/SDN.pm b/src/PVE/Network/SDN.pm
> index 9373ec3035fa..626fe7387f54 100644
> --- a/src/PVE/Network/SDN.pm
> +++ b/src/PVE/Network/SDN.pm
> @@ -17,6 +17,7 @@ use PVE::RESTEnvironment qw(log_warn);
>  use PVE::RPCEnvironment;
>  use PVE::Tools qw(file_get_contents file_set_contents extract_param dir_glob_regex run_command);
>  
> +use PVE::RS::SDN;
>  use PVE::RS::SDN::Fabrics;
>  
>  use PVE::Network::SDN::Vnets;
> @@ -130,10 +131,19 @@ sub running_config_has_frr {
>      my $fabrics = $running_config->{fabrics}->{ids} // {};
>      my $route_maps = $running_config->{'route-maps'}->{ids} // {};
>      my $prefix_lists = $running_config->{'prefix-lists'}->{ids} // {};
> +    my $zones = $running_config->{zones}->{ids} // {};
> +    my $zone_routes =
> +        grep { $_->{type} eq 'simple' && scalar(@{ $_->{route} // [] }) } values %$zones;
>  
>      my $local_frr_config = PVE::Network::SDN::Frr::local_frr_config_exists();
>  
> -    return %$controllers || %$fabrics || %$route_maps || %$prefix_lists || $local_frr_config;
> +    return
> +        %$controllers
> +        || %$fabrics
> +        || %$route_maps
> +        || %$prefix_lists
> +        || $zone_routes
> +        || $local_frr_config;
>  }
>  
>  sub pending_config {
> @@ -563,11 +573,14 @@ sub generate_frr_raw_config {
>  
>      my $frr_config = {};
>  
> +    my $nodename = PVE::INotify::nodename();
> +
>      PVE::Network::SDN::Controllers::generate_frr_config($frr_config, $running_config);
> +    my $routes =
> +        PVE::RS::SDN::get_zone_routes($running_config->{zones} // { ids => {} }, $nodename);
> +    push @{ $frr_config->{frr}->{ip_routes} }, @$routes;

so static routes in simple zones are handled by staticd? Seems a bit odd at least.
What happens if there's only a simple zone with static routes? Is there a better
way?

>      PVE::Network::SDN::Frr::append_local_config($frr_config);
>  
> -    my $nodename = PVE::INotify::nodename();
> -
>      return PVE::RS::SDN::get_frr_raw_config(
>          $frr_config->{'frr'},
>          $prefix_list_config,
> @@ -619,6 +632,9 @@ sub generate_dhcp_config {
>  sub encode_value {
>      my ($type, $key, $value) = @_;
>  
> +    # Route strings contain commas themselves, so preserve array element boundaries.
> +    return join("\n", sort @$value) if $key eq 'route' && ref($value) eq 'ARRAY';
> +
>      if (
>          $key eq 'nodes'
>          || $key eq 'exitnodes'
> diff --git a/src/PVE/Network/SDN/Zones/Plugin.pm b/src/PVE/Network/SDN/Zones/Plugin.pm
> index dc8f19cb6587..a3863bc9818c 100644
> --- a/src/PVE/Network/SDN/Zones/Plugin.pm
> +++ b/src/PVE/Network/SDN/Zones/Plugin.pm
> @@ -8,6 +8,7 @@ use Net::IP qw(ip_get_version);
>  use PVE::JSONSchema;
>  use PVE::Cluster;
>  use PVE::Network;
> +use PVE::RS::SDN;
>  
>  use PVE::JSONSchema qw(get_standard_option);
>  use base qw(PVE::SectionConfig);
> @@ -29,6 +30,50 @@ PVE::JSONSchema::register_standard_option(
>      },
>  );
>  
> +my $static_route_fmt = {
> +    prefix => {
> +        type => 'string',
> +        description => 'Destination prefix in CIDR notation, including default routes.',

add a format here

> +    },
> +    via => {
> +        type => 'string',
> +        format => 'ip',
> +        optional => 1,
> +        description => 'Next-hop IP address. IPv6 link-local addresses require an interface.',
> +    },
> +    iface => {
> +        type => 'string',
> +        optional => 1,
> +        description => 'Outgoing interface. At least one of via or iface is required.',

add a format here

> +    },
> +    distance => {
> +        type => 'integer',
> +        minimum => 1,
> +        maximum => 255,
> +        optional => 1,
> +        description => 'Administrative distance.',
> +    },
> +    'nexthop-vrf' => {
> +        type => 'string',
> +        optional => 1,
> +        description => 'VRF of the next hop, or default for the default routing table.',

add a format here




^ permalink raw reply	[flat|nested] 65+ messages in thread

* Re: [PATCH proxmox-ve-rs v3 03/32] sdn: add zone references to OSPF and BGP fabrics
  2026-11-18 14:10   ` Stefan Hanreich
@ 2026-11-18 16:55     ` Gabriel Goller
  0 siblings, 0 replies; 65+ messages in thread
From: Gabriel Goller @ 2026-11-18 16:55 UTC (permalink / raw)
  To: Stefan Hanreich; +Cc: pve-devel

On 18.11.2026 15:10, Stefan Hanreich wrote:
> Is there a reason why updating / deleting a zone is implemented here, but
> rejected in pve-network? Afaict deleting a zone actually works from the
> API as the checks there are insufficient? Can we just add #[updater(skip)]
> here and remove zone from the deletable properties?

Doesn't work because `zone` is not in the deletable properties:

root@node1:~# pvesh set /cluster/sdn/fabrics/fabric/test --protocol ospf --delete zone
400 Parameter verification failed.
delete[0]: value 'zone' does not have a value in the enumeration 'area, redistribute, route_filter'
pvesh set <api_path> --protocol <string> [OPTIONS] [FORMAT_OPTIONS]

Either way removed the unused rust updater stuff. This was a leftover from the
previous version.

Thanks for the review!




^ permalink raw reply	[flat|nested] 65+ messages in thread

* Re: [PATCH proxmox-ve-rs v3 04/32] sdn: generate fabric routing configuration in zone VRFs
  2026-11-18 14:53   ` Stefan Hanreich
@ 2026-11-18 17:26     ` Gabriel Goller
  0 siblings, 0 replies; 65+ messages in thread
From: Gabriel Goller @ 2026-11-18 17:26 UTC (permalink / raw)
  To: Stefan Hanreich; +Cc: pve-devel

On 18.11.2026 15:53, Stefan Hanreich wrote:
> On 11/16/26 5:12 PM, Gabriel Goller wrote:
> > Map a fabric zone to the corresponding vrf_<zone> FRR instance. Generate
> > OSPF routers and interfaces in that VRF, and store BGP routers under the
> > same VRF name. Keep fabrics without a zone in the default routing table.
> > 
> > Collect OSPF redistribution rules on the router for the selected VRF so
> > that several fabrics in one VRF contribute to the same OSPF instance.
> 
> should we just disallow multiple fabrics in the same zone (except default)
> for now? Save us a lot of hassle and complexity, and could be introduced
> later if so desired?

Hmm I don't we think we can remove a lot of code by disallowing that... Most
of the mechanics already exist because we allow multiple fabrics in the default
vrf. We just key some stuff by vrf as well.

The only change here is that we merge together all the redistributions for all
the ospf fabrics in a vrf. This currently doesn't work on master with multiple
ospf fabrics on the default vrf -- so we'd have to fix that anyway.




^ permalink raw reply	[flat|nested] 65+ messages in thread

* Re: [PATCH proxmox-ve-rs v3 06/32] tests: fabrics: add test for fabrics in VRFs
  2026-11-18 15:01   ` Stefan Hanreich
@ 2026-11-18 17:33     ` Gabriel Goller
  0 siblings, 0 replies; 65+ messages in thread
From: Gabriel Goller @ 2026-11-18 17:33 UTC (permalink / raw)
  To: Stefan Hanreich; +Cc: pve-devel

On 18.11.2026 16:01, Stefan Hanreich wrote:
> I can think of a few additional scenarios worth testing:
> 
> * add a fabric in the default VRF
> * redistributions
> * route filters enabled
> * IPv6

Done, added the tests.

Thanks for the review




^ permalink raw reply	[flat|nested] 65+ messages in thread

* Re: [PATCH pve-network v3 23/32] sdn: zones: SNAT via dedicated uplinks in zone VRFs
  2026-11-16 16:11 ` [PATCH pve-network v3 23/32] sdn: zones: SNAT via dedicated uplinks in zone VRFs Gabriel Goller
@ 2026-11-18 18:07   ` Stefan Hanreich
  0 siblings, 0 replies; 65+ messages in thread
From: Stefan Hanreich @ 2026-11-18 18:07 UTC (permalink / raw)
  To: pve-devel

SNAT has some problems, as it doesn't work with the nftables firewall at all,
but we have some CT problems regardless methinks. I think we have to set the
CT zone for *every* packet in *every* direction as soon as the packet enters
the networking stack. That's because we have overlapping subnets now in
simple zones  even if we don't implement SNAT at all as otherwise
this could be problematic for hosts that have the firewall enabled and
use VRFs since CT entries can clash!

We have to set the zone probably at all of those points:

* in PREROUTING on the vnet / fwbr with appropriate priority (-300)
  for traffic exiting guests
* in OUTPUT for non-guest interfaces
  for traffic being sent by interfaces in the VRF (dnsmasq!)
* in PREROUTING for the non-guest interfaces with appropriate priority
  for traffic entering the zone through physical interfaces

We can only do this for simple zones for now. I think we could manage with
SNAT in simple zones, but only when the uplink is dedicated to the VRF
(with the changes above!) - shared uplink I'd drop.

There are also some other issues, that we've also already touched in my
initial reply, I have looked at some of those things more in-depth and
there's a lot of stuff I need to dive in deeper here - I've stoppped for
now to finish the review...


Also, zone CT IDs aren't stable when creating a new zone that is
alphabetically before another zone that uses VRFs.


On 11/16/26 5:17 PM, Gabriel Goller wrote:
> SNAT for subnets in a zone VRF resolved the outgoing interface and source
> address in the default routing table, so the generated rule never matched
> traffic leaving through the VRF. Allow moving a dedicated uplink into the
> VRF instead, which keeps the zone isolated from the default routing table.
> 
> The uplink is derived from the zone's default route, or else from the
> gateway of a host interface in the VRF, since the config is generated before
> ifreload creates the VRF and moves the interface into it. Only without
> either, e.g. for a DHCP uplink, the VRF routing table is queried. MASQUERADE is used if the
> uplink has no static address. Simple zones with a VRF never fall back to
> the default routing table, EVPN exit nodes without a dedicated uplink keep
> the current behavior.
> 
> As subnets can overlap between zones, connections from the vnets of such
> zones are put into a conntrack zone per VRF in the original direction.
> Replies are found via their NATed reply tuple in the default zone, so the
> uplink needs no rule. The conntrack zone ID is hashed from the VRF name to
> stay stable across reloads.
> 
> Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
> ---
>  src/PVE/Network/SDN/Zones.pm                  |   3 +-
>  src/PVE/Network/SDN/Zones/EvpnPlugin.pm       |  51 +++---
>  src/PVE/Network/SDN/Zones/Plugin.pm           | 157 +++++++++++++++++-
>  src/PVE/Network/SDN/Zones/SimplePlugin.pm     |  46 +++--
>  src/test/run_test_zones.pl                    |   4 +-
>  .../expected_controller_config                |  79 +++++++++
>  .../expected_sdn_interfaces                   |  73 ++++++++
>  .../evpn/exitnode_snat_vrf_uplink/interfaces  |  16 ++
>  .../evpn/exitnode_snat_vrf_uplink/sdn_config  |  42 +++++
>  .../vrf_snat_uplink/expected_sdn_interfaces   |  92 ++++++++++
>  .../zones/simple/vrf_snat_uplink/interfaces   |  26 +++
>  .../zones/simple/vrf_snat_uplink/sdn_config   |  84 ++++++++++
>  12 files changed, 632 insertions(+), 41 deletions(-)
>  create mode 100644 src/test/zones/evpn/exitnode_snat_vrf_uplink/expected_controller_config
>  create mode 100644 src/test/zones/evpn/exitnode_snat_vrf_uplink/expected_sdn_interfaces
>  create mode 100644 src/test/zones/evpn/exitnode_snat_vrf_uplink/interfaces
>  create mode 100644 src/test/zones/evpn/exitnode_snat_vrf_uplink/sdn_config
>  create mode 100644 src/test/zones/simple/vrf_snat_uplink/expected_sdn_interfaces
>  create mode 100644 src/test/zones/simple/vrf_snat_uplink/interfaces
>  create mode 100644 src/test/zones/simple/vrf_snat_uplink/sdn_config
> 
> diff --git a/src/PVE/Network/SDN/Zones.pm b/src/PVE/Network/SDN/Zones.pm
> index 1d3ad22c1cd5..0f64f39f6ac6 100644
> --- a/src/PVE/Network/SDN/Zones.pm
> +++ b/src/PVE/Network/SDN/Zones.pm
> @@ -133,6 +133,7 @@ sub generate_etc_network_config {
>      #generate configuration
>      my $config = {};
>      my $nodename = PVE::INotify::nodename();
> +    my $vrf_ct_zones = PVE::Network::SDN::Zones::Plugin::get_vrf_ct_zones($zone_ids);
>  
>      for my $zone_id (sort keys %$zone_ids) {
>          my $plugin_config = $zone_ids->{$zone_id};
> @@ -168,7 +169,7 @@ sub generate_etc_network_config {
>          my $plugin = PVE::Network::SDN::Zones::Plugin->lookup($plugin_config->{type});
>          eval {
>              $plugin->generate_sdn_config(
> -                $plugin_config,
> +                { %$plugin_config, 'vrf-ct-zone' => $vrf_ct_zones->{$zone} },
>                  $zone,
>                  $id,
>                  $vnet,
> diff --git a/src/PVE/Network/SDN/Zones/EvpnPlugin.pm b/src/PVE/Network/SDN/Zones/EvpnPlugin.pm
> index 1933ce86f997..b4b4ab450384 100644
> --- a/src/PVE/Network/SDN/Zones/EvpnPlugin.pm
> +++ b/src/PVE/Network/SDN/Zones/EvpnPlugin.pm
> @@ -268,6 +268,7 @@ sub generate_sdn_config {
>      my $ipv6 = undef;
>      my $enable_forward_v4 = undef;
>      my $enable_forward_v6 = undef;
> +    my $ct_zones = {};
>      my $subnets = PVE::Network::SDN::Vnets::get_subnets($vnetid, 1);
>      foreach my $subnetid (sort keys %{$subnets}) {
>          my $subnet = $subnets->{$subnetid};
> @@ -280,50 +281,62 @@ sub generate_sdn_config {
>              $address->{$gateway} = 1;
>          }
>  
> -        my $iptables = undef;
>          my $checkrouteip = undef;
>          my $ipversion = Net::IP::ip_is_ipv6($gateway) ? 6 : 4;
>  
>          if ($ipversion == 6) {
>              $ipv6 = 1;
> -            $iptables = "ip6tables";
>              $checkrouteip = '2001:4860:4860::8888';
>              $enable_forward_v6 = 1 if $gateway;
>          } else {
>              $ipv4 = 1;
> -            $iptables = "iptables";
>              $checkrouteip = '8.8.8.8';
>              $enable_forward_v4 = 1 if $gateway;
>          }
>  
> -        if ($subnet->{snat}) {
> +        if ($subnet->{snat} && $is_evpn_gateway) {
>  
>              #find outgoing interface
> -            my ($outip, $outiface);
> +            my ($outip, $outiface, $ct_zone);
>              eval {
> -                ($outip, $outiface) =
> -                    PVE::Network::SDN::Zones::Plugin::get_local_route_ip($checkrouteip);
> +                ($outip, $outiface) = PVE::Network::SDN::Zones::Plugin::find_dedicated_uplink(
> +                    $zoneid, $plugin_config, $ipversion, $interfaces_config,
> +                );
> +                if ($outiface) {
> +                    $ct_zone = $plugin_config->{'vrf-ct-zone'};
> +                } else {
> +                    # the VRF of exit nodes falls through to the default routing table
> +                    ($outip, $outiface) =
> +                        PVE::Network::SDN::Zones::Plugin::get_local_route_ip($checkrouteip);
> +                    $outiface = undef if !$outip;
> +                }
>              };
>              if ($@) {
>                  my $msg = "interface for SNAT could not be resolved: $@";
>                  log_warn($msg);
>                  next;
>              }
> -            if ($outip && $outiface && $is_evpn_gateway) {
> -                #use snat, faster than masquerade
> -                push @iface_config,
> -                    "post-up $iptables -t nat -A POSTROUTING -s '$cidr' -o $outiface -j SNAT --to-source $outip";
> -                push @iface_config,
> -                    "post-down $iptables -t nat -D POSTROUTING -s '$cidr' -o $outiface -j SNAT --to-source $outip";
> -                #add conntrack zone once on outgoing interface
> -                push @iface_config,
> -                    "post-up $iptables -t raw -I PREROUTING -i fwbr+ -j CT --zone 1";
> -                push @iface_config,
> -                    "post-down $iptables -t raw -D PREROUTING -i fwbr+ -j CT --zone 1";
> -            }
> +            next if !$outiface;
> +
> +            $ct_zones->{$ipversion} = $ct_zone if defined($ct_zone);
> +            push @iface_config,
> +                PVE::Network::SDN::Zones::Plugin::generate_snat_config(
> +                    $ipversion, $cidr, $outip, $outiface,
> +                );
>          }
>      }
>  
> +    # also for traffic routed from other nodes via the L3VNI
> +    for my $ipversion (sort keys %$ct_zones) {
> +        push @iface_config,
> +            PVE::Network::SDN::Zones::Plugin::generate_vrf_ct_zone_config(
> +                $ipversion,
> +                $ct_zones->{$ipversion},
> +                $vnetid,
> +                "vrfbr_$zoneid",
> +            );
> +    }
> +
>      push @iface_config, "hwaddress $mac" if $mac;
>      push @iface_config, "bridge_ports $vxlan_iface";
>      push @iface_config, "bridge_stp off";
> diff --git a/src/PVE/Network/SDN/Zones/Plugin.pm b/src/PVE/Network/SDN/Zones/Plugin.pm
> index a3863bc9818c..5c4dafd01c9f 100644
> --- a/src/PVE/Network/SDN/Zones/Plugin.pm
> +++ b/src/PVE/Network/SDN/Zones/Plugin.pm
> @@ -4,6 +4,7 @@ use strict;
>  use warnings;
>  
>  use PVE::Tools qw(run_command);
> +use Digest::SHA;
>  use Net::IP qw(ip_get_version);
>  use PVE::JSONSchema;
>  use PVE::Cluster;
> @@ -378,13 +379,15 @@ sub get_iface_addresses {
>  }
>  
>  sub get_local_route_ip {
> -    my ($targetip) = @_;
> +    my ($targetip, $vrf) = @_;
>  
>      my $ip = undef;
>      my $interface = undef;
>  
>      run_command(
> -        ['/sbin/ip', 'route', 'get', $targetip],
> +        ['/sbin/ip', 'route', 'get', $targetip, defined($vrf) ? ('vrf', $vrf) : ()],
> +        # a missing VRF or route is expected on the first apply, and handled by the caller
> +        defined($vrf) ? (errfunc => sub { }) : (),
>          outfunc => sub {
>              if ($_[0] =~ m/src ($PVE::Tools::IPRE)/) {
>                  $ip = $1;
> @@ -398,6 +401,156 @@ sub get_local_route_ip {
>      return ($ip, $interface);
>  }
>  
> +# Assign each zone with a VRF a conntrack zone, so that identical connections
> +# from overlapping subnets in different VRFs do not clash.
> +#
> +# The ID is derived from the VRF name, so it only changes if a zone with a
> +# colliding hash is added. Zones 0 (default) and 1 (fwbr+ bridges) are reserved.
> +sub get_vrf_ct_zones {
> +    my ($zones) = @_;
> +
> +    my $ct_zones = {};
> +    my $used = {};
> +
> +    for my $zone_id (sort keys %$zones) {
> +        my $zone = $zones->{$zone_id};
> +        next if $zone->{type} ne 'evpn' && !($zone->{type} eq 'simple' && $zone->{'dedicated-vrf'});
> +
> +        my $ct_zone = 2 + unpack('n', Digest::SHA::sha256("vrf_$zone_id")) % 65534;
> +        $ct_zone = $ct_zone == 65535 ? 2 : $ct_zone + 1 while $used->{$ct_zone};
> +
> +        $used->{$ct_zone} = 1;
> +        $ct_zones->{$zone_id} = $ct_zone;
> +    }
> +
> +    return $ct_zones;
> +}
> +
> +# Return the zone's default route of the given IP version with the lowest
> +# administrative distance.
> +sub find_zone_default_route {
> +    my ($plugin_config, $ipversion) = @_;
> +
> +    my @routes;
> +    for my $route_str (@{ $plugin_config->{route} // [] }) {
> +        my $route = PVE::JSONSchema::parse_property_string('pve-sdn-static-route', $route_str);
> +        my ($ip, $mask) = split(/\//, $route->{prefix}, 2);
> +        next if !defined($mask) || $mask != 0 || (ip_get_version($ip) // 0) != $ipversion;
> +        push @routes, $route;
> +    }
> +
> +    my ($route) = sort { ($a->{distance} // 1) <=> ($b->{distance} // 1) } @routes;
> +    return $route;
> +}
> +
> +# Resolve the dedicated SNAT uplink of a zone, i.e. the host interface in the
> +# zone VRF that the default route of the given IP version points to.
> +#
> +# The uplink is resolved from the configuration if possible, since neither the
> +# VRF nor its routes exist on the first apply. A default route of the zone takes
> +# precedence over an interface in the VRF with a gateway. Without either, e.g.
> +# if the uplink gets its gateway via DHCP, the VRF routing table is queried.
> +#
> +# Returns ($ip, $iface), with $ip undef if the uplink has no static address, or
> +# nothing if the zone has no dedicated uplink. Dies if the default route has its
> +# next hop in the zone VRF, but not via an interface in it.
> +sub find_dedicated_uplink {
> +    my ($zone_id, $plugin_config, $ipversion, $interfaces_config) = @_;
> +
> +    my $vrf = "vrf_$zone_id";
> +    my $ifaces = $interfaces_config->{ifaces} // {};
> +    my ($address_key, $method_key, $cidr_key, $gateway_key) =
> +        $ipversion == 6
> +        ? ('address6', 'method6', 'cidr6', 'gateway6')
> +        : ('address', 'method', 'cidr', 'gateway');
> +
> +    my $is_member = sub {
> +        my ($iface) = @_;
> +        return defined($iface) && ($ifaces->{$iface}->{vrf} // '') eq $vrf;
> +    };
> +
> +    my $iface;
> +    if (my $route = find_zone_default_route($plugin_config, $ipversion)) {
> +        return if ($route->{'nexthop-vrf'} // $vrf) ne $vrf;
> +
> +        $iface = $route->{iface};
> +        if (!defined($iface) && defined(my $via = $route->{via})) {
> +            ($iface) = grep {
> +                $is_member->($_)
> +                    && $ifaces->{$_}->{$cidr_key}
> +                    && PVE::Network::is_ip_in_cidr($via, $ifaces->{$_}->{$cidr_key}, $ipversion)
> +            } sort keys %$ifaces;
> +        }
> +
> +        die "default route of zone '$zone_id' is not via an interface in $vrf\n"
> +            if !$is_member->($iface);
> +    } elsif (
> +        my @gw_ifaces =
> +        grep { $is_member->($_) && $ifaces->{$_}->{$gateway_key} } sort keys %$ifaces
> +    ) {
> +        # ifupdown2 installs the gateway into the VRF routing table
> +        $iface = $gw_ifaces[0];
> +    } else {
> +        my $targetip = $ipversion == 6 ? '2001:4860:4860::8888' : '8.8.8.8';
> +        # fails if the VRF or its default route do not exist yet
> +        (undef, $iface) = eval { get_local_route_ip($targetip, $vrf) };
> +        return if !$is_member->($iface);
> +    }
> +
> +    my $ip;
> +    if (($ifaces->{$iface}->{$method_key} // '') eq 'static') {
> +        $ip = $ifaces->{$iface}->{$address_key};
> +        $ip = $ip->[0] if ref($ip) eq 'ARRAY';
> +    }
> +
> +    return ($ip, $iface);
> +}
> +
> +my sub generate_iptables_rules {
> +    my ($ipversion, @rules) = @_;
> +
> +    my $iptables = $ipversion == 6 ? 'ip6tables' : 'iptables';
> +
> +    my @iface_config;
> +    for my $rule (@rules) {
> +        my ($table, $action, $spec) = @$rule;
> +        push @iface_config, "post-up $iptables -t $table $action $spec";
> +        push @iface_config, "post-down $iptables -t $table -D $spec";
> +    }
> +
> +    return @iface_config;
> +}
> +
> +# Generate the ifupdown2 commands to SNAT $cidr out of $outiface, using
> +# MASQUERADE if the source address is not known.
> +sub generate_snat_config {
> +    my ($ipversion, $cidr, $outip, $outiface) = @_;
> +
> +    my $target = defined($outip) ? "SNAT --to-source $outip" : 'MASQUERADE';
> +
> +    return generate_iptables_rules(
> +        $ipversion,
> +        #use snat, faster than masquerade
> +        ['nat', '-A', "POSTROUTING -s '$cidr' -o $outiface -j $target"],
> +        #add conntrack zone once on outgoing interface
> +        ['raw', '-I', 'PREROUTING -i fwbr+ -j CT --zone 1'],
> +    );
> +}
> +
> +# Put connections received on @ifaces into conntrack zone $ct_zone in the
> +# original direction, so identical connections from overlapping subnets in
> +# other VRFs do not clash before being NATed. Replies are looked up by their
> +# reply tuple in the default zone, which NAT keeps unique, so neither the
> +# uplink nor local replies need a rule.
> +sub generate_vrf_ct_zone_config {
> +    my ($ipversion, $ct_zone, @ifaces) = @_;
> +
> +    return generate_iptables_rules(
> +        $ipversion,
> +        map { ['raw', '-I', "PREROUTING -i $_ -j CT --zone-orig $ct_zone"] } @ifaces,
> +    );
> +}
> +
>  sub find_local_ip_interface_peers {
>      my ($peers, $iface) = @_;
>  
> diff --git a/src/PVE/Network/SDN/Zones/SimplePlugin.pm b/src/PVE/Network/SDN/Zones/SimplePlugin.pm
> index 1d44f0b078f5..c8718629ac28 100644
> --- a/src/PVE/Network/SDN/Zones/SimplePlugin.pm
> +++ b/src/PVE/Network/SDN/Zones/SimplePlugin.pm
> @@ -106,6 +106,7 @@ sub generate_sdn_config {
>      my $ipv6 = undef;
>      my $enable_forward_v4 = undef;
>      my $enable_forward_v6 = undef;
> +    my $ct_zones = {};
>  
>      foreach my $subnetid (sort keys %{$subnets}) {
>          my $subnet = $subnets->{$subnetid};
> @@ -118,18 +119,15 @@ sub generate_sdn_config {
>              $address->{$gateway} = 1;
>          }
>  
> -        my $iptables = undef;
>          my $checkrouteip = undef;
>          my $ipversion = Net::IP::ip_is_ipv6($gateway) ? 6 : 4;
>  
>          if ($ipversion == 6) {
>              $ipv6 = 1;
> -            $iptables = "ip6tables";
>              $checkrouteip = '2001:4860:4860::8888';
>              $enable_forward_v6 = 1 if $gateway;
>          } else {
>              $ipv4 = 1;
> -            $iptables = "iptables";
>              $checkrouteip = '8.8.8.8';
>              $enable_forward_v4 = 1 if $gateway;
>          }
> @@ -141,31 +139,43 @@ sub generate_sdn_config {
>          }
>          if ($subnet->{snat}) {
>              #find outgoing interface
> -            my ($outip, $outiface);
> +            my ($outip, $outiface, $ct_zone);
>              eval {
> -                ($outip, $outiface) =
> -                    PVE::Network::SDN::Zones::Plugin::get_local_route_ip($checkrouteip);
> +                if ($plugin_config->{'dedicated-vrf'}) {
> +                    ($outip, $outiface) =
> +                        PVE::Network::SDN::Zones::Plugin::find_dedicated_uplink(
> +                            $zone_id, $plugin_config, $ipversion, $interfaces_config,
> +                        );
> +                    die "no uplink interface in vrf_$zone_id\n" if !$outiface;
> +                    $ct_zone = $plugin_config->{'vrf-ct-zone'};
> +                } else {
> +                    ($outip, $outiface) =
> +                        PVE::Network::SDN::Zones::Plugin::get_local_route_ip($checkrouteip);
> +                    $outiface = undef if !$outip;
> +                }
>              };
>              if ($@) {
>                  my $msg = "interface for SNAT could not be resolved: $@";
>                  log_warn($msg);
>                  next;
>              }
> -            if ($outip && $outiface) {
> -                #use snat, faster than masquerade
> -                push @iface_config,
> -                    "post-up $iptables -t nat -A POSTROUTING -s '$cidr' -o $outiface -j SNAT --to-source $outip";
> -                push @iface_config,
> -                    "post-down $iptables -t nat -D POSTROUTING -s '$cidr' -o $outiface -j SNAT --to-source $outip";
> -                #add conntrack zone once on outgoing interface
> -                push @iface_config,
> -                    "post-up $iptables -t raw -I PREROUTING -i fwbr+ -j CT --zone 1";
> -                push @iface_config,
> -                    "post-down $iptables -t raw -D PREROUTING -i fwbr+ -j CT --zone 1";
> -            }
> +            next if !$outiface;
> +
> +            $ct_zones->{$ipversion} = $ct_zone if defined($ct_zone);
> +            push @iface_config,
> +                PVE::Network::SDN::Zones::Plugin::generate_snat_config(
> +                    $ipversion, $cidr, $outip, $outiface,
> +                );
>          }
>      }
>  
> +    for my $ipversion (sort keys %$ct_zones) {
> +        push @iface_config,
> +            PVE::Network::SDN::Zones::Plugin::generate_vrf_ct_zone_config(
> +                $ipversion, $ct_zones->{$ipversion}, $vnetid,
> +            );
> +    }
> +
>      push @iface_config, "hwaddress $mac" if $mac;
>      push @iface_config, "bridge_ports none";
>      push @iface_config, "bridge_stp off";
> diff --git a/src/test/run_test_zones.pl b/src/test/run_test_zones.pl
> index f8ef7375cdc0..afb0ed5d8a00 100755
> --- a/src/test/run_test_zones.pl
> +++ b/src/test/run_test_zones.pl
> @@ -93,7 +93,9 @@ foreach my $test (@tests) {
>      $pve_sdn_zones_plugin = Test::MockModule->new('PVE::Network::SDN::Zones::Plugin');
>      $pve_sdn_zones_plugin->mock(
>          get_local_route_ip => sub {
> -            my ($targetip) = @_;
> +            my ($targetip, $vrf) = @_;
> +            # VRFs do not exist yet on the first apply
> +            die "Cannot find device \"$vrf\"\n" if defined($vrf);
>              my $outiface = "vmbr0";
>              my $outip = $interfaces_config->{ifaces}->{$outiface}->{address};
>              if (Net::IP::ip_is_ipv6($targetip)) {
> diff --git a/src/test/zones/evpn/exitnode_snat_vrf_uplink/expected_controller_config b/src/test/zones/evpn/exitnode_snat_vrf_uplink/expected_controller_config
> new file mode 100644
> index 000000000000..0a19fc711bf6
> --- /dev/null
> +++ b/src/test/zones/evpn/exitnode_snat_vrf_uplink/expected_controller_config
> @@ -0,0 +1,79 @@
> +frr version 10.6.1
> +frr defaults datacenter
> +hostname localhost
> +log syslog informational
> +service integrated-vtysh-config
> +!
> +vrf vrf_myzone
> + vni 1000
> +exit-vrf
> +!
> +router bgp 65000
> + bgp router-id 192.168.0.1
> + no bgp hard-administrative-reset
> + no bgp default ipv4-unicast
> + coalesce-time 1000
> + no bgp graceful-restart notification
> + neighbor VTEP peer-group
> + neighbor VTEP remote-as 65000
> + neighbor VTEP bfd
> + neighbor 192.168.0.2 peer-group VTEP
> + neighbor 192.168.0.3 peer-group VTEP
> + !
> + address-family ipv4 unicast
> +  import vrf vrf_myzone
> + exit-address-family
> + !
> + address-family ipv6 unicast
> +  import vrf vrf_myzone
> + exit-address-family
> + !
> + address-family l2vpn evpn
> +  neighbor VTEP activate
> +  neighbor VTEP route-map MAP_VTEP_IN in
> +  neighbor VTEP route-map MAP_VTEP_OUT out
> +  advertise-all-vni
> + exit-address-family
> +exit
> +!
> +router bgp 65000 vrf vrf_myzone
> + bgp router-id 192.168.0.1
> + no bgp hard-administrative-reset
> + no bgp graceful-restart notification
> + !
> + address-family ipv4 unicast
> +  redistribute connected
> + exit-address-family
> + !
> + address-family ipv6 unicast
> +  redistribute connected
> + exit-address-family
> + !
> + address-family l2vpn evpn
> +  default-originate ipv4
> +  default-originate ipv6
> + exit-address-family
> +exit
> +!
> +ip prefix-list only_default seq 1 permit 0.0.0.0/0
> +!
> +ipv6 prefix-list only_default_v6 seq 1 permit ::/0
> +!
> +route-map MAP_VTEP_IN deny 1
> + match ip address prefix-list only_default
> +exit
> +!
> +route-map MAP_VTEP_IN deny 2
> + match ipv6 address prefix-list only_default_v6
> +exit
> +!
> +route-map MAP_VTEP_IN permit 3
> +exit
> +!
> +route-map MAP_VTEP_OUT permit 1
> +exit
> +!
> +ip route 0.0.0.0/0 203.0.113.1 vrf vrf_myzone
> +!
> +line vty
> +!
> diff --git a/src/test/zones/evpn/exitnode_snat_vrf_uplink/expected_sdn_interfaces b/src/test/zones/evpn/exitnode_snat_vrf_uplink/expected_sdn_interfaces
> new file mode 100644
> index 000000000000..1848a62e657e
> --- /dev/null
> +++ b/src/test/zones/evpn/exitnode_snat_vrf_uplink/expected_sdn_interfaces
> @@ -0,0 +1,73 @@
> +#version:1
> +
> +auto myvnet
> +iface myvnet
> +	address 10.0.0.1/24
> +	post-up iptables -t nat -A POSTROUTING -s '10.0.0.0/24' -o eth1 -j SNAT --to-source 203.0.113.10
> +	post-down iptables -t nat -D POSTROUTING -s '10.0.0.0/24' -o eth1 -j SNAT --to-source 203.0.113.10
> +	post-up iptables -t raw -I PREROUTING -i fwbr+ -j CT --zone 1
> +	post-down iptables -t raw -D PREROUTING -i fwbr+ -j CT --zone 1
> +	post-up iptables -t raw -I PREROUTING -i myvnet -j CT --zone-orig 7767
> +	post-down iptables -t raw -D PREROUTING -i myvnet -j CT --zone-orig 7767
> +	post-up iptables -t raw -I PREROUTING -i vrfbr_myzone -j CT --zone-orig 7767
> +	post-down iptables -t raw -D PREROUTING -i vrfbr_myzone -j CT --zone-orig 7767
> +	bridge_ports vxlan_myvnet
> +	bridge_stp off
> +	bridge_fd 0
> +	mtu 1450
> +	ip-forward on
> +	arp-accept on
> +	vrf vrf_myzone
> +
> +auto myvnet2
> +iface myvnet2
> +	address 2a08:2142:302:3::1/64
> +	post-up ip6tables -t nat -A POSTROUTING -s '2a08:2142:302:3::/64' -o vmbr0 -j SNAT --to-source 2001:db8::2
> +	post-down ip6tables -t nat -D POSTROUTING -s '2a08:2142:302:3::/64' -o vmbr0 -j SNAT --to-source 2001:db8::2
> +	post-up ip6tables -t raw -I PREROUTING -i fwbr+ -j CT --zone 1
> +	post-down ip6tables -t raw -D PREROUTING -i fwbr+ -j CT --zone 1
> +	bridge_ports vxlan_myvnet2
> +	bridge_stp off
> +	bridge_fd 0
> +	mtu 1450
> +	ip6-forward on
> +	arp-accept on
> +	vrf vrf_myzone
> +
> +auto vrf_myzone
> +iface vrf_myzone
> +	vrf-table auto
> +	post-up ip route del vrf vrf_myzone unreachable default metric 4278198272
> +	post-up ip -6 route del vrf vrf_myzone unreachable default metric 4278198272
> +
> +auto vrfbr_myzone
> +iface vrfbr_myzone
> +	bridge-ports vrfvx_myzone
> +	bridge_stp off
> +	bridge_fd 0
> +	mtu 1450
> +	vrf vrf_myzone
> +
> +auto vrfvx_myzone
> +iface vrfvx_myzone
> +	vxlan-id 1000
> +	vxlan-local-tunnelip 192.168.0.1
> +	bridge-learning off
> +	bridge-arp-nd-suppress on
> +	mtu 1450
> +
> +auto vxlan_myvnet
> +iface vxlan_myvnet
> +	vxlan-id 100
> +	vxlan-local-tunnelip 192.168.0.1
> +	bridge-learning off
> +	bridge-arp-nd-suppress on
> +	mtu 1450
> +
> +auto vxlan_myvnet2
> +iface vxlan_myvnet2
> +	vxlan-id 200
> +	vxlan-local-tunnelip 192.168.0.1
> +	bridge-learning off
> +	bridge-arp-nd-suppress on
> +	mtu 1450
> diff --git a/src/test/zones/evpn/exitnode_snat_vrf_uplink/interfaces b/src/test/zones/evpn/exitnode_snat_vrf_uplink/interfaces
> new file mode 100644
> index 000000000000..f51116efdde5
> --- /dev/null
> +++ b/src/test/zones/evpn/exitnode_snat_vrf_uplink/interfaces
> @@ -0,0 +1,16 @@
> +auto vmbr0
> +iface vmbr0 inet static
> +	address 192.168.0.1/24
> +	gateway 192.168.0.254
> +        bridge-ports eth0
> +        bridge-stp off
> +        bridge-fd 0
> +
> +iface vmbr0 inet6 static
> +        address 2001:db8::2/64
> +        gateway 2001:db8::1
> +
> +auto eth1
> +iface eth1 inet static
> +	address 203.0.113.10/24
> +	vrf vrf_myzone
> diff --git a/src/test/zones/evpn/exitnode_snat_vrf_uplink/sdn_config b/src/test/zones/evpn/exitnode_snat_vrf_uplink/sdn_config
> new file mode 100644
> index 000000000000..ac0db7778083
> --- /dev/null
> +++ b/src/test/zones/evpn/exitnode_snat_vrf_uplink/sdn_config
> @@ -0,0 +1,42 @@
> +{
> +  version => 1,
> +  vnets   => {
> +               ids => {
> +                        myvnet => { tag => "100", type => "vnet", zone => "myzone" },
> +                        myvnet2 => { tag => "200", type => "vnet", zone => "myzone" },
> +                      },
> +             },
> +
> +  zones   => {
> +               ids => {
> +                        myzone => {
> +                                    ipam => "pve",
> +                                    type => "evpn",
> +                                    controller => "evpnctl",
> +                                    'vrf-vxlan' => 1000,
> +                                    exitnodes => { 'localhost' => 1 },
> +                                    route => [ 'prefix=0.0.0.0/0,via=203.0.113.1' ],
> +                                  },
> +                      },
> +             },
> +  controllers  => {
> +               ids => { evpnctl => { type => "evpn", 'peers' => '192.168.0.1,192.168.0.2,192.168.0.3', asn => "65000" } },
> +             },
> +
> +  subnets => {
> +              ids => {
> +                        'myzone-10.0.0.0-24' => {
> +                                                  'type' => 'subnet',
> +                                                  'vnet' => 'myvnet',
> +                                                  'gateway' => '10.0.0.1',
> +                                                  'snat' => 1
> +                                                },
> +                        'myzone-2a08:2142:302:3::-64' => {
> +                                                  'type' => 'subnet',
> +                                                  'vnet' => 'myvnet2',
> +                                                  'gateway' => '2a08:2142:302:3::1',
> +                                                  'snat' => 1
> +                                                },
> +                      }
> +             }
> +}
> diff --git a/src/test/zones/simple/vrf_snat_uplink/expected_sdn_interfaces b/src/test/zones/simple/vrf_snat_uplink/expected_sdn_interfaces
> new file mode 100644
> index 000000000000..f639eb132a64
> --- /dev/null
> +++ b/src/test/zones/simple/vrf_snat_uplink/expected_sdn_interfaces
> @@ -0,0 +1,92 @@
> +#version:1
> +
> +auto vneta
> +iface vneta
> +	address 10.0.0.1/24
> +	post-up iptables -t nat -A POSTROUTING -s '10.0.0.0/24' -o eth1 -j SNAT --to-source 203.0.113.10
> +	post-down iptables -t nat -D POSTROUTING -s '10.0.0.0/24' -o eth1 -j SNAT --to-source 203.0.113.10
> +	post-up iptables -t raw -I PREROUTING -i fwbr+ -j CT --zone 1
> +	post-down iptables -t raw -D PREROUTING -i fwbr+ -j CT --zone 1
> +	address 10.1.0.1/24
> +	post-up iptables -t nat -A POSTROUTING -s '10.1.0.0/24' -o eth1 -j SNAT --to-source 203.0.113.10
> +	post-down iptables -t nat -D POSTROUTING -s '10.1.0.0/24' -o eth1 -j SNAT --to-source 203.0.113.10
> +	post-up iptables -t raw -I PREROUTING -i fwbr+ -j CT --zone 1
> +	post-down iptables -t raw -D PREROUTING -i fwbr+ -j CT --zone 1
> +	address 2001:db8:a::1/64
> +	post-up ip6tables -t nat -A POSTROUTING -s '2001:db8:a::/64' -o eth1 -j MASQUERADE
> +	post-down ip6tables -t nat -D POSTROUTING -s '2001:db8:a::/64' -o eth1 -j MASQUERADE
> +	post-up ip6tables -t raw -I PREROUTING -i fwbr+ -j CT --zone 1
> +	post-down ip6tables -t raw -D PREROUTING -i fwbr+ -j CT --zone 1
> +	post-up iptables -t raw -I PREROUTING -i vneta -j CT --zone-orig 64008
> +	post-down iptables -t raw -D PREROUTING -i vneta -j CT --zone-orig 64008
> +	post-up ip6tables -t raw -I PREROUTING -i vneta -j CT --zone-orig 64008
> +	post-down ip6tables -t raw -D PREROUTING -i vneta -j CT --zone-orig 64008
> +	bridge_ports none
> +	bridge_stp off
> +	bridge_fd 0
> +	ip-forward on
> +	ip6-forward on
> +	vrf vrf_zonea
> +
> +auto vnetb
> +iface vnetb
> +	address 10.0.0.1/24
> +	post-up iptables -t nat -A POSTROUTING -s '10.0.0.0/24' -o eth2 -j SNAT --to-source 198.51.100.10
> +	post-down iptables -t nat -D POSTROUTING -s '10.0.0.0/24' -o eth2 -j SNAT --to-source 198.51.100.10
> +	post-up iptables -t raw -I PREROUTING -i fwbr+ -j CT --zone 1
> +	post-down iptables -t raw -D PREROUTING -i fwbr+ -j CT --zone 1
> +	post-up iptables -t raw -I PREROUTING -i vnetb -j CT --zone-orig 48540
> +	post-down iptables -t raw -D PREROUTING -i vnetb -j CT --zone-orig 48540
> +	bridge_ports none
> +	bridge_stp off
> +	bridge_fd 0
> +	ip-forward on
> +	vrf vrf_zoneb
> +
> +auto vnetc
> +iface vnetc
> +	address 10.0.0.1/24
> +	bridge_ports none
> +	bridge_stp off
> +	bridge_fd 0
> +	ip-forward on
> +	vrf vrf_zonec
> +
> +auto vnetd
> +iface vnetd
> +	address 10.0.0.1/24
> +	post-up iptables -t nat -A POSTROUTING -s '10.0.0.0/24' -o eth3 -j SNAT --to-source 10.100.0.4
> +	post-down iptables -t nat -D POSTROUTING -s '10.0.0.0/24' -o eth3 -j SNAT --to-source 10.100.0.4
> +	post-up iptables -t raw -I PREROUTING -i fwbr+ -j CT --zone 1
> +	post-down iptables -t raw -D PREROUTING -i fwbr+ -j CT --zone 1
> +	post-up iptables -t raw -I PREROUTING -i vnetd -j CT --zone-orig 27935
> +	post-down iptables -t raw -D PREROUTING -i vnetd -j CT --zone-orig 27935
> +	bridge_ports none
> +	bridge_stp off
> +	bridge_fd 0
> +	ip-forward on
> +	vrf vrf_zoned
> +
> +auto vrf_zonea
> +iface vrf_zonea
> +	vrf-table auto
> +	post-up ip route add vrf vrf_zonea unreachable default metric 4278198272
> +	post-up ip -6 route add vrf vrf_zonea unreachable default metric 4278198272
> +
> +auto vrf_zoneb
> +iface vrf_zoneb
> +	vrf-table auto
> +	post-up ip route add vrf vrf_zoneb unreachable default metric 4278198272
> +	post-up ip -6 route add vrf vrf_zoneb unreachable default metric 4278198272
> +
> +auto vrf_zonec
> +iface vrf_zonec
> +	vrf-table auto
> +	post-up ip route add vrf vrf_zonec unreachable default metric 4278198272
> +	post-up ip -6 route add vrf vrf_zonec unreachable default metric 4278198272
> +
> +auto vrf_zoned
> +iface vrf_zoned
> +	vrf-table auto
> +	post-up ip route add vrf vrf_zoned unreachable default metric 4278198272
> +	post-up ip -6 route add vrf vrf_zoned unreachable default metric 4278198272
> diff --git a/src/test/zones/simple/vrf_snat_uplink/interfaces b/src/test/zones/simple/vrf_snat_uplink/interfaces
> new file mode 100644
> index 000000000000..de646d3f6b43
> --- /dev/null
> +++ b/src/test/zones/simple/vrf_snat_uplink/interfaces
> @@ -0,0 +1,26 @@
> +auto vmbr0
> +iface vmbr0 inet static
> +	address 192.168.0.1/24
> +	gateway 192.168.0.254
> +        bridge-ports eth0
> +        bridge-stp off
> +        bridge-fd 0
> +
> +auto eth1
> +iface eth1 inet static
> +	address 203.0.113.10/24
> +	vrf vrf_zonea
> +
> +iface eth1 inet6 auto
> +	vrf vrf_zonea
> +
> +auto eth2
> +iface eth2 inet static
> +	address 198.51.100.10/24
> +	vrf vrf_zoneb
> +
> +auto eth3
> +iface eth3 inet static
> +	address 10.100.0.4/24
> +	gateway 10.100.0.1
> +	vrf vrf_zoned
> diff --git a/src/test/zones/simple/vrf_snat_uplink/sdn_config b/src/test/zones/simple/vrf_snat_uplink/sdn_config
> new file mode 100644
> index 000000000000..7cd558dcc671
> --- /dev/null
> +++ b/src/test/zones/simple/vrf_snat_uplink/sdn_config
> @@ -0,0 +1,84 @@
> +{
> +  version => 1,
> +  vnets   => {
> +               ids => {
> +                        vneta => { type => "vnet", zone => "zonea" },
> +                        vnetb => { type => "vnet", zone => "zoneb" },
> +                        vnetc => { type => "vnet", zone => "zonec" },
> +                        vnetd => { type => "vnet", zone => "zoned" },
> +                      },
> +             },
> +  zones   => {
> +               ids => {
> +                        zonea => {
> +                                   ipam => "pve",
> +                                   type => "simple",
> +                                   "dedicated-vrf" => 1,
> +                                   route => [
> +                                     'prefix=0.0.0.0/0,via=203.0.113.1',
> +                                     'prefix=::/0,via=fe80::1,iface=eth1',
> +                                   ],
> +                                 },
> +                        zoneb => {
> +                                   ipam => "pve",
> +                                   type => "simple",
> +                                   "dedicated-vrf" => 1,
> +                                   route => [
> +                                     'prefix=0.0.0.0/0,via=198.51.100.2,distance=10',
> +                                     'prefix=0.0.0.0/0,via=198.51.100.1',
> +                                   ],
> +                                 },
> +                        zonec => {
> +                                   ipam => "pve",
> +                                   type => "simple",
> +                                   "dedicated-vrf" => 1,
> +                                   route => [ 'prefix=0.0.0.0/0,via=192.168.0.254,nexthop-vrf=default' ],
> +                                 },
> +                        zoned => {
> +                                   ipam => "pve",
> +                                   type => "simple",
> +                                   "dedicated-vrf" => 1,
> +                                 },
> +                      },
> +             },
> +  subnets => {
> +               ids => {
> +                        'zonea-10.0.0.0-24' => {
> +                                                 type => 'subnet',
> +                                                 vnet => 'vneta',
> +                                                 gateway => '10.0.0.1',
> +                                                 snat => 1,
> +                                               },
> +                        'zonea-10.1.0.0-24' => {
> +                                                 type => 'subnet',
> +                                                 vnet => 'vneta',
> +                                                 gateway => '10.1.0.1',
> +                                                 snat => 1,
> +                                               },
> +                        'zonea-2001:db8:a::-64' => {
> +                                                     type => 'subnet',
> +                                                     vnet => 'vneta',
> +                                                     gateway => '2001:db8:a::1',
> +                                                     snat => 1,
> +                                                   },
> +                        'zoneb-10.0.0.0-24' => {
> +                                                 type => 'subnet',
> +                                                 vnet => 'vnetb',
> +                                                 gateway => '10.0.0.1',
> +                                                 snat => 1,
> +                                               },
> +                        'zonec-10.0.0.0-24' => {
> +                                                 type => 'subnet',
> +                                                 vnet => 'vnetc',
> +                                                 gateway => '10.0.0.1',
> +                                                 snat => 1,
> +                                               },
> +                        'zoned-10.0.0.0-24' => {
> +                                                 type => 'subnet',
> +                                                 vnet => 'vnetd',
> +                                                 gateway => '10.0.0.1',
> +                                                 snat => 1,
> +                                               },
> +                      },
> +             },
> +}





^ permalink raw reply	[flat|nested] 65+ messages in thread

* Re: [PATCH proxmox-ve-rs v3 07/32] sdn: allow static routes in simple zone VRFs
  2026-11-18 15:29   ` Stefan Hanreich
@ 2026-11-18 18:10     ` Gabriel Goller
  0 siblings, 0 replies; 65+ messages in thread
From: Gabriel Goller @ 2026-11-18 18:10 UTC (permalink / raw)
  To: Stefan Hanreich; +Cc: pve-devel

On 18.11.2026 16:29, Stefan Hanreich wrote:
> 
> 
> On 11/16/26 5:16 PM, Gabriel Goller wrote:
> > Allow simple zones to reach upstream networks through zone-wide static
> > routes, without requiring node-local FRR overrides. Install routes in
> > vrf_<zone> when dedicated-vrf is enabled, or in the default routing table
> > otherwise. Only generate routes on nodes that belong to the zone.
> > 
> > Support IPv4 and IPv6 routes, with an optional outgoing interface,
> > administrative distance and next-hop VRF. The next-hop VRF only selects
> > where to resolve the gateway; the route still belongs to the zone.
> > 
> > Reject prefixes with host bits set, since staticd normalizes them and
> > frr-reload would otherwise replace them on every reload. Keep the perl
> > vrf field as the outgoing interface for existing EVPN routes, separate
> > from the VRF in which the route is installed.
> 
> Can't we just normalize them ourselves before writing them out and then
> accept anything with host bits set?

Hmm yeah so we do that with the fabric prefix (normalize in the api, then
write the normalized prefix to config) but there the prefix doesn't have such a
weight, it's basically just a way to restrict the node-ips. Here on the other
hand, we actually route the prefix, so IMO a 10.10.10.125/24 is more a typo
(also because the prefix actually has some weight here, not like with the
fabrics).

> [...]
> 
> > +/// Routing-related properties of a single SDN zone.
> > +#[derive(Clone, Debug, Deserialize)]
> > +pub struct ZoneRoutes {
> > +    #[serde(rename = "type")]
> > +    pub ty: String,
> > +    #[serde(
> > +        default,
> > +        rename = "dedicated-vrf",
> > +        deserialize_with = "proxmox_serde::perl::deserialize_bool"
> > +    )]
> > +    pub dedicated_vrf: bool,
> > +    pub nodes: Option<BTreeMap<String, serde_json::Value>>,
> > +    #[serde(default)]
> > +    pub route: Vec<PropertyString<StaticRoute>>,
> 
> We need to write this property canonicalized in Perl, as otherwise this can cause
> deserialization issues with values the API accepts, as I've learned the hard way D:


Hmm ok I get it. We should this everywhere though, we don't this in dhcp-ranges afaik...

> > +}
> > +
> > +#[cfg(feature = "frr")]
> > +impl ZoneRoutesConfig {
> > +    /// Generate routes only on nodes participating in the zone.
> > +    pub fn routes_for_node(&self, node: &str) -> Result<Vec<proxmox_frr::ser::IpRoute>, Error> {
> 
> can we skip invalid routes instead of erroring out here? It'd abort the whole FRR config
> generation..

Makes sense.

> > +        use proxmox_frr::ser::{InterfaceName as FrrInterfaceName, IpOrInterface, IpRoute};
> > +
> > +        let to_frr = |name: &InterfaceName| FrrInterfaceName::try_from(name.as_str());
> > +
> > +        let mut routes = Vec::new();
> > +        for (zone, config) in &self.ids {
> > +            if config.route.is_empty() {
> > +                continue;
> > +            }
> > +            if config.ty != "simple" {
> > +                bail!("static routes are only supported in simple zones (zone '{zone}')");
> > +            }
> > +            if config
> > +                .nodes
> > +                .as_ref()
> > +                .is_some_and(|nodes| !nodes.contains_key(node))
> > +            {
> > +                continue;
> > +            }
> > +            let destination_vrf = config
> > +                .dedicated_vrf
> > +                .then(|| FrrInterfaceName::try_from(format!("vrf_{zone}")))
> > +                .transpose()?;
> > +            for route in &config.route {
> > +                route.validate()?;
> > +                let mut frr_route = IpRoute::new(route.prefix, route.via.map(IpOrInterface::Ip));
> > +                frr_route.iface = route.iface.as_ref().map(to_frr).transpose()?;
> > +                frr_route.distance = route.distance;
> > +                frr_route.nexthop_vrf = route.nexthop_vrf.as_ref().map(to_frr).transpose()?;
> > +                frr_route.destination_vrf = destination_vrf.clone();
> > +                routes.push(frr_route);
> > +            }
> > +        }
> > +        Ok(routes)
> > +    }
> > +}




^ permalink raw reply	[flat|nested] 65+ messages in thread

* Re: [PATCH common/manager/network/proxmox{-ve-rs,-perl-rs,-widget-toolkit} v3 00/32] SDN VRF support
  2026-11-16 16:11 [PATCH common/manager/network/proxmox{-ve-rs,-perl-rs,-widget-toolkit} v3 00/32] SDN VRF support Gabriel Goller
                   ` (31 preceding siblings ...)
  2026-11-16 16:11 ` [PATCH pve-manager v3 32/32] network: generate SDN DHCP config after ifreload Gabriel Goller
@ 2026-11-18 18:27 ` Stefan Hanreich
  2026-11-19 15:33   ` Gabriel Goller
  2026-11-19 20:10 ` Gabriel Goller
  33 siblings, 1 reply; 65+ messages in thread
From: Stefan Hanreich @ 2026-11-18 18:27 UTC (permalink / raw)
  To: pve-devel

haven't looked at the UI patches yet, tried to look at the design, didn't get
to do a lot of testing so all of this is judging from the code basically:


nexthop-vrf is really sketchy imo, as it allows a user with SDN.Allocate on a
simple zone to route traffic into *any* VRF. At the minimum we should require
Sys.Modify for that (as already discussed off-list).
We could lessen that restriction in the future to allow jumping into VRFs of
SDN entities where the user has permissions for (i.e. I can jump into vrf_X
if I have SDN.Use on X)

staticd validates iface and only allows routes for interfaces that are in the
VRF, which is kinda nice for now since it saves us here but makes creating
specific routes kinda annoying for interfaces outside the VRF. Also, we're
relying on staticd behavior for security here.

I think those could be solved by just requiring Sys.Modify for static
routes in general. We can always lessen it.


SNAT still has quite a few problems (see the patch). We should remove it
and solve them in a follow-up. Also, even without SNAT we need to set CT
zones on simple zones for all traffic in the firewall daemons. We'd have
to think a bit about possible implications of this that I haven't thought
of.


We should not create null0 routes for simple zones with a dedicated VRF
in EVPN.


DHCP implementation looks generally fine, but imo we'd need to expose
the DNS server option - as otherwise dnsmasq hands out the system default
DNS server which is probably not reachable inside a simple zone with custom
VRF. This feature certainly deserves some practical testing tho.


On 11/16/26 5:13 PM, Gabriel Goller wrote:
> This series adds VRF support to SDN zones and fabrics.
> 
> A simple zone can now use either the default VRF or a dedicated VRF. The
> simple zone dialog has a checkbox for this and uses the default VRF by
> default. If the checkbox is disabled, the zone creates a dedicated VRF named
> `vrf_<zone-name>`. EVPN zones always create a dedicated VRF. BGP and OSPF
> fabrics can select a zone and run inside its VRF.
> 
> This is the second iteration. The first iteration added VRFs as a separate
> SDN object with a distinct GUI subdirectory. This was scrapped because VRFs
> are an implementation detail and should not be exposed on their own in the
> GUI. Zones already provide a logical L3 building block and should map to VRFs
> instead.
> 
> Route leaking between VRFs partly depends on the following FRR change, so it
> will come a bit later: https://github.com/FRRouting/frr/pull/22426
> 
> This version fixes DHCP (moving dnsmasq daemon to vrf) and the SNAT (adding
> iptable rules with a zone id). Mostly I'd like these two things to be looked
> at, as I'm not sure about the design.
> 
> As always, thanks to Stefan Hanreich for his help.
> 
> Changelog:
> v2: (thanks @Stefan)
>  * allow interfaces to be added to vrfs
>  * allow static routes to be configured on vrfs
>  * fix ospf vrf statistics
>  * fix dhcp
>  * fix snat
> 
> RFC (v1):
>  * rebase
> 
> 
> pve-common:
> 
> Gabriel Goller (1):
>   interfaces: preserve VRF membership across address family changes
> 
>  src/PVE/Network/Interfaces.pm | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> 
> proxmox-ve-rs:
> 
> Gabriel Goller (7):
>   frr: add VRF-aware OSPF rendering
>   sdn: add zone references to OSPF and BGP fabrics
>   sdn: generate fabric routing configuration in zone VRFs
>   sdn: fix VRF route-map scoping and zone ID validation
>   tests: fabrics: add test for fabrics in VRFs
>   sdn: allow static routes in simple zone VRFs
>   sdn: support static routes in EVPN zone VRFs
> 
>  proxmox-frr-templates/templates/bgpd.jinja    |   7 +-
>  proxmox-frr-templates/templates/fabricd.jinja |   2 +-
>  .../templates/frr.conf.jinja                  |   3 +-
>  .../templates/interface.jinja                 |   6 +-
>  .../templates/ip_routes.jinja                 |  13 +-
>  proxmox-frr-templates/templates/isisd.jinja   |   2 +-
>  proxmox-frr-templates/templates/ospfd.jinja   |  12 +-
>  .../templates/protocol_routemaps.jinja        |  13 +
>  proxmox-frr/src/ser/mod.rs                    |  33 ++-
>  proxmox-ve-config/src/sdn/fabric/frr.rs       | 146 +++++++----
>  proxmox-ve-config/src/sdn/fabric/mod.rs       |  40 ++-
>  .../src/sdn/fabric/section_config/fabric.rs   |  29 ++-
>  .../sdn/fabric/section_config/protocol/bgp.rs |  11 +-
>  .../fabric/section_config/protocol/ospf.rs    |  11 +-
>  proxmox-ve-config/src/sdn/mod.rs              |   1 +
>  proxmox-ve-config/src/sdn/static_route.rs     | 147 +++++++++++
>  .../tests/fabric/cfg/vrf/fabrics.cfg          |  43 ++++
>  .../tests/fabric/cfg/vrf/route-maps.cfg       |  15 ++
>  proxmox-ve-config/tests/fabric/helper.rs      |  20 ++
>  proxmox-ve-config/tests/fabric/main.rs        | 233 +++++++++++++++++-
>  .../fabric/snapshots/fabric__vrf_pve.snap     | 134 ++++++++++
>  .../tests/static_routes/cfg/fabrics.cfg       |  19 ++
>  .../tests/static_routes/cfg/zones.json        |  20 ++
>  proxmox-ve-config/tests/static_routes/main.rs | 203 +++++++++++++++
>  ...tatic_routes__evpn_zone_routes_to_frr.snap |  12 +
>  ...c_routes__preserve_legacy_evpn_routes.snap |  12 +
>  ...tatic_routes__simple_zone_routes_pve1.snap |  20 ++
>  ...tatic_routes__simple_zone_routes_pve2.snap |  10 +
>  ...outes__vrf_fabrics_with_static_routes.snap |  70 ++++++
>  29 files changed, 1215 insertions(+), 72 deletions(-)
>  create mode 100644 proxmox-ve-config/src/sdn/static_route.rs
>  create mode 100644 proxmox-ve-config/tests/fabric/cfg/vrf/fabrics.cfg
>  create mode 100644 proxmox-ve-config/tests/fabric/cfg/vrf/route-maps.cfg
>  create mode 100644 proxmox-ve-config/tests/fabric/snapshots/fabric__vrf_pve.snap
>  create mode 100644 proxmox-ve-config/tests/static_routes/cfg/fabrics.cfg
>  create mode 100644 proxmox-ve-config/tests/static_routes/cfg/zones.json
>  create mode 100644 proxmox-ve-config/tests/static_routes/main.rs
>  create mode 100644 proxmox-ve-config/tests/static_routes/snapshots/static_routes__evpn_zone_routes_to_frr.snap
>  create mode 100644 proxmox-ve-config/tests/static_routes/snapshots/static_routes__preserve_legacy_evpn_routes.snap
>  create mode 100644 proxmox-ve-config/tests/static_routes/snapshots/static_routes__simple_zone_routes_pve1.snap
>  create mode 100644 proxmox-ve-config/tests/static_routes/snapshots/static_routes__simple_zone_routes_pve2.snap
>  create mode 100644 proxmox-ve-config/tests/static_routes/snapshots/static_routes__vrf_fabrics_with_static_routes.snap
> 
> 
> proxmox-perl-rs:
> 
> Gabriel Goller (5):
>   pve-rs: fabrics: assign network interfaces to configured VRFs
>   pve-rs: fabrics: make per-fabric status queries VRF-aware
>   pve-rs: fabrics: include VRF routes in aggregate status
>   pve-rs: fabrics: expose host interface membership
>   sdn: expose static routes for simple zone uplinks
> 
>  pve-rs/src/bindings/sdn/fabrics.rs | 369 +++++++++++++++++++----------
>  pve-rs/src/bindings/sdn/mod.rs     |  19 +-
>  pve-rs/src/sdn/status.rs           | 149 +++++++++---
>  3 files changed, 389 insertions(+), 148 deletions(-)
> 
> 
> pve-network:
> 
> Gabriel Goller (12):
>   sdn: evpn: add unreachable IPv6 default route to zone VRFs
>   sdn: add optional VRFs for simple zones
>   sdn: allow fabrics to use simple zone VRFs
>   sdn: require underlay fabrics to use the default VRF
>   sdn: always generate EVPN zone VRFs
>   api: sdn: allow EVPN zones as fabric VRFs
>   api: sdn: disallow BGP fabrics in EVPN zone VRFs
>   sdn: simple: support static routes in zone routing tables
>   sdn: evpn: allow static routes
>   sdn: zones: SNAT via dedicated uplinks in zone VRFs
>   sdn: dhcp: only configure DHCP for zones on the local node
>   sdn: dhcp: run dnsmasq in the zone VRF
> 
>  src/PVE/API2/Network/SDN/Fabrics/Fabric.pm    |  59 ++++-
>  .../API2/Network/SDN/Fabrics/FabricNode.pm    |  18 ++
>  src/PVE/API2/Network/SDN/Zones.pm             |  43 ++++
>  src/PVE/Network/SDN.pm                        |  23 +-
>  src/PVE/Network/SDN/Controllers/BgpPlugin.pm  |   2 +-
>  src/PVE/Network/SDN/Controllers/EvpnPlugin.pm |   2 +
>  src/PVE/Network/SDN/Dhcp.pm                   |  14 +-
>  src/PVE/Network/SDN/Dhcp/Dnsmasq.pm           |  59 ++++-
>  src/PVE/Network/SDN/Fabrics.pm                |  36 +++
>  src/PVE/Network/SDN/Zones.pm                  |  20 +-
>  src/PVE/Network/SDN/Zones/EvpnPlugin.pm       |  89 ++++---
>  src/PVE/Network/SDN/Zones/Plugin.pm           | 229 +++++++++++++++++-
>  src/PVE/Network/SDN/Zones/SimplePlugin.pm     |  79 ++++--
>  src/PVE/Network/SDN/Zones/VxlanPlugin.pm      |   5 +
>  src/test/Makefile                             |   5 +-
>  src/test/run_test_static_routes.pl            | 217 +++++++++++++++++
>  src/test/run_test_zones.pl                    |   4 +-
>  .../expected_controller_config                |   6 +
>  .../advertise_subnets/expected_sdn_interfaces |   1 +
>  .../zones/evpn/advertise_subnets/sdn_config   |   8 +-
>  .../evpn/auto_mode/expected_sdn_interfaces    |   1 +
>  .../evpn/bgp_ebgp/expected_sdn_interfaces     |   1 +
>  .../bgp_ebgp_multihop/expected_sdn_interfaces |   1 +
>  .../expected_sdn_interfaces                   |   1 +
>  .../expected_sdn_interfaces                   |   1 +
>  .../evpn/bgp_fabric/expected_sdn_interfaces   |   1 +
>  .../evpn/bgp_loopback/expected_sdn_interfaces |   1 +
>  .../expected_sdn_interfaces                   |   1 +
>  .../combined_bgp_isis/expected_sdn_interfaces |   1 +
>  .../expected_sdn_interfaces                   |   1 +
>  .../zones/evpn/ebgp/expected_sdn_interfaces   |   1 +
>  .../expected_sdn_interfaces                   |   1 +
>  .../expected_sdn_interfaces                   |   1 +
>  .../expected_sdn_interfaces                   |   2 +
>  .../ebgp_loopback/expected_sdn_interfaces     |   1 +
>  .../expected_sdn_interfaces                   |   1 +
>  .../expected_sdn_interfaces                   |   2 +
>  .../evpn/exitnode/expected_sdn_interfaces     |   1 +
>  .../expected_sdn_interfaces                   |   1 +
>  .../expected_sdn_interfaces                   |   1 +
>  .../exitnode_primary/expected_sdn_interfaces  |   1 +
>  .../exitnode_snat/expected_sdn_interfaces     |   1 +
>  .../expected_controller_config                |  79 ++++++
>  .../expected_sdn_interfaces                   |  73 ++++++
>  .../evpn/exitnode_snat_vrf_uplink/interfaces  |  16 ++
>  .../evpn/exitnode_snat_vrf_uplink/sdn_config  |  42 ++++
>  .../exitnodenullroute/expected_sdn_interfaces |   2 +
>  .../frr_local_merge/expected_sdn_interfaces   |   1 +
>  .../expected_sdn_interfaces                   |   1 +
>  .../zones/evpn/ipv4/expected_sdn_interfaces   |   1 +
>  .../evpn/ipv4ipv6/expected_sdn_interfaces     |   1 +
>  .../ipv4ipv6nogateway/expected_sdn_interfaces |   1 +
>  .../zones/evpn/ipv6/expected_sdn_interfaces   |   1 +
>  .../evpn/ipv6underlay/expected_sdn_interfaces |   1 +
>  .../zones/evpn/isis/expected_sdn_interfaces   |   1 +
>  .../isis_loopback/expected_sdn_interfaces     |   1 +
>  .../multipath_relax/expected_sdn_interfaces   |   1 +
>  .../multiplezones/expected_sdn_interfaces     |   2 +
>  .../openfabric_fabric/expected_sdn_interfaces |   1 +
>  .../expected_sdn_interfaces                   |   1 +
>  .../expected_sdn_interfaces                   |   1 +
>  .../evpn/ospf_fabric/expected_sdn_interfaces  |   1 +
>  .../evpn/routemap/expected_sdn_interfaces     |   1 +
>  .../expected_sdn_interfaces                   |   1 +
>  .../expected_sdn_interfaces                   |   1 +
>  .../evpn/rt_import/expected_sdn_interfaces    |   1 +
>  .../evpn/vrf-empty/expected_sdn_interfaces    |   7 +
>  src/test/zones/evpn/vrf-empty/interfaces      |   2 +
>  src/test/zones/evpn/vrf-empty/sdn_config      |  13 +
>  .../evpn/vxlanport/expected_sdn_interfaces    |   1 +
>  .../hetzner-vrf/expected_sdn_interfaces       |  27 +++
>  src/test/zones/simple/hetzner-vrf/interfaces  |   6 +
>  src/test/zones/simple/hetzner-vrf/sdn_config  |  34 +++
>  .../simple/vrf-empty/expected_sdn_interfaces  |   7 +
>  src/test/zones/simple/vrf-empty/interfaces    |   2 +
>  src/test/zones/simple/vrf-empty/sdn_config    |  12 +
>  .../zones/simple/vrf/expected_sdn_interfaces  |  14 ++
>  src/test/zones/simple/vrf/interfaces          |   2 +
>  src/test/zones/simple/vrf/sdn_config          |  17 ++
>  .../vrf_snat_uplink/expected_sdn_interfaces   |  92 +++++++
>  .../zones/simple/vrf_snat_uplink/interfaces   |  26 ++
>  .../zones/simple/vrf_snat_uplink/sdn_config   |  84 +++++++
>  82 files changed, 1443 insertions(+), 78 deletions(-)
>  create mode 100644 src/test/run_test_static_routes.pl
>  create mode 100644 src/test/zones/evpn/exitnode_snat_vrf_uplink/expected_controller_config
>  create mode 100644 src/test/zones/evpn/exitnode_snat_vrf_uplink/expected_sdn_interfaces
>  create mode 100644 src/test/zones/evpn/exitnode_snat_vrf_uplink/interfaces
>  create mode 100644 src/test/zones/evpn/exitnode_snat_vrf_uplink/sdn_config
>  create mode 100644 src/test/zones/evpn/vrf-empty/expected_sdn_interfaces
>  create mode 100644 src/test/zones/evpn/vrf-empty/interfaces
>  create mode 100644 src/test/zones/evpn/vrf-empty/sdn_config
>  create mode 100644 src/test/zones/simple/hetzner-vrf/expected_sdn_interfaces
>  create mode 100644 src/test/zones/simple/hetzner-vrf/interfaces
>  create mode 100644 src/test/zones/simple/hetzner-vrf/sdn_config
>  create mode 100644 src/test/zones/simple/vrf-empty/expected_sdn_interfaces
>  create mode 100644 src/test/zones/simple/vrf-empty/interfaces
>  create mode 100644 src/test/zones/simple/vrf-empty/sdn_config
>  create mode 100644 src/test/zones/simple/vrf/expected_sdn_interfaces
>  create mode 100644 src/test/zones/simple/vrf/interfaces
>  create mode 100644 src/test/zones/simple/vrf/sdn_config
>  create mode 100644 src/test/zones/simple/vrf_snat_uplink/expected_sdn_interfaces
>  create mode 100644 src/test/zones/simple/vrf_snat_uplink/interfaces
>  create mode 100644 src/test/zones/simple/vrf_snat_uplink/sdn_config
> 
> 
> proxmox-widget-toolkit:
> 
> Gabriel Goller (1):
>   ui: network: allow selecting a VRF for host interfaces
> 
>  src/node/NetworkEdit.js | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
> 
> 
> pve-manager:
> 
> Gabriel Goller (6):
>   ui: sdn: add VRF zone selection for fabrics
>   ui: sdn: expose EVPN zones as fabric VRFs
>   network: allow setting the VRF of host interfaces
>   ui: sdn: allow static routes for Simple zone VRFs
>   ui: sdn: allow static routes in EVPN zones
>   network: generate SDN DHCP config after ifreload
> 
>  PVE/API2/Network.pm                    |  46 +++--
>  bin/pve-sdn-commit                     |   5 +-
>  www/manager6/Makefile                  |   1 +
>  www/manager6/Toolkit.js                |   2 +-
>  www/manager6/form/SDNZoneSelector.js   |  64 ++++++-
>  www/manager6/node/Config.js            |  12 ++
>  www/manager6/sdn/StaticRoutes.js       | 246 +++++++++++++++++++++++++
>  www/manager6/sdn/fabrics/FabricEdit.js |  18 ++
>  www/manager6/sdn/zones/Base.js         |  40 +++-
>  www/manager6/sdn/zones/EvpnEdit.js     |   2 +
>  www/manager6/sdn/zones/SimpleEdit.js   |  11 ++
>  11 files changed, 429 insertions(+), 18 deletions(-)
>  create mode 100644 www/manager6/sdn/StaticRoutes.js
> 
> 
> Summary over all repositories:
>   127 files changed, 3499 insertions(+), 317 deletions(-)
> 





^ permalink raw reply	[flat|nested] 65+ messages in thread

* Re: [PATCH proxmox-ve-rs v3 08/32] sdn: support static routes in EVPN zone VRFs
  2026-11-18 15:32   ` Stefan Hanreich
@ 2026-11-19 13:12     ` Gabriel Goller
  0 siblings, 0 replies; 65+ messages in thread
From: Gabriel Goller @ 2026-11-19 13:12 UTC (permalink / raw)
  To: Stefan Hanreich; +Cc: pve-devel

On 18.11.2026 16:32, Stefan Hanreich wrote:
> what could be an interesting option: create static routes only on exit nodes
> as that'd have the use-case of creating routes to uplinks on exit nodes only,
> whereas all other nodes have the exit-nodes as default route.

Agree, as a default behavior this would probably be weird. To make this complete
we would probably have to make it so that the user can select the nodes on which
the static route will be installed, the selection would then be a subset of the
nodes where the simple zone is created.

IMO this is fine as a follow-up.

> On 11/16/26 5:12 PM, Gabriel Goller wrote:
> > Allow EVPN zones to reach networks behind appliances or external routers
> > using the same zone-wide static routes as simple zones. EVPN routes
> > always belong to vrf_<zone>, without requiring the dedicated-vrf option
> > used by simple zones.
> > 
> > Generate routes on all nodes that belong to the zone, not just exit
> > nodes. This does not enable redistribution of static routes, so adding
> > a route does not by itself advertise it to other nodes.
> > 
> > Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
> > ---
> >  proxmox-ve-config/src/sdn/static_route.rs     | 11 +++--
> >  proxmox-ve-config/tests/static_routes/main.rs | 40 ++++++++++++++++++-
> >  ...tatic_routes__evpn_zone_routes_to_frr.snap | 12 ++++++
> >  3 files changed, 56 insertions(+), 7 deletions(-)
> >  create mode 100644 proxmox-ve-config/tests/static_routes/snapshots/static_routes__evpn_zone_routes_to_frr.snap
> > 
> > diff --git a/proxmox-ve-config/src/sdn/static_route.rs b/proxmox-ve-config/src/sdn/static_route.rs
> > index eab6300374ff..0a5e0b3939f4 100644
> > --- a/proxmox-ve-config/src/sdn/static_route.rs
> > +++ b/proxmox-ve-config/src/sdn/static_route.rs
> > @@ -1,4 +1,4 @@
> > -//! Static routes stored as repeatable property strings in simple SDN zones.
> > +//! Static routes stored as repeatable property strings in Simple and EVPN SDN zones.
> >  
> >  use std::collections::BTreeMap;
> >  use std::net::IpAddr;
> > @@ -22,7 +22,7 @@ use crate::sdn::fabric::section_config::interface::InterfaceName;
> >  )]
> >  #[derive(Clone, Debug, Serialize, Deserialize)]
> >  #[serde(rename_all = "kebab-case", deny_unknown_fields)]
> > -/// A static route in a simple zone. The destination VRF is determined by the zone.
> > +/// A static route in a Simple or EVPN zone. The destination VRF is determined by the zone.
> >  pub struct StaticRoute {
> >      /// Destination prefix, including 0.0.0.0/0 or ::/0 for a default route.
> >      pub prefix: Cidr,
> > @@ -119,8 +119,8 @@ impl ZoneRoutesConfig {
> >              if config.route.is_empty() {
> >                  continue;
> >              }
> > -            if config.ty != "simple" {
> > -                bail!("static routes are only supported in simple zones (zone '{zone}')");
> > +            if !matches!(config.ty.as_str(), "simple" | "evpn") {
> > +                bail!("static routes are only supported in Simple and EVPN zones (zone '{zone}')");
> >              }
> >              if config
> >                  .nodes
> > @@ -129,8 +129,7 @@ impl ZoneRoutesConfig {
> >              {
> >                  continue;
> >              }
> > -            let destination_vrf = config
> > -                .dedicated_vrf
> > +            let destination_vrf = (config.ty == "evpn" || config.dedicated_vrf)
> >                  .then(|| FrrInterfaceName::try_from(format!("vrf_{zone}")))
> >                  .transpose()?;
> >              for route in &config.route {
> > diff --git a/proxmox-ve-config/tests/static_routes/main.rs b/proxmox-ve-config/tests/static_routes/main.rs
> > index a0daf38449ff..f198a3bf3353 100644
> > --- a/proxmox-ve-config/tests/static_routes/main.rs
> > +++ b/proxmox-ve-config/tests/static_routes/main.rs
> > @@ -59,6 +59,44 @@ fn simple_zone_routes_to_frr() -> Result<(), Error> {
> >      Ok(())
> >  }
> >  
> > +#[test]
> > +fn evpn_zone_routes_to_frr() -> Result<(), Error> {
> > +    let zones: ZoneRoutesConfig = serde_json::from_value(json!({"ids": {
> > +        "blue": {
> > +            "type": "evpn",
> > +            "nodes": {"pve1": 1, "pve2": 1},
> > +            "exitnodes": {"pve1": 1},
> > +            "route": [
> > +                "prefix=0.0.0.0/0,via=10.10.0.2",
> > +                "prefix=172.20.0.0/16,via=192.0.2.1,distance=200,nexthop-vrf=default",
> > +                "prefix=::/0,via=fe80::1,iface=vnetblue",
> > +                "prefix=198.51.100.0/24,iface=uplink0"
> > +            ]
> > +        },
> > +        "disabled": {
> > +            "type": "evpn",
> > +            "nodes": {},
> > +            "route": ["prefix=192.0.2.0/24,iface=unused0"]
> > +        }
> > +    }}))?;
> > +    let config = FrrConfig {
> > +        ip_routes: zones.routes_for_node("pve1")?,
> > +        ..Default::default()
> > +    };
> > +    // EVPN always uses the zone VRF, without requiring the Simple-only dedicated-vrf flag.
> > +    let output = dump(&config)?;
> > +    insta::assert_snapshot!(output);
> > +
> > +    // Routes apply to every zone node, not just exit nodes. FRR resolves local interfaces.
> > +    let other = FrrConfig {
> > +        ip_routes: zones.routes_for_node("pve2")?,
> > +        ..Default::default()
> > +    };
> > +    assert_eq!(dump(&other)?, output);
> > +    assert!(zones.routes_for_node("pve3")?.is_empty());
> > +    Ok(())
> > +}
> > +
> >  #[test]
> >  fn validate_route_properties() {
> >      for value in [
> > @@ -109,7 +147,7 @@ fn validate_route_properties() {
> >  
> >  #[test]
> >  fn reject_routes_in_other_zone_types() -> Result<(), Error> {
> > -    for ty in ["vlan", "qinq", "vxlan", "evpn", "faucet"] {
> > +    for ty in ["vlan", "qinq", "vxlan", "faucet"] {
> >          let zones: ZoneRoutesConfig = serde_json::from_value(json!({"ids": {
> >              "zone1": {"type": ty, "route": ["prefix=0.0.0.0/0,via=192.0.2.1"]}
> >          }}))?;
> > diff --git a/proxmox-ve-config/tests/static_routes/snapshots/static_routes__evpn_zone_routes_to_frr.snap b/proxmox-ve-config/tests/static_routes/snapshots/static_routes__evpn_zone_routes_to_frr.snap
> > new file mode 100644
> > index 000000000000..0301559a6d77
> > --- /dev/null
> > +++ b/proxmox-ve-config/tests/static_routes/snapshots/static_routes__evpn_zone_routes_to_frr.snap
> > @@ -0,0 +1,12 @@
> > +---
> > +source: proxmox-ve-config/tests/static_routes/main.rs
> > +expression: output
> > +---
> > +!
> > +ip route 0.0.0.0/0 10.10.0.2 vrf vrf_blue
> > +!
> > +ip route 172.20.0.0/16 192.0.2.1 200 nexthop-vrf default vrf vrf_blue
> > +!
> > +ipv6 route ::/0 fe80::1 vnetblue vrf vrf_blue
> > +!
> > +ip route 198.51.100.0/24 uplink0 vrf vrf_blue
> 
> 
> 
> 
> 




^ permalink raw reply	[flat|nested] 65+ messages in thread

* Re: [PATCH proxmox-perl-rs v3 10/32] pve-rs: fabrics: make per-fabric status queries VRF-aware
  2026-11-18 15:42   ` Stefan Hanreich
@ 2026-11-19 13:30     ` Gabriel Goller
  0 siblings, 0 replies; 65+ messages in thread
From: Gabriel Goller @ 2026-11-19 13:30 UTC (permalink / raw)
  To: Stefan Hanreich; +Cc: pve-devel

On 18.11.2026 16:42, Stefan Hanreich wrote:
> 
> On 11/16/26 5:13 PM, Gabriel Goller wrote:
> > Use the fabric VRF in FRR route, neighbor, and interface queries for
> > OSPF and BGP.
> > 
> > Keep the existing commands for fabrics in the default routing table.
> > 
> > Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
> > ---
> >  pve-rs/src/bindings/sdn/fabrics.rs | 63 +++++++++++++++++++-----------
> >  1 file changed, 41 insertions(+), 22 deletions(-)
> > 
> > diff --git a/pve-rs/src/bindings/sdn/fabrics.rs b/pve-rs/src/bindings/sdn/fabrics.rs
> > index b7c2d91e5471..381de692acfc 100644
> > --- a/pve-rs/src/bindings/sdn/fabrics.rs
> > +++ b/pve-rs/src/bindings/sdn/fabrics.rs
> > @@ -841,6 +841,7 @@ pub mod pve_rs_sdn_fabrics {
> >          };
> >  
> >          let fabric = config.get_fabric(&fabric_id)?;
> > +        let vrf = fabric.fabric_vrf_name();
> >          match fabric {
> >              FabricEntry::Openfabric(_) => {
> >                  let openfabric_ipv4_routes_string = String::from_utf8(
> > @@ -878,12 +879,12 @@ pub mod pve_rs_sdn_fabrics {
> >                  )
> >              }
> >              FabricEntry::Ospf(_) => {
> > -                let ospf_routes_string = String::from_utf8(
> > -                    Command::new("sh")
> > -                        .args(["-c", "vtysh -c 'show ip route ospf json'"])
> > -                        .output()?
> > -                        .stdout,
> > -                )?;
> > +                let command = match &vrf {
> > +                    Some(vrf) => format!("vtysh -c 'show ip route vrf {vrf} ospf json'"),
> 
> not a pressing issue as it inserts the zone name, but we really shouldn't interpolate this into
> a string here, it's easily avoidable.

Right, pulled it out in a helper. Removed the invocation through `sh -c` and
added the HIST_FILE override.

> > +                    None => "vtysh -c 'show ip route ospf json'".to_string(),
> > +                };
> > +                let ospf_routes_string =
> > +                    String::from_utf8(Command::new("sh").args(["-c", &command]).output()?.stdout)?;
> >                  let ospf_routes: proxmox_frr::de::Routes = if ospf_routes_string.is_empty() {
> >                      proxmox_frr::de::Routes::default()
> >                  } else {

Fixed all the other invocations as well.

Thanks for the review!




^ permalink raw reply	[flat|nested] 65+ messages in thread

* Re: [PATCH pve-network v3 14/32] sdn: evpn: add unreachable IPv6 default route to zone VRFs
  2026-11-18 16:39     ` Stefan Hanreich
@ 2026-11-19 13:38       ` Gabriel Goller
  2026-11-19 15:51         ` Gabriel Goller
  0 siblings, 1 reply; 65+ messages in thread
From: Gabriel Goller @ 2026-11-19 13:38 UTC (permalink / raw)
  To: Stefan Hanreich; +Cc: pve-devel

On 18.11.2026 17:39, Stefan Hanreich wrote:
> On 11/18/26 5:08 PM, Stefan Hanreich wrote:
> > could be added upfront independentenly
> > 
> > Reviewed-by: Stefan Hanreich <s.hanreich@proxmox.com>
> on second thought: how does this behave if IPv6 is disabled?

If we disable through sysctl (as we recommend
https://pve.proxmox.com/pve-docs/chapter-sysadmin.html#_disabling_ipv6_on_the_node)
it works, but if it is disabled through kernel cmdline it fails.




^ permalink raw reply	[flat|nested] 65+ messages in thread

* Re: [PATCH pve-network v3 15/32] sdn: add optional VRFs for simple zones
  2026-11-18 16:18   ` Stefan Hanreich
@ 2026-11-19 13:44     ` Gabriel Goller
  0 siblings, 0 replies; 65+ messages in thread
From: Gabriel Goller @ 2026-11-19 13:44 UTC (permalink / raw)
  To: Stefan Hanreich; +Cc: pve-devel

On 18.11.2026 17:18, Stefan Hanreich wrote:
> 
> 
> On 11/16/26 5:16 PM, Gabriel Goller wrote:
> > Allow simple zones to isolate routing with dedicated-vrf. It is
> > disabled by default to preserve existing behavior.
> > 
> > Create the VRF even when the zone has no VNets, so fabrics can use it
> > without requiring a VNet.
> > 
> > Add unreachable IPv4 and IPv6 default routes with the highest metric
> > to the VRF, as EVPN does on non-exit nodes. Otherwise lookups that find
> > no route in the VRF table fall through to the main table, e.g. if no
> > default route is configured or before FRR has installed it.
> > 
> > Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
> > ---
> >  src/PVE/API2/Network/SDN/Zones.pm             |  6 ++++
> >  src/PVE/Network/SDN/Zones.pm                  | 19 +++++++++--
> >  src/PVE/Network/SDN/Zones/EvpnPlugin.pm       |  5 +--
> >  src/PVE/Network/SDN/Zones/Plugin.pm           | 11 ++++++
> >  src/PVE/Network/SDN/Zones/SimplePlugin.pm     | 32 +++++++++++++++--
> >  .../hetzner-vrf/expected_sdn_interfaces       | 27 +++++++++++++++
> >  src/test/zones/simple/hetzner-vrf/interfaces  |  6 ++++
> >  src/test/zones/simple/hetzner-vrf/sdn_config  | 34 +++++++++++++++++++
> >  .../simple/vrf-empty/expected_sdn_interfaces  |  7 ++++
> >  src/test/zones/simple/vrf-empty/interfaces    |  2 ++
> >  src/test/zones/simple/vrf-empty/sdn_config    | 12 +++++++
> >  .../zones/simple/vrf/expected_sdn_interfaces  | 14 ++++++++
> >  src/test/zones/simple/vrf/interfaces          |  2 ++
> >  src/test/zones/simple/vrf/sdn_config          | 17 ++++++++++
> >  14 files changed, 187 insertions(+), 7 deletions(-)
> >  create mode 100644 src/test/zones/simple/hetzner-vrf/expected_sdn_interfaces
> >  create mode 100644 src/test/zones/simple/hetzner-vrf/interfaces
> >  create mode 100644 src/test/zones/simple/hetzner-vrf/sdn_config
> >  create mode 100644 src/test/zones/simple/vrf-empty/expected_sdn_interfaces
> >  create mode 100644 src/test/zones/simple/vrf-empty/interfaces
> >  create mode 100644 src/test/zones/simple/vrf-empty/sdn_config
> >  create mode 100644 src/test/zones/simple/vrf/expected_sdn_interfaces
> >  create mode 100644 src/test/zones/simple/vrf/interfaces
> >  create mode 100644 src/test/zones/simple/vrf/sdn_config
> > 
> > diff --git a/src/PVE/API2/Network/SDN/Zones.pm b/src/PVE/API2/Network/SDN/Zones.pm
> > index 74b10f032bf4..38d950fda076 100644
> > --- a/src/PVE/API2/Network/SDN/Zones.pm
> > +++ b/src/PVE/API2/Network/SDN/Zones.pm
> > @@ -61,6 +61,12 @@ my $ZONE_PROPERTIES = {
> >          optional => 1,
> >          description => 'Name of DHCP server backend for this zone.',
> >      },
> > +    'dedicated-vrf' => {
> > +        type => 'boolean',
> > +        default => 0,
> > +        optional => 1,
> > +        description => 'Create a dedicated VRF for a simple zone.',
> > +    },
> >      'rt-import' => {
> >          type => 'string',
> >          optional => 1,
> > diff --git a/src/PVE/Network/SDN/Zones.pm b/src/PVE/Network/SDN/Zones.pm
> > index c189652a79eb..cf81c002c4a5 100644
> > --- a/src/PVE/Network/SDN/Zones.pm
> > +++ b/src/PVE/Network/SDN/Zones.pm
> > @@ -124,6 +124,9 @@ sub generate_etc_network_config {
> >      my $controller_cfg = $cfg->{controllers};
> >      return if !$vnet_cfg && !$zone_cfg;
> >  
> > +    my $vnet_ids = $vnet_cfg ? ($vnet_cfg->{ids} // {}) : {};
> > +    my $zone_ids = $zone_cfg ? ($zone_cfg->{ids} // {}) : {};
> > +
> >      my $interfaces_config = PVE::INotify::read_file('interfaces');
> >      my $bridge_ports = PVE::IPRoute2::get_bridge_port_mapping();
> >  
> > @@ -131,8 +134,18 @@ sub generate_etc_network_config {
> >      my $config = {};
> >      my $nodename = PVE::INotify::nodename();
> >  
> > -    for my $id (sort keys %{ $vnet_cfg->{ids} }) {
> > -        my $vnet = $vnet_cfg->{ids}->{$id};
> > +    for my $zone_id (sort keys %$zone_ids) {
> > +        my $plugin_config = $zone_ids->{$zone_id};
> > +        next if $plugin_config->{type} ne 'simple';
> > +        next if defined($plugin_config->{nodes}) && !$plugin_config->{nodes}->{$nodename};
> > +
> > +        PVE::Network::SDN::Zones::SimplePlugin->generate_zone_config(
> 
> fine for now, but shouldn't we make this a method of the ZonePlugin?

Already done in the "sdn: always generate EVPN zone VRFs" commit, but pulled it
back here.

> > +            $plugin_config, $zone_id, $config,
> > +        );
> > +    }
> > +
> > +    for my $id (sort keys %$vnet_ids) {
> > +        my $vnet = $vnet_ids->{$id};
> >          my $zone = $vnet->{zone};
> >  
> >          if (!$zone) {
> > @@ -140,7 +153,7 @@ sub generate_etc_network_config {
> >              next;
> >          }
> >  
> > -        my $plugin_config = $zone_cfg->{ids}->{$zone};
> > +        my $plugin_config = $zone_ids->{$zone};
> >  
> >          if (!defined($plugin_config)) {
> >              warn "can't generate vnet '$id': zone $zone don't exist\n";
> > [snip]

Thanks for the review




^ permalink raw reply	[flat|nested] 65+ messages in thread

* Re: [PATCH pve-network v3 16/32] sdn: allow fabrics to use simple zone VRFs
  2026-11-18 16:27   ` Stefan Hanreich
@ 2026-11-19 14:14     ` Gabriel Goller
  0 siblings, 0 replies; 65+ messages in thread
From: Gabriel Goller @ 2026-11-19 14:14 UTC (permalink / raw)
  To: Stefan Hanreich; +Cc: pve-devel

On 18.11.2026 17:27, Stefan Hanreich wrote:
> generally we should check in the API for where we should use the new _checked helpers
> and which validate_property_references methods should get extended? Here are some,
> and there are probably other in this series as well - please re-check this!
> 
> 
> On 11/16/26 5:15 PM, Gabriel Goller wrote:
> > Let BGP and OSPF fabrics use a simple zone with dedicated-vrf enabled
> > to keep their routes separate from the default VRF.
> > 
> > The zone must be enabled on every fabric node. Prevent zone changes
> > or deletion that would leave a fabric without its VRF. A fabric's zone
> > cannot be changed after creation, since that resets all its sessions
> > anyway and other objects rely on the fabric staying in its VRF.
> > 
> > Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
> > ---
> >  src/PVE/API2/Network/SDN/Fabrics/Fabric.pm    | 57 ++++++++++++++++---
> >  .../API2/Network/SDN/Fabrics/FabricNode.pm    | 18 ++++++
> >  src/PVE/API2/Network/SDN/Zones.pm             | 28 +++++++++
> >  src/PVE/Network/SDN/Controllers/BgpPlugin.pm  |  2 +-
> >  src/PVE/Network/SDN/Fabrics.pm                | 26 +++++++++
> >  5 files changed, 122 insertions(+), 9 deletions(-)
> > 
> > diff --git a/src/PVE/API2/Network/SDN/Fabrics/Fabric.pm b/src/PVE/API2/Network/SDN/Fabrics/Fabric.pm
> > index bbc33e047154..20b7b1f98e4b 100644
> > --- a/src/PVE/API2/Network/SDN/Fabrics/Fabric.pm
> > +++ b/src/PVE/API2/Network/SDN/Fabrics/Fabric.pm
> > @@ -6,13 +6,51 @@ use warnings;
> >  use PVE::Network::SDN;
> >  use PVE::Network::SDN::Controllers;
> >  use PVE::Network::SDN::Fabrics;
> > +use PVE::Network::SDN::Zones;
> >  
> > +use PVE::Exception qw(raise_param_exc);
> >  use PVE::JSONSchema qw(get_standard_option);
> >  use PVE::Tools qw(extract_param);
> >  
> >  use PVE::RESTHandler;
> >  use base qw(PVE::RESTHandler);
> >  
> > +sub validate_fabric_zone {
> > +    my ($fabric, $config) = @_;
> > +
> > +    my $protocol = $fabric->{protocol} // '';
> > +    if ($protocol eq 'bgp' && !$fabric->{zone}) {
> > +        my $controller_cfg = PVE::Network::SDN::Controllers::config();
> > +        for my $controller_id (keys %{ $controller_cfg->{ids} // {} }) {
> > +            my $controller = $controller_cfg->{ids}->{$controller_id};
> > +            if ($controller->{type} eq 'bgp') {
> > +                die "cannot configure a BGP fabric while BGP controller '$controller_id' exists:"
> > +                    . " both target the default-VRF BGP router\n";
> > +            }
> > +        }
> > +    }
> > +
> > +    my $zone_id = $fabric->{zone};
> > +    return if !$zone_id;
> > +
> > +    raise_param_exc({ zone => 'VRF zones are only supported for BGP and OSPF fabrics' })
> > +        if $protocol !~ /^(?:bgp|ospf)$/;
> > +
> > +    my $zone = PVE::Network::SDN::Zones::get_zone($zone_id);
> 
> should this use get_zone_checked instead?

pulled this into `api_validate_property_references()` and used the _checked variant!

> > +
> > +    raise_param_exc({ zone => "zone '$zone_id' does not exist" }) if !$zone;
> > +    raise_param_exc({ zone => "zone '$zone_id' is not a simple zone" })
> > +        if $zone->{type} ne 'simple';
> > +    raise_param_exc({ zone => "zone '$zone_id' is configured to use the default VRF" })
> > +        if $zone->{'default-vrf'} // 1;
> 
> Isn't that dedicated-vrf?

Oof, yeah, fat-fingered this one.

> > +
> > +    if ($config) {
> > +        PVE::Network::SDN::Fabrics::assert_fabric_nodes_in_zone(
> > +            $config, $fabric->{id}, $zone_id, $zone,
> > +        );
> > +    }
> > +}
> > +
> >  __PACKAGE__->register_method({
> >      name => 'index',
> >      path => '',
> > @@ -129,6 +167,8 @@ __PACKAGE__->register_method({
> >      protected => 1,
> >      permissions => {
> >          check => ['perm', '/sdn/fabrics', ['SDN.Allocate']],
> > +        description => "Assigning a VRF zone additionally requires 'SDN.Allocate' on"
> > +            . " '/sdn/zones/<zone>'.",
> >      },
> >      parameters => {
> >          properties => PVE::Network::SDN::Fabrics::fabric_properties(0),
> > @@ -148,14 +188,10 @@ __PACKAGE__->register_method({
> >                  my $digest = extract_param($param, 'digest');
> >                  PVE::Tools::assert_if_modified($config->digest(), $digest) if $digest;
> >  
> > -                if (($param->{protocol} // '') eq 'bgp') {
> > -                    my $controller_cfg = PVE::Network::SDN::Controllers::config();
> > -                    for my $id (keys %{ $controller_cfg->{ids} // {} }) {
> > -                        die "cannot add a BGP fabric while BGP controller '$id' exists:"
> > -                            . " both target the default-VRF BGP router\n"
> > -                            if $controller_cfg->{ids}->{$id}->{type} eq 'bgp';
> > -                    }
> > -                }
> > +                PVE::Network::SDN::Zones::api_get_zone_checked($param->{zone}, ['SDN.Allocate'])
> > +                    if $param->{zone};
> > +
> > +                validate_fabric_zone($param);
> >  
> >                  my $privs = ['SDN.Use', 'SDN.Allocate'];
> >                  PVE::Network::SDN::Fabrics::api_validate_property_references($param, $privs);
> > @@ -200,7 +236,12 @@ __PACKAGE__->register_method({
> >                  my $privs = ['SDN.Use', 'SDN.Allocate'];
> >                  PVE::Network::SDN::Fabrics::api_validate_property_references($param, $privs);
> 
> does this fn also cover the zone permissions now?

It does now!

> >  
> > +                my $old_zone = $config->get_fabric($id)->{zone} // '';
> > +                raise_param_exc({ zone => "cannot change the VRF zone of an existing fabric" })
> > +                    if defined($param->{zone}) && $param->{zone} ne $old_zone;
> 
> this doesn't deny deleting the zone param.

Hmm 'zone' is not in the delete enum, I think thats enough?

> > +
> >                  $config->update_fabric($id, $param);
> > +                validate_fabric_zone($config->get_fabric($id), $config);
> >                  PVE::Network::SDN::Fabrics::write_config($config);
> >              },
> >              "updating fabric failed",
> > diff --git a/src/PVE/API2/Network/SDN/Fabrics/FabricNode.pm b/src/PVE/API2/Network/SDN/Fabrics/FabricNode.pm
> > index 7a148b550f7d..eb3b429075e5 100644
> > --- a/src/PVE/API2/Network/SDN/Fabrics/FabricNode.pm
> > +++ b/src/PVE/API2/Network/SDN/Fabrics/FabricNode.pm
> > @@ -9,6 +9,7 @@ use PVE::Tools qw(extract_param run_command);
> >  use PVE::Network::SDN;
> >  use PVE::Network::SDN::Fabrics;
> >  use PVE::Network::SDN::WireGuard;
> > +use PVE::Network::SDN::Zones;
> >  use PVE::RS::SDN::Fabrics;
> >  
> >  use PVE::RESTHandler;
> > @@ -138,6 +139,21 @@ my sub is_internal_wireguard_node {
> >      return $node->{protocol} eq 'wireguard' && $node->{role} eq 'internal';
> >  }
> >  
> > +my sub validate_node_fabric_zone {
> > +    my ($config, $fabric_id, $node_id) = @_;
> > +
> > +    my $fabric = $config->get_fabric($fabric_id);
> > +    my $zone_id = $fabric->{zone};
> > +    return if !$zone_id;
> > +
> > +    my $zone = PVE::Network::SDN::Zones::get_zone($zone_id);
> 
> should this use get_zone_checked instead?

done.

> > +
> > +    die "zone '$zone_id' does not exist\n" if !$zone;
> > +    PVE::Network::SDN::Fabrics::assert_fabric_node_in_zone(
> > +        $fabric_id, $node_id, $zone_id, $zone,
> > +    );
> > +}
> > +
> >  __PACKAGE__->register_method({
> >      name => 'add_node',
> >      path => '',
> > @@ -169,6 +185,8 @@ __PACKAGE__->register_method({
> >                  my $digest = extract_param($param, 'digest');
> >                  PVE::Tools::assert_if_modified($config->digest(), $digest) if $digest;
> >  
> > +                validate_node_fabric_zone($config, $param->{fabric_id}, $param->{node_id});
> > +
> >                  if (is_internal_wireguard_node($param) && $param->{interfaces}) {
> >                      my $private_keys = PVE::Network::SDN::WireGuard::private_keys();
> >  
> > [snip]




^ permalink raw reply	[flat|nested] 65+ messages in thread

* Re: [PATCH pve-network v3 17/32] sdn: require underlay fabrics to use the default VRF
  2026-11-18 16:30   ` Stefan Hanreich
@ 2026-11-19 14:33     ` Gabriel Goller
  0 siblings, 0 replies; 65+ messages in thread
From: Gabriel Goller @ 2026-11-19 14:33 UTC (permalink / raw)
  To: Stefan Hanreich; +Cc: pve-devel

On 18.11.2026 17:30, Stefan Hanreich wrote:
> On 11/16/26 5:14 PM, Gabriel Goller wrote:
> > EVPN controllers and VXLAN zones set up their VTEPs and BGP peering in
> > the default VRF, so an underlay fabric in a zone VRF breaks them. A
> > fabric's VRF cannot change after creation, so checking the fabric when
> > a controller or zone references it is enough.
> > 
> > Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
> > ---
> >  src/PVE/Network/SDN/Controllers/EvpnPlugin.pm |  2 ++
> >  src/PVE/Network/SDN/Fabrics.pm                | 10 ++++++++++
> >  src/PVE/Network/SDN/Zones/VxlanPlugin.pm      |  5 +++++
> >  3 files changed, 17 insertions(+)
> > 
> > [snip]
> > diff --git a/src/PVE/Network/SDN/Fabrics.pm b/src/PVE/Network/SDN/Fabrics.pm
> > index e7cec1fe9582..a9ea0b74301e 100644
> > --- a/src/PVE/Network/SDN/Fabrics.pm
> > +++ b/src/PVE/Network/SDN/Fabrics.pm
> > @@ -246,6 +246,16 @@ sub assert_fabric_nodes_in_zone {
> >      }
> >  }
> >  
> > +sub assert_underlay_fabric {
> > +    my ($fabric_id) = @_;
> > +
> > +    my $fabric = eval { config()->get_fabric($fabric_id) };
> > +    die "fabric '$fabric_id' does not exist\n" if !$fabric;
> > +    die "fabric '$fabric_id' is in the VRF of zone '$fabric->{zone}', underlay fabrics must use"
> > +        . " the default VRF\n"
> > +        if $fabric->{zone};
> 
> potentially needs permissions checks here to at least prevent information leaks?

Checked in api_validate_property_references(). Changed the error message to not
leak the zone name.

> > +}
> > +
> >  sub get_frr_daemon_status {
> >      my ($fabric_config) = @_;
> >  
> > diff --git a/src/PVE/Network/SDN/Zones/VxlanPlugin.pm b/src/PVE/Network/SDN/Zones/VxlanPlugin.pm
> > index b8b1ef0eeb7f..059bc90f4211 100644
> > --- a/src/PVE/Network/SDN/Zones/VxlanPlugin.pm
> > +++ b/src/PVE/Network/SDN/Zones/VxlanPlugin.pm
> > @@ -167,6 +167,11 @@ sub on_update_hook {
> >              fabric => "must have exactly one of peers / fabric defined",
> >          });
> >      }
> > +
> > +    if ($zone->{fabric}) {
> > +        eval { PVE::Network::SDN::Fabrics::assert_underlay_fabric($zone->{fabric}) };
> > +        raise_param_exc({ fabric => "$@" }) if $@;
> > +    }
> >  }
> >  
> >  sub vnet_update_hook {




^ permalink raw reply	[flat|nested] 65+ messages in thread

* Re: [PATCH pve-network v3 21/32] sdn: simple: support static routes in zone routing tables
  2026-11-18 16:49   ` Stefan Hanreich
@ 2026-11-19 14:53     ` Gabriel Goller
  0 siblings, 0 replies; 65+ messages in thread
From: Gabriel Goller @ 2026-11-19 14:53 UTC (permalink / raw)
  To: Stefan Hanreich; +Cc: pve-devel

On 18.11.2026 17:49, Stefan Hanreich wrote:
> On 11/16/26 5:16 PM, Gabriel Goller wrote:
> > Allow simple zones to reach outside networks through static routes,
> > without needing a fabric. Routes use the zone's dedicated VRF, or the
> > default routing table if dedicated-vrf is disabled.
> > 
> > Support IPv4 and IPv6 routes, including default routes, with a gateway
> > or an outgoing interface. nexthop-vrf allows a gateway in another VRF,
> > e.g. the default VRF, without moving the uplink into the zone.
> > 
> > Routes are managed by FRR, so zones with static routes need FRR even
> > without a controller or fabric. This requires the matching pve-rs
> > support for route validation and FRR config generation.
> > 
> > Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
> > ---
> >  src/PVE/API2/Network/SDN/Zones.pm         |   9 ++
> >  src/PVE/Network/SDN.pm                    |  22 ++-
> >  src/PVE/Network/SDN/Zones/Plugin.pm       |  55 +++++++
> >  src/PVE/Network/SDN/Zones/SimplePlugin.pm |   1 +
> >  src/test/Makefile                         |   5 +-
> >  src/test/run_test_static_routes.pl        | 178 ++++++++++++++++++++++
> >  6 files changed, 266 insertions(+), 4 deletions(-)
> >  create mode 100644 src/test/run_test_static_routes.pl
> > 
> > diff --git a/src/PVE/API2/Network/SDN/Zones.pm b/src/PVE/API2/Network/SDN/Zones.pm
> > index e4f4b174466e..8df1bf8527fd 100644
> > --- a/src/PVE/API2/Network/SDN/Zones.pm
> > +++ b/src/PVE/API2/Network/SDN/Zones.pm
> > @@ -68,6 +68,15 @@ my $ZONE_PROPERTIES = {
> >          optional => 1,
> >          description => 'Create a dedicated VRF for a simple zone.',
> >      },
> > +    route => {
> > +        type => 'array',
> > +        optional => 1,
> > +        description => 'Static routes in the zone routing table. Simple zone only.',
> > +        items => {
> > +            type => 'string',
> > +            format => 'pve-sdn-static-route',
> > +        },
> > +    },
> >      'rt-import' => {
> >          type => 'string',
> >          optional => 1,
> > diff --git a/src/PVE/Network/SDN.pm b/src/PVE/Network/SDN.pm
> > index 9373ec3035fa..626fe7387f54 100644
> > --- a/src/PVE/Network/SDN.pm
> > +++ b/src/PVE/Network/SDN.pm
> > @@ -17,6 +17,7 @@ use PVE::RESTEnvironment qw(log_warn);
> >  use PVE::RPCEnvironment;
> >  use PVE::Tools qw(file_get_contents file_set_contents extract_param dir_glob_regex run_command);
> >  
> > +use PVE::RS::SDN;
> >  use PVE::RS::SDN::Fabrics;
> >  
> >  use PVE::Network::SDN::Vnets;
> > @@ -130,10 +131,19 @@ sub running_config_has_frr {
> >      my $fabrics = $running_config->{fabrics}->{ids} // {};
> >      my $route_maps = $running_config->{'route-maps'}->{ids} // {};
> >      my $prefix_lists = $running_config->{'prefix-lists'}->{ids} // {};
> > +    my $zones = $running_config->{zones}->{ids} // {};
> > +    my $zone_routes =
> > +        grep { $_->{type} eq 'simple' && scalar(@{ $_->{route} // [] }) } values %$zones;
> >  
> >      my $local_frr_config = PVE::Network::SDN::Frr::local_frr_config_exists();
> >  
> > -    return %$controllers || %$fabrics || %$route_maps || %$prefix_lists || $local_frr_config;
> > +    return
> > +        %$controllers
> > +        || %$fabrics
> > +        || %$route_maps
> > +        || %$prefix_lists
> > +        || $zone_routes
> > +        || $local_frr_config;
> >  }
> >  
> >  sub pending_config {
> > @@ -563,11 +573,14 @@ sub generate_frr_raw_config {
> >  
> >      my $frr_config = {};
> >  
> > +    my $nodename = PVE::INotify::nodename();
> > +
> >      PVE::Network::SDN::Controllers::generate_frr_config($frr_config, $running_config);
> > +    my $routes =
> > +        PVE::RS::SDN::get_zone_routes($running_config->{zones} // { ids => {} }, $nodename);
> > +    push @{ $frr_config->{frr}->{ip_routes} }, @$routes;
> 
> so static routes in simple zones are handled by staticd? Seems a bit odd at least.
> What happens if there's only a simple zone with static routes? Is there a better
> way?

So the choice here was between staticd (frr) and ifupdown2 post-up ip route
add... I went with staticd because ipfudown2 post-up is tricky to remove the
routes again and I thought i'd be nice to redistribute static.

Also we already have the template system in place which makes it quite easy to
generate frr config (staticd always enabled as well).

> 
> >      PVE::Network::SDN::Frr::append_local_config($frr_config);
> >  
> > -    my $nodename = PVE::INotify::nodename();
> > -
> >      return PVE::RS::SDN::get_frr_raw_config(
> >          $frr_config->{'frr'},
> >          $prefix_list_config,
> > @@ -619,6 +632,9 @@ sub generate_dhcp_config {
> >  sub encode_value {
> >      my ($type, $key, $value) = @_;
> >  
> > +    # Route strings contain commas themselves, so preserve array element boundaries.
> > +    return join("\n", sort @$value) if $key eq 'route' && ref($value) eq 'ARRAY';
> > +
> >      if (
> >          $key eq 'nodes'
> >          || $key eq 'exitnodes'
> > diff --git a/src/PVE/Network/SDN/Zones/Plugin.pm b/src/PVE/Network/SDN/Zones/Plugin.pm
> > index dc8f19cb6587..a3863bc9818c 100644
> > --- a/src/PVE/Network/SDN/Zones/Plugin.pm
> > +++ b/src/PVE/Network/SDN/Zones/Plugin.pm
> > @@ -8,6 +8,7 @@ use Net::IP qw(ip_get_version);
> >  use PVE::JSONSchema;
> >  use PVE::Cluster;
> >  use PVE::Network;
> > +use PVE::RS::SDN;
> >  
> >  use PVE::JSONSchema qw(get_standard_option);
> >  use base qw(PVE::SectionConfig);
> > @@ -29,6 +30,50 @@ PVE::JSONSchema::register_standard_option(
> >      },
> >  );
> >  
> > +my $static_route_fmt = {
> > +    prefix => {
> > +        type => 'string',
> > +        description => 'Destination prefix in CIDR notation, including default routes.',
> 
> add a format here

Used FullRangeCIDR. (Moved out to a new module Formats.pm -- wanted to move it
to pve-common, but that requires a synchronous bump, otherwise register_format
dies if it's duplicate...).

> > +    },
> > +    via => {
> > +        type => 'string',
> > +        format => 'ip',
> > +        optional => 1,
> > +        description => 'Next-hop IP address. IPv6 link-local addresses require an interface.',
> > +    },
> > +    iface => {
> > +        type => 'string',
> > +        optional => 1,
> > +        description => 'Outgoing interface. At least one of via or iface is required.',
> 
> add a format here

Done

> > +    },
> > +    distance => {
> > +        type => 'integer',
> > +        minimum => 1,
> > +        maximum => 255,
> > +        optional => 1,
> > +        description => 'Administrative distance.',
> > +    },
> > +    'nexthop-vrf' => {
> > +        type => 'string',
> > +        optional => 1,
> > +        description => 'VRF of the next hop, or default for the default routing table.',
> 
> add a format here

Removed nexthop-vrf completely.




^ permalink raw reply	[flat|nested] 65+ messages in thread

* Re: [PATCH common/manager/network/proxmox{-ve-rs,-perl-rs,-widget-toolkit} v3 00/32] SDN VRF support
  2026-11-18 18:27 ` [PATCH common/manager/network/proxmox{-ve-rs,-perl-rs,-widget-toolkit} v3 00/32] SDN VRF support Stefan Hanreich
@ 2026-11-19 15:33   ` Gabriel Goller
  0 siblings, 0 replies; 65+ messages in thread
From: Gabriel Goller @ 2026-11-19 15:33 UTC (permalink / raw)
  To: Stefan Hanreich; +Cc: pve-devel

On 18.11.2026 19:27, Stefan Hanreich wrote:
> haven't looked at the UI patches yet, tried to look at the design, didn't get
> to do a lot of testing so all of this is judging from the code basically:
> 
> 
> nexthop-vrf is really sketchy imo, as it allows a user with SDN.Allocate on a
> simple zone to route traffic into *any* VRF. At the minimum we should require
> Sys.Modify for that (as already discussed off-list).
> We could lessen that restriction in the future to allow jumping into VRFs of
> SDN entities where the user has permissions for (i.e. I can jump into vrf_X
> if I have SDN.Use on X)
> 
> staticd validates iface and only allows routes for interfaces that are in the
> VRF, which is kinda nice for now since it saves us here but makes creating
> specific routes kinda annoying for interfaces outside the VRF. Also, we're
> relying on staticd behavior for security here.
> 
> I think those could be solved by just requiring Sys.Modify for static
> routes in general. We can always lessen it.
> 
> 
> SNAT still has quite a few problems (see the patch). We should remove it
> and solve them in a follow-up. Also, even without SNAT we need to set CT
> zones on simple zones for all traffic in the firewall daemons. We'd have
> to think a bit about possible implications of this that I haven't thought
> of.
> 
> 
> We should not create null0 routes for simple zones with a dedicated VRF
> in EVPN.

Done.

> DHCP implementation looks generally fine, but imo we'd need to expose
> the DNS server option - as otherwise dnsmasq hands out the system default
> DNS server which is probably not reachable inside a simple zone with custom
> VRF. This feature certainly deserves some practical testing tho.

Also done, existed already, just exposed in ui.





^ permalink raw reply	[flat|nested] 65+ messages in thread

* Re: [PATCH pve-network v3 14/32] sdn: evpn: add unreachable IPv6 default route to zone VRFs
  2026-11-19 13:38       ` Gabriel Goller
@ 2026-11-19 15:51         ` Gabriel Goller
  0 siblings, 0 replies; 65+ messages in thread
From: Gabriel Goller @ 2026-11-19 15:51 UTC (permalink / raw)
  To: Stefan Hanreich; +Cc: pve-devel

On 19.11.2026 14:38, Gabriel Goller wrote:
> On 18.11.2026 17:39, Stefan Hanreich wrote:
> > On 11/18/26 5:08 PM, Stefan Hanreich wrote:
> > > could be added upfront independentenly
> > > 
> > > Reviewed-by: Stefan Hanreich <s.hanreich@proxmox.com>
> > on second thought: how does this behave if IPv6 is disabled?
> 
> If we disable through sysctl (as we recommend
> https://pve.proxmox.com/pve-docs/chapter-sysadmin.html#_disabling_ipv6_on_the_node)
> it works, but if it is disabled through kernel cmdline it fails.

As discussed offlist added a `|| true` so the ipv6 route add is fallible.




^ permalink raw reply	[flat|nested] 65+ messages in thread

* Re: [PATCH common/manager/network/proxmox{-ve-rs,-perl-rs,-widget-toolkit} v3 00/32] SDN VRF support
  2026-11-16 16:11 [PATCH common/manager/network/proxmox{-ve-rs,-perl-rs,-widget-toolkit} v3 00/32] SDN VRF support Gabriel Goller
                   ` (32 preceding siblings ...)
  2026-11-18 18:27 ` [PATCH common/manager/network/proxmox{-ve-rs,-perl-rs,-widget-toolkit} v3 00/32] SDN VRF support Stefan Hanreich
@ 2026-11-19 20:10 ` Gabriel Goller
  33 siblings, 0 replies; 65+ messages in thread
From: Gabriel Goller @ 2026-11-19 20:10 UTC (permalink / raw)
  To: pve-devel

Superseded-by: https://lore.proxmox.com/pve-devel/20261119194116.575520-1-g.goller@proxmox.com/
and
Superseded-by: https://lore.proxmox.com/pve-devel/20261119194547.674512-1-s.hanreich@proxmox.com/




^ permalink raw reply	[flat|nested] 65+ messages in thread

end of thread, other threads:[~2026-11-19 20:10 UTC | newest]

Thread overview: 65+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-16 16:11 [PATCH common/manager/network/proxmox{-ve-rs,-perl-rs,-widget-toolkit} v3 00/32] SDN VRF support Gabriel Goller
2026-11-16 16:11 ` [PATCH pve-common v3 01/32] interfaces: preserve VRF membership across address family changes Gabriel Goller
2026-11-18 14:13   ` Stefan Hanreich
2026-11-18 15:41     ` Gabriel Goller
2026-11-16 16:11 ` [PATCH proxmox-ve-rs v3 02/32] frr: add VRF-aware OSPF rendering Gabriel Goller
2026-11-18 14:41   ` Stefan Hanreich
2026-11-18 16:21     ` Gabriel Goller
2026-11-16 16:11 ` [PATCH proxmox-ve-rs v3 03/32] sdn: add zone references to OSPF and BGP fabrics Gabriel Goller
2026-11-18 14:10   ` Stefan Hanreich
2026-11-18 16:55     ` Gabriel Goller
2026-11-16 16:11 ` [PATCH proxmox-ve-rs v3 04/32] sdn: generate fabric routing configuration in zone VRFs Gabriel Goller
2026-11-18 14:53   ` Stefan Hanreich
2026-11-18 17:26     ` Gabriel Goller
2026-11-16 16:11 ` [PATCH proxmox-ve-rs v3 05/32] sdn: fix VRF route-map scoping and zone ID validation Gabriel Goller
2026-11-16 16:11 ` [PATCH proxmox-ve-rs v3 06/32] tests: fabrics: add test for fabrics in VRFs Gabriel Goller
2026-11-18 15:01   ` Stefan Hanreich
2026-11-18 17:33     ` Gabriel Goller
2026-11-16 16:11 ` [PATCH proxmox-ve-rs v3 07/32] sdn: allow static routes in simple zone VRFs Gabriel Goller
2026-11-18 15:29   ` Stefan Hanreich
2026-11-18 18:10     ` Gabriel Goller
2026-11-16 16:11 ` [PATCH proxmox-ve-rs v3 08/32] sdn: support static routes in EVPN " Gabriel Goller
2026-11-18 15:32   ` Stefan Hanreich
2026-11-19 13:12     ` Gabriel Goller
2026-11-16 16:11 ` [PATCH proxmox-perl-rs v3 09/32] pve-rs: fabrics: assign network interfaces to configured VRFs Gabriel Goller
2026-11-16 16:11 ` [PATCH proxmox-perl-rs v3 10/32] pve-rs: fabrics: make per-fabric status queries VRF-aware Gabriel Goller
2026-11-18 15:42   ` Stefan Hanreich
2026-11-19 13:30     ` Gabriel Goller
2026-11-16 16:11 ` [PATCH proxmox-perl-rs v3 11/32] pve-rs: fabrics: include VRF routes in aggregate status Gabriel Goller
2026-11-16 16:11 ` [PATCH proxmox-perl-rs v3 12/32] pve-rs: fabrics: expose host interface membership Gabriel Goller
2026-11-16 16:11 ` [PATCH proxmox-perl-rs v3 13/32] sdn: expose static routes for simple zone uplinks Gabriel Goller
2026-11-16 16:11 ` [PATCH pve-network v3 14/32] sdn: evpn: add unreachable IPv6 default route to zone VRFs Gabriel Goller
2026-11-18 16:08   ` Stefan Hanreich
2026-11-18 16:39     ` Stefan Hanreich
2026-11-19 13:38       ` Gabriel Goller
2026-11-19 15:51         ` Gabriel Goller
2026-11-16 16:11 ` [PATCH pve-network v3 15/32] sdn: add optional VRFs for simple zones Gabriel Goller
2026-11-18 16:18   ` Stefan Hanreich
2026-11-19 13:44     ` Gabriel Goller
2026-11-16 16:11 ` [PATCH pve-network v3 16/32] sdn: allow fabrics to use simple zone VRFs Gabriel Goller
2026-11-18 16:27   ` Stefan Hanreich
2026-11-19 14:14     ` Gabriel Goller
2026-11-16 16:11 ` [PATCH pve-network v3 17/32] sdn: require underlay fabrics to use the default VRF Gabriel Goller
2026-11-18 16:30   ` Stefan Hanreich
2026-11-19 14:33     ` Gabriel Goller
2026-11-16 16:11 ` [PATCH pve-network v3 18/32] sdn: always generate EVPN zone VRFs Gabriel Goller
2026-11-16 16:11 ` [PATCH pve-network v3 19/32] api: sdn: allow EVPN zones as fabric VRFs Gabriel Goller
2026-11-16 16:11 ` [PATCH pve-network v3 20/32] api: sdn: disallow BGP fabrics in EVPN zone VRFs Gabriel Goller
2026-11-16 16:11 ` [PATCH pve-network v3 21/32] sdn: simple: support static routes in zone routing tables Gabriel Goller
2026-11-18 16:49   ` Stefan Hanreich
2026-11-19 14:53     ` Gabriel Goller
2026-11-16 16:11 ` [PATCH pve-network v3 22/32] sdn: evpn: allow static routes Gabriel Goller
2026-11-16 16:11 ` [PATCH pve-network v3 23/32] sdn: zones: SNAT via dedicated uplinks in zone VRFs Gabriel Goller
2026-11-18 18:07   ` Stefan Hanreich
2026-11-16 16:11 ` [PATCH pve-network v3 24/32] sdn: dhcp: only configure DHCP for zones on the local node Gabriel Goller
2026-11-16 16:11 ` [PATCH pve-network v3 25/32] sdn: dhcp: run dnsmasq in the zone VRF Gabriel Goller
2026-11-16 16:11 ` [PATCH proxmox-widget-toolkit v3 26/32] ui: network: allow selecting a VRF for host interfaces Gabriel Goller
2026-11-16 16:11 ` [PATCH pve-manager v3 27/32] ui: sdn: add VRF zone selection for fabrics Gabriel Goller
2026-11-16 16:11 ` [PATCH pve-manager v3 28/32] ui: sdn: expose EVPN zones as fabric VRFs Gabriel Goller
2026-11-16 16:11 ` [PATCH pve-manager v3 29/32] network: allow setting the VRF of host interfaces Gabriel Goller
2026-11-16 16:11 ` [PATCH pve-manager v3 30/32] ui: sdn: allow static routes for Simple zone VRFs Gabriel Goller
2026-11-16 16:11 ` [PATCH pve-manager v3 31/32] ui: sdn: allow static routes in EVPN zones Gabriel Goller
2026-11-16 16:11 ` [PATCH pve-manager v3 32/32] network: generate SDN DHCP config after ifreload Gabriel Goller
2026-11-18 18:27 ` [PATCH common/manager/network/proxmox{-ve-rs,-perl-rs,-widget-toolkit} v3 00/32] SDN VRF support Stefan Hanreich
2026-11-19 15:33   ` Gabriel Goller
2026-11-19 20:10 ` Gabriel Goller

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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal