CentOS8/Alma8/Rocky8: NetworkManager does not recognice ifcfg-eth0

deac

New Member
Jun 15, 2021
5
3
3
Vienna
nach.denkn.at
Hi,

I installed several CTs with AlmaLinux8 and RockyLinux8, but CentOS8 and RHEL8 should have the same problem.

Config:
Code:
arch: amd64
cmode: shell
cores: 1
description: Rocky Linux 8%0A
hostname: gd-rocky8-2
memory: 2048
net0: name=eth0,bridge=vmbr1,firewall=1,gw=10.7.255.254,hwaddr=DE:9E:4B:44:F2:81,ip=10.7.255.5/24,ip6=auto,mtu=9166,tag=2007,type=veth
ostype: centos
rootfs: root:vm-729-disk-0,size=4G
swap: 0
unprivileged: 1

This generates a /etc/sysconfig/network-scripts/ifcfg-eth0:

Bash:
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=none
IPADDR=10.7.255.5
NETMASK=255.255.255.0
GATEWAY=10.7.255.254
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6ADDR=auto

NetworkManager does not recognize this config or ignores it, nmtui does not shows this config.
I tried to create a config /etc/sysconfig/network-scripts/ifcfg-Wired_connection_1 by nmtui:

Bash:
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
IPADDR=10.7.255.5
PREFIX=8
GATEWAY=10.7.255.245
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME="Wired connection 1"
UUID=f47e3323-51aa-37cf-938e-d9bc0a4a9391
DEVICE=eth0
ONBOOT=yes
AUTOCONNECT_PRIORITY=-999

It seems, NetworkManager requires additional fields, which are not provided by proxmox, yet.
My suggestion would be, it is IPV6ADDR=auto, because the logs shows:

Code:
Jun 14 21:02:48 gd-rocky8-2 NetworkManager[447]: <warn>  [1623704568.0510] ifcfg-rh: load[/etc/sysconfig/network-scripts/ifcfg-eth0]: failure to read file: Invalid IP6 address 'auto'

But after removing it, it does not work, yet:

Code:
Jun 15 09:13:45 gd-rocky8-2 NetworkManager[1920]: <info>  [1623748425.4989] bus-manager: acquired D-Bus service "org.freedesktop.NetworkManager"
Jun 15 09:13:45 gd-rocky8-2 NetworkManager[1920]: <info>  [1623748425.5000] manager[0x561c4d605060]: monitoring kernel firmware directory '/lib/firmware'.
Jun 15 09:13:45 gd-rocky8-2 NetworkManager[1920]: <info>  [1623748425.5425] hostname: hostname: using hostnamed
Jun 15 09:13:45 gd-rocky8-2 NetworkManager[1920]: <info>  [1623748425.5427] dns-mgr[0x561c4d5fa130]: init: dns=default,systemd-resolved rc-manager=symlink
Jun 15 09:13:45 gd-rocky8-2 NetworkManager[1920]: <info>  [1623748425.5450] manager: rfkill: Wi-Fi enabled by radio killswitch; enabled by state file
Jun 15 09:13:45 gd-rocky8-2 NetworkManager[1920]: <info>  [1623748425.5450] manager: rfkill: WWAN enabled by radio killswitch; enabled by state file
Jun 15 09:13:45 gd-rocky8-2 NetworkManager[1920]: <info>  [1623748425.5451] manager: Networking is enabled by state file
Jun 15 09:13:45 gd-rocky8-2 NetworkManager[1920]: <info>  [1623748425.5451] dhcp-init: Using DHCP client 'internal'
Jun 15 09:13:45 gd-rocky8-2 NetworkManager[1920]: <info>  [1623748425.5454] settings: Loaded settings plugin: ifcfg-rh ("/usr/lib64/NetworkManager/1.30.0-7.el8/libnm-settings-plugin-ifcfg-rh.so")
Jun 15 09:13:45 gd-rocky8-2 NetworkManager[1920]: <info>  [1623748425.5455] settings: Loaded settings plugin: keyfile (internal)
Jun 15 09:13:45 gd-rocky8-2 NetworkManager[1920]: <info>  [1623748425.5469] device (lo): carrier: link connected
Jun 15 09:13:45 gd-rocky8-2 NetworkManager[1920]: <info>  [1623748425.5471] manager: (lo): new Generic device (/org/freedesktop/NetworkManager/Devices/1)
Jun 15 09:13:45 gd-rocky8-2 NetworkManager[1920]: <info>  [1623748425.5474] device (eth0): carrier: link connected
Jun 15 09:13:45 gd-rocky8-2 NetworkManager[1920]: <info>  [1623748425.5476] manager: (eth0): new Veth device (/org/freedesktop/NetworkManager/Devices/2)
Jun 15 09:13:45 gd-rocky8-2 NetworkManager[1920]: <info>  [1623748425.5483] manager: (eth0): assume: will attempt to assume matching connection 'Wired connection 1' (f47e3323-51aa-37cf-938e-d9bc0a4a9391) (indicated)
Jun 15 09:13:45 gd-rocky8-2 NetworkManager[1920]: <info>  [1623748425.5484] device (eth0): state change: unmanaged -> unavailable (reason 'connection-assumed', sys-iface-state: 'assume')
Jun 15 09:13:45 gd-rocky8-2 NetworkManager[1920]: <info>  [1623748425.5571] device (eth0): state change: unavailable -> disconnected (reason 'connection-assumed', sys-iface-state: 'assume')
Jun 15 09:13:45 gd-rocky8-2 NetworkManager[1920]: <info>  [1623748425.5593] device (eth0): Activation: starting connection 'Wired connection 1' (f47e3323-51aa-37cf-938e-d9bc0a4a9391)
Jun 15 09:13:45 gd-rocky8-2 NetworkManager[1920]: <info>  [1623748425.5656] device (eth0): state change: disconnected -> prepare (reason 'none', sys-iface-state: 'assume')
Jun 15 09:13:45 gd-rocky8-2 NetworkManager[1920]: <info>  [1623748425.5675] device (eth0): state change: prepare -> config (reason 'none', sys-iface-state: 'assume')
Jun 15 09:13:45 gd-rocky8-2 NetworkManager[1920]: <info>  [1623748425.5687] device (eth0): state change: config -> ip-config (reason 'none', sys-iface-state: 'assume')
Jun 15 09:13:45 gd-rocky8-2 NetworkManager[1920]: <info>  [1623748425.5698] dhcp4 (eth0): activation: beginning transaction (timeout in 45 seconds)
Jun 15 09:13:45 gd-rocky8-2 NetworkManager[1920]: <info>  [1623748425.7654] device (eth0): state change: ip-config -> ip-check (reason 'none', sys-iface-state: 'assume')
Jun 15 09:13:45 gd-rocky8-2 NetworkManager[1920]: <info>  [1623748425.7678] device (eth0): state change: ip-check -> secondaries (reason 'none', sys-iface-state: 'assume')
Jun 15 09:13:45 gd-rocky8-2 NetworkManager[1920]: <info>  [1623748425.7680] device (eth0): state change: secondaries -> activated (reason 'none', sys-iface-state: 'assume')
Jun 15 09:13:45 gd-rocky8-2 NetworkManager[1920]: <info>  [1623748425.7682] manager: NetworkManager state is now CONNECTED_LOCAL
Jun 15 09:13:45 gd-rocky8-2 NetworkManager[1920]: <info>  [1623748425.7687] manager: NetworkManager state is now CONNECTED_SITE
Jun 15 09:13:45 gd-rocky8-2 NetworkManager[1920]: <info>  [1623748425.7688] policy: set 'Wired connection 1' (eth0) as default for IPv6 routing and DNS
Jun 15 09:13:45 gd-rocky8-2 NetworkManager[1920]: <info>  [1623748425.8250] device (eth0): Activation: successful, device activated.
Jun 15 09:13:45 gd-rocky8-2 NetworkManager[1920]: <info>  [1623748425.8254] manager: NetworkManager state is now CONNECTED_GLOBAL
Jun 15 09:13:45 gd-rocky8-2 NetworkManager[1920]: <info>  [1623748425.8256] manager: startup complete
Jun 15 09:14:31 gd-rocky8-2 NetworkManager[1920]: <warn>  [1623748471.0292] dhcp4 (eth0): request timed out
Jun 15 09:14:31 gd-rocky8-2 NetworkManager[1920]: <info>  [1623748471.0292] dhcp4 (eth0): state changed unknown -> timeout
Jun 15 09:14:31 gd-rocky8-2 NetworkManager[1920]: <info>  [1623748471.0293] device (eth0): DHCPv4: trying to acquire a new lease within 90 seconds
Jun 15 09:16:01 gd-rocky8-2 NetworkManager[1920]: <info>  [1623748561.0308] device (eth0): DHCPv4: grace period expired

This shows us, that “Wired connection 1” (generated by NetworkManager) instead of eth0 will be used, yet.
I checked, which field are needed to accept a generated file. The UUID-field is mandatory.

So, to support CentOS8/RHEL8/AlmaLinux8/RockyLinux8, you have to add UUID[ICODE] and you must remove [ICODE]IP6ADDR=auto.
I haven't tested this with older CentOS/..., yet.

Code:
proxmox-ve: 6.4-1 (running kernel: 5.4.103-1-pve)
pve-manager: 6.4-8 (running version: 6.4-8/185e14db)
pve-kernel-5.11: 7.0-2~bpo10
pve-kernel-5.4: 6.4-3
pve-kernel-helper: 6.4-3
pve-kernel-5.11.21-1-pve: 5.11.21-1~bpo10
pve-kernel-5.4.119-1-pve: 5.4.119-1
pve-kernel-5.4.103-1-pve: 5.4.103-1
ceph: 14.2.20-pve1
ceph-fuse: 14.2.20-pve1
corosync: 3.1.2-pve1
criu: 3.11-3
glusterfs-client: 5.5-3
ifupdown: residual config
ifupdown2: 3.0.0-1+pve3
ksm-control-daemon: 1.3-1
libjs-extjs: 6.0.1-10
libknet1: 1.20-pve1
libproxmox-acme-perl: 1.1.0
libproxmox-backup-qemu0: 1.0.3-1
libpve-access-control: 6.4-1
libpve-apiclient-perl: 3.1-3
libpve-common-perl: 6.4-3
libpve-guest-common-perl: 3.1-5
libpve-http-server-perl: 3.2-3
libpve-storage-perl: 6.4-1
libqb0: 1.0.5-1
libspice-server1: 0.14.2-4~pve6+1
lvm2: 2.03.02-pve4
lxc-pve: 4.0.6-2
lxcfs: 4.0.6-pve1
novnc-pve: 1.1.0-1
proxmox-backup-client: 1.1.9-1
proxmox-mini-journalreader: 1.1-1
proxmox-widget-toolkit: 2.5-6
pve-cluster: 6.4-1
pve-container: 3.3-5
pve-docs: 6.4-2
pve-edk2-firmware: 2.20200531-1
pve-firewall: 4.1-4
pve-firmware: 3.2-4
pve-ha-manager: 3.1-1
pve-i18n: 2.3-1
pve-qemu-kvm: 5.2.0-6
pve-xtermjs: 4.7.0-3
qemu-server: 6.4-2
smartmontools: 7.2-pve2
spiceterm: 3.1-1
vncterm: 1.6-2
zfsutils-linux: 2.0.4-pve1
 
I've tested it with centos7, too. My config works with and without NetworkManager.
Intresting NetworkManager on centos7 does not like IP6ADDR=auto, too, so this bug already exists on older CentOS/RHEL.
So, to remove it, works fine.

My patch:

Diff:
--- /usr/share/perl5/PVE/LXC/Setup/CentOS.pm    2021-04-20 14:13:37.000000000 +0200
+++ /usr/share/perl5/PVE/LXC/Setup/CentOS.pm        2021-06-15 15:38:11.731175139 +0200
@@ -10,6 +10,7 @@
 use PVE::LXC::Setup::Base;
 
 use base qw(PVE::LXC::Setup::Base);
+use UUID;
 
 sub new {
     my ($class, $conf, $rootdir) = @_;
@@ -185,7 +186,7 @@
        my $routes = '';
        my $routes6 = '';
 
-       my $header = "DEVICE=$d->{name}\nONBOOT=yes\n";
+       my $header = "DEVICE=$d->{name}\nONBOOT=yes\nUUID=".UUID::uuid()."\n";
        my $data = '';
        my $bootproto = '';
 
@@ -213,7 +214,7 @@
            if ($d->{ip6} eq 'auto') {
                $data .= "IPV6_AUTOCONF=yes\n";
            }
-           if ($d->{ip6} eq 'dhcp') {
+           elsif ($d->{ip6} eq 'dhcp') {
                $data .= "DHCPV6C=yes\n";
            } else {
                $data .= "IPV6ADDR=$d->{ip6}\n";
 
Any news on that?
There are not other workarounds (to apply inside the container) other than editing such script?
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!