centos8.3 - static ip with ifcfg and nm_controlled=no

Issues related to configuring your network
Post Reply
mithr
Posts: 5
Joined: 2021/05/31 10:39:26

centos8.3 - static ip with ifcfg and nm_controlled=no

Post by mithr » 2021/05/31 11:01:23

hello all

this is a question regarding minimal install from CentOS-8.3.2011-x86_64-dvd1.iso.

i am trying to set a static ip by modifying the ifcfg but i am failing.
When i do not use nm_controlled=no, the static ip is assigned fine but when i use nm_controlled=no i am missing something.
The interface remains down and still when i use ip link set dev ens33 up and the int goes up the IP is not assigned.
Can you please give me some clue what else do i need to modify to make it work? I mean what else does the networkmanager modifies when i do not use NM_CONTROLLED=no


[root@localhost network-scripts]# cat ifcfg-ens33
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
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=ens33
UUID=2752ae2b-5579-475e-8aa2-c1793b387a0b
DEVICE=ens33
ONBOOT=yes
IPADDR=192.168.65.10
PREFIX=24
GATEWAY=192.168.65.2
DNS1=192.168.65.2
NM_CONTROLLED=no

tunk
Posts: 1204
Joined: 2017/02/22 15:08:17

Re: centos8.3 - static ip with ifcfg and nm_controlled=no

Post by tunk » 2021/05/31 17:42:39

I think NetworkManager is enabled by default, you could try to disable it:
https://www.thegeekdiary.com/how-to-dis ... os-rhel-8/

User avatar
jlehtone
Posts: 4523
Joined: 2007/12/11 08:17:33
Location: Finland

Re: centos8.3 - static ip with ifcfg and nm_controlled=no

Post by jlehtone » 2021/05/31 19:42:13

mithr wrote:
2021/05/31 11:01:23
this is a question regarding minimal install
Minimal install installs packages that are in Minimal Install yum environment group. That group includes yum group Core:

Code: Select all

# dnf group info minimal-environment
Last metadata expiration check: 1:56:18 ago on Mon 31 May 2021 08:40:27 PM EEST.
Environment Group: Minimal Install
 Description: Basic functionality.
 Mandatory Groups:
   Core
 Optional Groups:
   Guest Agents
   Standard
The Core includes NetworkManager:

Code: Select all

Group: Core
 Description: Smallest possible installation
 Mandatory Packages:
   NetworkManager
   ...
Given that NetworkManager is installed (and enabled) by default, why do you try to bypass it?
You could as well set the static IP with NetworkManager
(although I prefer to configure DHCP server to hand out persistent addresses).

mithr
Posts: 5
Joined: 2021/05/31 10:39:26

Re: centos8.3 - static ip with ifcfg and nm_controlled=no

Post by mithr » 2021/05/31 22:49:23

Given that NetworkManager is installed (and enabled) by default, why do you try to bypass it?
there was no specific reason. i was trying to follow some guides and learn

in order to apply those changes to ifcfg i do reboot all the time as the systemctl restart network is not working.
so with networkmanager not controlling the config(nm_controlled=no) how can i put in effect the static configuration? i thought it's something easy to do, if not it's ok i can do it with networkmanager as you said.

User avatar
jlehtone
Posts: 4523
Joined: 2007/12/11 08:17:33
Location: Finland

Re: centos8.3 - static ip with ifcfg and nm_controlled=no

Post by jlehtone » 2021/06/01 06:20:12

There are many "guides". Alas, some are outdated and thus no longer apply.
Even worse, some were never correct; they contain errors or are based on bad assumptions.
Trouble is, even trained eye can fail to spot misinformation.

The network.service has to be explicitly installed:
https://www.golinuxcloud.com/unit-netwo ... l-8-linux/
What do you get with these:

Code: Select all

readlink -f $(which ifup)
systemctl status network
NetworkManager in RHEL 6 was pathetic. No match for initscripts.
By RHEL 7.3 NM's feature coverage got decent.
NM in RHEL 8 is still missing support for some special features, but frankly I don't know how network.service could do those either.

mithr
Posts: 5
Joined: 2021/05/31 10:39:26

Re: centos8.3 - static ip with ifcfg and nm_controlled=no

Post by mithr » 2021/06/06 18:29:04

thank you for helping me jlehtone.
i got busy with work recently so now i found again time to check what you wrote me

[root@localhost ~]# readlink -f $(which ifup)
/usr/libexec/nm-ifup
[root@localhost ~]# systemctl status network
Unit network.service could not be found.

User avatar
jlehtone
Posts: 4523
Joined: 2007/12/11 08:17:33
Location: Finland

Re: centos8.3 - static ip with ifcfg and nm_controlled=no

Post by jlehtone » 2021/06/07 07:53:48

Ok, you have only NetworkManager.service.
You do not have network.service installed.
Your ifup is not the old ifup of initscripts, but a wrapper to NetworkManager.

With NM_CONTROLLED=no you say to NetworkManager: "Do not touch this!"
However, NetworkManager is the only network configuration tool that you have.

You have two choices:
  1. Use NetworkManager. Clean out the bogus configs.
  2. Install the deprecated network.service. See link in tunk's post.

mithr
Posts: 5
Joined: 2021/05/31 10:39:26

Re: centos8.3 - static ip with ifcfg and nm_controlled=no

Post by mithr » 2021/06/08 21:18:20

so to manage networking basically you have the Network Manager, the deprecated network service ( Is it the network scripts that i am reading about on guides?) or the manual editing of ifcfg file?
With NM_CONTROLLED=no you say to NetworkManager: "Do not touch this!"
yeah i got this from reading the guides pretty clearly.
However, NetworkManager is the only network configuration tool that you have.
that is what i was missing as i thought that those scripts are somewhere around so if i put nm_controlled=no somehow i could make it work

User avatar
jlehtone
Posts: 4523
Joined: 2007/12/11 08:17:33
Location: Finland

Re: centos8.3 - static ip with ifcfg and nm_controlled=no

Post by jlehtone » 2021/06/08 21:27:15

mithr wrote:
2021/06/08 21:18:20
so to manage networking basically you have the Network Manager, the deprecated network service ( Is it the network scripts that i am reading about on guides?) or the manual editing of ifcfg file?
Manual edit of a file is useless, if nothing uses that file.

Configuration is stored in files. During boot a service starts, reads the files, and activates connections.

Option 1:
Have NetworkManager installed and NetworkManager.service enabled. This is the default. Use nmcli, nmtui, or GUI applet to configure connections.

Option 2:
Have network-scripts installed and network.service enabled. Manually edit ifcfg-files.

mithr
Posts: 5
Joined: 2021/05/31 10:39:26

Re: centos8.3 - static ip with ifcfg and nm_controlled=no

Post by mithr » 2021/06/08 22:34:54

Manual edit of a file is useless, if nothing uses that file.
ok i see what you mean now.
i checked again the tunk's link and i see that it replies my question about network scripts and network service as you also explained as well.

I think i will stick then with network manager as i saw the nmcli, nmtui and gui that you explained to me

Post Reply