LXC CentOS Guest Interface Configuration Broken for Manual IP Config after Update to Proxmox 7

Sebastian Schubert

Well-Known Member
Aug 28, 2017
67
12
48
45
Hi there,

after updating a host from 6.4 to 7.2 today with about 200 containers, none of the containers was bringing up the network.
The Network config is done INSIDE the lxc container and NOT via the Proxmox Config (example: net0: name=eth0,bridge=vmbr0,firewall=0,hwaddr=8E:D2:8A:8C:E9:53,type=veth)

This behaviour was introduced here:
https://git.proxmox.com/?p=pve-container.git;a=commit;h=1c5adf3d312936bc99dc10b95675a03da253d8d4

After THAT Change the ifcfg- file is ALWAYS written, due to $data beeing populated with the "DOMAIN=" values.
The IPADDRESS and any other vital values are missing due to the way we configure the Containers :-/

Proposed patch:
Code:
--- CentOS.pm.orig    2022-10-13 15:55:20.481585325 +0200
+++ CentOS.pm    2022-10-13 15:57:03.084918126 +0200
@@ -240,9 +240,9 @@ sub setup_network {
     my @nameservers = PVE::Tools::split_list($nameserver);

     for my $i (0 .. $#nameservers) {
-        $data .= "DNS".($i+1)."=$nameservers[$i]\n";
+        $header .= "DNS".($i+1)."=$nameservers[$i]\n";
     }
-    $data .= "DOMAIN=".join(' ', PVE::Tools::split_list($searchdomains))."\n" if $searchdomains;
+    $header .= "DOMAIN=".join(' ', PVE::Tools::split_list($searchdomains))."\n" if $searchdomains;

     next unless $data || $bootproto;
     $header .= "BOOTPROTO=$bootproto\n";

Original Issue:
https://bugzilla.proxmox.com/show_bug.cgi?id=3471
https://forum.proxmox.com/threads/c...kmanager-does-not-recognice-ifcfg-eth0.90924/