Pretty sure the default behavior prior to 7.9.2009 was if the single active network interface was configured with DHCP under NetworkManger’s control; system-init kept a DHCP configuration for this interface.
Installing nethserver on top of an updateted CentOS 7.9.2009 minimal installation (proxmox VM) results in a FIXED IP setup.
Did see this behavior on the ARM images too, where it is mitigated by stopping / disabling NetworkManager at the end of system-init.
Can confirm this hack works on x86_64 too (edited nethserver-install for this), this results in a DHCP configuration.
Before filing a issue I wonder if my assumption a DHCP configuration should survive system-init is correct?
Another non critical (slightly related) observation seen on ARM before:
.... systemd[1]: Network Manager is not active.
.... systemd[1]: Dependency failed for Network Manager Wait Online.
.... systemd[1]: Job NetworkManager-wait-online.service/start failed with result 'dependency'.
NetworkManager-wait-online.service is not disabled by nethserver-install
I know, tried hard to find the origin. My only clue here is NetworkManager / network.service changed behavior. EDIT:
Unfortunately my Perl knowledge is to limited to fully grasp the line I suspect not handling the alleged changed behavior of stopping Networkmanager. (my lack of knowledge: where does $ifname get it’s value?)
To be frank I do not have a problem with it because here it does end up with a correct fixed IP configuration.
Have read one report it did not work well on a RPI install, it ended up with a fixed fall-back configuration. And the referenced install on a (Hetzner) vps.
And again, pretty sure it alway’s ended up with DHCP config in the past.
EDIT2:Very old closed issue addressing this in the past:
the value of $ifname come from as an argument of the function fetch_ifcfg_props
sub fetch_ifcfg_props
{
my $ifname = shift;
my %props = ();
# Note: command returns empty output if interface is DOWN:
open(ADDR, '-|', "ip -o -4 address show dev $ifname");
See output of (this is the real output it did not truncate, linefeed at \)
# systemctl status NetworkManager
● NetworkManager.service - Network Manager
Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2021-02-08 09:43:44 EST; 30s ago
Docs: man:NetworkManager(8)
Main PID: 11224 (NetworkManager)
CGroup: /system.slice/NetworkManager.service
├─11224 /usr/sbin/NetworkManager --no-daemon
└─11241 /sbin/dhclient -d -q -sf /usr/libexec/nm-dhcp-helper -pf /var/run/dhclient-eth0.pid -lf /var/lib/NetworkManager/dhclient-7fd770b9-4431-43f8-b1f1-01d13608a404-eth0.lease...
<OUTPUT TRUNCATED>
# ip -o -4 address show dev eth0
2: eth0 inet 10.0.0.158/24 brd 10.0.0.255 scope global noprefixroute dynamic eth0\ valid_lft 86362sec preferred_lft 86362sec
# ps -A -o cmd | grep -E '(/| )dhclient .' | grep -q eth0
# echo $?
0
# systemctl stop NetworkManager
# ip -o -4 address show dev eth0
2: eth0 inet 10.0.0.158/24 brd 10.0.0.255 scope global noprefixroute dynamic eth0\ valid_lft 86334sec preferred_lft 86334sec
# ps -A -o cmd | grep -E '(/| )dhclient .' | grep -q eth0
# echo $?
1
With NM running ps -A -o cmd | grep -E '(/| )dhclient .' | grep -q eth0
exit’s 0, which can explain why the hack stop NM at the end of system-init works
Also note the place of dynamic in the first command,
If I count the output arguments it in in the 10th position. here :
(again not knowledgeable with PERL.)
It seems to me dynamic is expected on the 9th position. If this is true this test results in False if NM is not running : $dhclient_running || $dynamic =~ 'dynamic'
It is being added by NM version 1.10 or later (it came with RHEL 7.5).
I think it’s safe to update nethserver-base-initialize-db to get dynamic from 10th position, but I’d ask @giacomo. We could also find a better way to discover if an IP came from dhcp (playing with NM).
before running nethserver-install on your CentOS test-setup edit /etc/yum.repos.d/NethServer.repo
enable nethserver-testing (enabled=1) only for nethserver-base (includepkgs=nethserver-base*):