From: Stefan Hanreich <s.hanreich@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: Re: [PATCH installer v2] network: align VLAN interface names with the documentation
Date: Tue, 24 Nov 2026 13:21:17 +0100 [thread overview]
Message-ID: <9f279375-b419-4f20-894a-9d767b5e17dc@proxmox.com> (raw)
In-Reply-To: <20261124114245.2656326-1-s.ivanov@proxmox.com>
gave this a quick spin on a rebuilt ISO, generated vmbr0.137
as expected.
Tested-by: Stefan Hanreich <s.hanreich@proxmox.com>
On 11/24/26 12:43 PM, Stoiko Ivanov wrote:
> Our documentation has relied on ifupdown(2)'s way of handling
> $iface.$vid as identifier for VLAN interfaces for a long while
> (looking through pve-docs commit history shows `vlan-raw-device`
> only occurring in the api-viewer)
>
> One case where the $iface.$vlan_id naming breaks is for long
> interface names (e.g. enp129s0f1np1, or mac-based enxdadadadadada)
>
> Use the dot-notation where this is possible, and fallback
> to `vlan$vlan_id` with `vlan-raw-device $iface` where this is needed
>
> For the dot-notation case also drop `vlan-raw-device` to avoid
> misconfigurations due to mismatches/incomplete substitutions.
>
> I considered also adding `vlan-id $vlan_id` to the config in the
> `vlan-raw-device` case, based on ifupdown-addons-interfaces(5) saying
> it requires it, but my tests show it's not needed.
>
> I considered encoding the interface name as "utf-8" for the length
> comparison, but we luckily restrict the pinned names to ascii only.
>
> Sticking to our documentation should help reducing the different
> ways that people are configuring their interfaces and thus hopefully
> the potential for errors.
>
> Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
> ---
> v1->v2:
> * merge both patches into a single one
> * handle the quite real case of long predictable ifnames (enp129s0f1np1)
> pointed out by Stefan (and a review tool)
> * add a test-case.
> v1:
> https://lore.proxmox.com/pve-devel/dbbc7520-5e8a-4e10-9371-d1c7745cfd5c@proxmox.com/T/#t
>
> Proxmox/Install.pm | 12 +++-
> test/generate-ifupdown2-config.pl | 106 +++++++++++++++++++++---------
> 2 files changed, 85 insertions(+), 33 deletions(-)
>
> diff --git a/Proxmox/Install.pm b/Proxmox/Install.pm
> index 76bfd04..c1660fb 100644
> --- a/Proxmox/Install.pm
> +++ b/Proxmox/Install.pm
> @@ -16,6 +16,7 @@ use Proxmox::Install::StorageConfig;
> use Proxmox::Sys::Block qw(get_cached_disks wipe_disk partition_bootable_disk);
> use Proxmox::Sys::Command qw(run_command syscmd);
> use Proxmox::Sys::File qw(file_read_firstline file_read_all file_write_all);
> +use Proxmox::Sys::Net;
> use Proxmox::Sys::ZFS;
> use Proxmox::UI;
>
> @@ -887,9 +888,16 @@ sub generate_ifupdown2_config {
> my $get_vlan_stanza = sub {
> my ($raw_device) = @_;
>
> - my $config = "auto vlan$vlan_id\niface vlan$vlan_id $ntype static\n\taddress $cidr\n";
> + my $devname = "$raw_device.$vlan_id";
> + my $long_if = length($devname) > Proxmox::Sys::Net::MAX_IFNAME_LEN;
> + $devname = "vlan$vlan_id" if $long_if;
> +
> + my $config = "auto $devname\niface $devname $ntype static\n\taddress $cidr\n";
> $config .= "\tgateway $gateway\n" if !$is_gateway6_from_ra;
> - return [4, "vlan$vlan_id", $config . "\tvlan-raw-device $raw_device\n"];
> +
> + $config .= "\tvlan-raw-device $raw_device\n" if $long_if;
> +
> + return [4, $devname, $config];
> };
>
> if ($iso_env->{cfg}->{bridged_network} && defined($vlan_id)) {
> diff --git a/test/generate-ifupdown2-config.pl b/test/generate-ifupdown2-config.pl
> index a3b7bdb..9bf6a40 100755
> --- a/test/generate-ifupdown2-config.pl
> +++ b/test/generate-ifupdown2-config.pl
> @@ -152,11 +152,10 @@ is_generated(
> auto eno1
> iface eno1 inet manual
>
> -auto vlan5
> -iface vlan5 inet static
> +auto eno1.5
> +iface eno1.5 inet static
> address 192.168.0.10/24
> gateway 192.168.0.1
> - vlan-raw-device eno1
>
> iface eno2 inet manual
> EOT
> @@ -194,11 +193,10 @@ iface bond0 inet manual
> bond-miimon 100
> bond-mode active-backup
>
> -auto vlan5
> -iface vlan5 inet static
> +auto bond0.5
> +iface bond0.5 inet static
> address 192.168.0.10/24
> gateway 192.168.0.1
> - vlan-raw-device bond0
>
> auto eno1
> iface eno1 inet manual
> @@ -244,11 +242,10 @@ iface vmbr0 inet manual
> bridge-vlan-aware yes
> bridge-vids 2-4094
>
> -auto vlan5
> -iface vlan5 inet static
> +auto vmbr0.5
> +iface vmbr0.5 inet static
> address 192.168.0.10/24
> gateway 192.168.0.1
> - vlan-raw-device vmbr0
> EOT
> , 'host network setup',
> );
> @@ -304,11 +301,10 @@ iface vmbr0 inet manual
> bridge-vlan-aware yes
> bridge-vids 2-4094
>
> -auto vlan5
> -iface vlan5 inet static
> +auto vmbr0.5
> +iface vmbr0.5 inet static
> address 192.168.0.10/24
> gateway 192.168.0.1
> - vlan-raw-device vmbr0
> EOT
> , 'host network setup',
> );
> @@ -323,11 +319,10 @@ iface eno1 inet manual
>
> iface eno2 inet manual
>
> -auto vlan5
> -iface vlan5 inet static
> +auto eno1.5
> +iface eno1.5 inet static
> address 192.168.0.10/24
> gateway 192.168.0.1
> - vlan-raw-device eno1
> EOT
> , 'interfaces ordered like the network API',
> );
> @@ -347,11 +342,10 @@ iface bond0 inet manual
> bond-miimon 100
> bond-mode active-backup
>
> -auto vlan5
> -iface vlan5 inet static
> +auto bond0.5
> +iface bond0.5 inet static
> address 192.168.0.10/24
> gateway 192.168.0.1
> - vlan-raw-device bond0
> EOT
> , 'interfaces ordered like the network API',
> );
> @@ -363,11 +357,10 @@ is_generated(
> auto eno1
> iface eno1 inet manual
>
> -auto vlan5
> -iface vlan5 inet static
> +auto eno1.5
> +iface eno1.5 inet static
> address 192.168.0.10/24
> gateway 192.168.0.1
> - vlan-raw-device eno1
>
> iface eno2 inet manual
> EOT
> @@ -749,11 +742,10 @@ iface bond0 inet6 manual
> bond-miimon 100
> bond-mode active-backup
>
> -auto vlan5
> -iface vlan5 inet6 static
> +auto bond0.5
> +iface bond0.5 inet6 static
> address 2001:db8::1/64
> gateway fe80::1
> - vlan-raw-device bond0
>
> auto eno1
> iface eno1 inet6 manual
> @@ -797,10 +789,9 @@ is_generated(
> auto eno1
> iface eno1 inet6 manual
>
> -auto vlan5
> -iface vlan5 inet6 static
> +auto eno1.5
> +iface eno1.5 inet6 static
> address 2001:db8::1/64
> - vlan-raw-device eno1
>
> iface eno2 inet6 manual
> EOT
> @@ -822,10 +813,9 @@ iface vmbr0 inet6 manual
> bridge-vlan-aware yes
> bridge-vids 2-4094
>
> -auto vlan5
> -iface vlan5 inet6 static
> +auto vmbr0.5
> +iface vmbr0.5 inet6 static
> address 2001:db8::1/64
> - vlan-raw-device vmbr0
> EOT
> , 'gateway learned from router advertisements on the management VLAN on a bridge is not configured',
> );
> @@ -834,7 +824,7 @@ set_config(bridge => 0, bond => 0, vlan => 1);
> Proxmox::Install::Config::merge({ mngmt_vlan => { enabled => 1, vid => 200 } });
> like(
> Proxmox::Install::generate_ifupdown2_config(),
> - qr/^iface vlan200 inet6 static\n\taddress 2001:db8::1\/64\n\tgateway fe80::1\n/m,
> + qr/^iface eno1.200 inet6 static\n\taddress 2001:db8::1\/64\n\tgateway fe80::1\n/m,
> 'management VLAN other than the installation environment one gets the configured gateway',
> );
>
> @@ -845,6 +835,60 @@ like(
> 'untagged management network with a tagged installation environment gets the configured gateway',
> );
>
> +# handling of long predictable nic name
> +$proxmox_install_runenv->redefine(
> + get => sub {
> + return {
> + network => {
> + interfaces => {
> + enp129s0f1np1 => {
> + mac => '12:34:56:ab:cd:ef',
> + index => 1,
> + name => 'enp129s0f1np1',
> + pinned_id => '0',
> + },
> + },
> + },
> + };
> + },
> +);
> +set_config(bridge => 0, bond => 0, vlan => 0);
> +Proxmox::Install::Config::merge({
> + mngmt_nic => 'enp129s0f1np1',
> + cidr => '192.168.0.10/24',
> + gateway => '192.168.0.1',
> +});
> +is_generated(
> + <<EOT
> +auto enp129s0f1np1
> +iface enp129s0f1np1 inet static
> + address 192.168.0.10/24
> + gateway 192.168.0.1
> +EOT
> + , 'direct config on a physical link with a long name',
> +);
> +
> +set_config(bridge => 0, bond => 0, vlan => 1);
> +Proxmox::Install::Config::merge({
> + mngmt_nic => 'enp129s0f1np1',
> + cidr => '192.168.0.10/24',
> + gateway => '192.168.0.1',
> + mngmt_vlan => { enabled => 1, vid => 4094 },
> +});
> +is_generated(
> + <<EOT
> +auto enp129s0f1np1
> +iface enp129s0f1np1 inet manual
> +
> +auto vlan4094
> +iface vlan4094 inet static
> + address 192.168.0.10/24
> + gateway 192.168.0.1
> + vlan-raw-device enp129s0f1np1
> +EOT
> + , 'VLAN on a physical link with a long name',
> +);
> +
> for my $id (0, 1, 4095, 'abc', '1.5') {
> eval { Proxmox::Install::Config::set_mngmt_vlan_opt('vid', $id) };
> like(
next prev parent reply other threads:[~2026-11-24 12:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 11:42 [PATCH installer v2] network: align VLAN interface names with the documentation Stoiko Ivanov
2026-11-24 12:21 ` Stefan Hanreich [this message]
2026-11-24 18:13 ` applied: " Thomas Lamprecht
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=9f279375-b419-4f20-894a-9d767b5e17dc@proxmox.com \
--to=s.hanreich@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.