From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id BC4731FF0B4 for ; Tue, 08 Sep 2026 12:18:21 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 14A6321507; Tue, 08 Sep 2026 12:18:18 +0200 (CEST) From: Christoph Heiss To: pve-devel@lists.proxmox.com Subject: [PATCH installer 08/15] install: network: set up management bond if requested Date: Tue, 8 Sep 2026 12:16:22 +0200 Message-ID: <20260908101647.1057780-9-c.heiss@proxmox.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260908101647.1057780-1-c.heiss@proxmox.com> References: <20260908101647.1057780-1-c.heiss@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1788862652114 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.377 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: UMUJC5MLZSC62DK5S2FCAMKCEPFXMMAQ X-Message-ID-Hash: UMUJC5MLZSC62DK5S2FCAMKCEPFXMMAQ X-MailFrom: c.heiss@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Adds the necessary configuration to /etc/network/interfaces when bonding is enabled in the installation config. A bond named 'bond0' will be created, with the default bridge (as before) 'vmbr0' on top of that. Signed-off-by: Christoph Heiss --- Proxmox/Install.pm | 43 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/Proxmox/Install.pm b/Proxmox/Install.pm index 04264a9..9c2b244 100644 --- a/Proxmox/Install.pm +++ b/Proxmox/Install.pm @@ -829,8 +829,39 @@ my sub setup_ifupdown2_config { && ($_->{protocol} // '') eq 'ra'; } $gateways6->@*; + my $bond_opts = Proxmox::Install::Config::get_mngmt_bond_opt(); + my $bond_enabled = Proxmox::Install::Config::get_mngmt_bond_enabled(); + if ($bond_enabled) { + # When setting up bridged networking, the bond is attached to the main bridge as port. + # Otherwise, the bond represents the main management interface, i.e. with the address + # configured directly on it. + + $ethdev = 'bond0'; + my $addr_method = $iso_env->{cfg}->{bridged_network} ? 'manual' : 'static'; + + # translate all bond members MACs to their final interface name, either pinned or not + my @members; + for my $mac ($bond_opts->{members}->@*) { + $mac = lc($mac); # normalize into lowercase + + if (defined($netif_pin_map) && defined($netif_pin_map->{$mac})) { + push @members, $netif_pin_map->{$mac}; + } else { + my ($if) = grep { $_->{mac} eq $mac } values %$interfaces; + push @members, $if->{name}; + } + } + + $ifaces .= + "auto $ethdev\niface $ethdev inet $addr_method\n" + . "\tbond-ports " + . join(' ', @members) . "\n" + . "\tbond-mode $bond_opts->{mode}\n" + . "\tbond-miimon 100\n"; + } + if ($iso_env->{cfg}->{bridged_network}) { - $ifaces .= "iface $ethdev $ntype manual\n"; + $ifaces .= "\niface $ethdev $ntype manual\n" if !$bond_enabled; $ifaces .= "\nauto vmbr0\niface vmbr0 $ntype static\n" @@ -839,11 +870,17 @@ my sub setup_ifupdown2_config { . "\tbridge-ports $ethdev\n" . "\tbridge-stp off\n" . "\tbridge-fd 0\n"; - } else { - $ifaces .= "auto $ethdev\n" . # + } elsif (!$bond_enabled) { + $ifaces .= "\nauto $ethdev\n" . # "iface $ethdev $ntype static\n" . # "\taddress $cidr\n"; + if (!$is_gateway6_from_ra) { + $ifaces .= "\tgateway $gateway\n"; + } + } else { + $ifaces .= "\taddress $cidr\n"; + if (!$is_gateway6_from_ra) { $ifaces .= "\tgateway $gateway\n"; } -- 2.55.0