public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Gabriel Goller <g.goller@proxmox.com>
To: Stefan Hanreich <s.hanreich@proxmox.com>
Cc: pve-devel@lists.proxmox.com
Subject: Re: [PATCH pve-network v3 21/32] sdn: simple: support static routes in zone routing tables
Date: Thu, 19 Nov 2026 15:53:53 +0100	[thread overview]
Message-ID: <av8KQIeaQazTwv6G@luna.proxmox.com> (raw)
In-Reply-To: <7c5c0d40-e12e-45ab-b6a3-eecfffb2c4f3@proxmox.com>

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.




  reply	other threads:[~2026-11-19 15:04 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=av8KQIeaQazTwv6G@luna.proxmox.com \
    --to=g.goller@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    --cc=s.hanreich@proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal