I was reading about RHEL 8, and this statement is made:
Network scripts are deprecated in Red Hat Enterprise Linux 8 and they are no longer provided by default. The basic installation provides a new version of the ifup and ifdown scripts which call the NetworkManager service through the nmcli tool.
OK, so to me this would imply that /etc/sysconfig/network-scripts would no longer be used, though it is unclear from my reading what is supposed to replace ifcfg-eth0 (or similar).
But then I read this page about static IP addresses, which asserted:
The procedure to configure a static IP address on RHEL 8:
Create a file named/etc/sysconfig/network-scripts/ifcfg-eth0as follows:DEVICE=eth0 BOOTPROTO=none ONBOOT=yes PREFIX=24 IPADDR=192.168.2.203Restart network service on RHEL 8:
systemctl restart NetworkManagerORsudo nmcli connection reload
So, is it only the ifup and ifdown that are deprecated, but the configuration files remain? Is the distinction between scripts and configuration files, even though they seem lumped under a single chapter? Chapter 12 of the RHEL defixed network scripts as the:
Chapter 12. Network Scripts
…configuration files for network interfaces and the scripts to activate and deactivate them are located in the/etc/sysconfig/network-scripts/directory.
So, what constitutes what is deprecated? It doesn’t seem to be the scripts in /etc/sysconfig/network-scripts since that apparently is still an appropriate way to configure a static IP.
I do not yet have a RHEL 8 box running, so I am hoping someone can shed light on what it is one is supposed to avoid.
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
Note that custom commands in
/sbin/ifup-local,ifdown-pre-localandifdown-localscripts are not executed.If any of these scripts are required, the installation of the deprecated network scripts in the system is still possible with the following command:
~]# yum install network-scripts
So, anything contained in the RHEL 8 network-scripts RPM file or relying on functionality of that RPM is now deprecated. In particular, if you previously used scripts like /sbin/ifup-local to set up some advanced routing or other specialized network configuration, now it’s time to find out a new way to do that.
Note that when NetworkManager was introduced into RHEL, it included – and still does – a configuration back-end that uses the old configuration file locations, but with a new NetworkManager infrastructure and an extended version of the old configuration script syntax. So the /etc/sysconfig/network-scripts/ifcfg-* files will still be there and using the same syntax, although they will now be parsed by NetworkManager and not executed as sourced scripts.
The deprecated network-scripts package essentially contains:
- the SysVinit-style service script
/etc/init.d/network - the
ifup*,ifdown*,init.ipv6-globalandnetwork-functions*scripts you’ve used to seeing in the/etc/sysconfig/network-scripts/directory - classic versions of
/usr/sbin/ifupand/usr/sbin/ifdown(which would override the compatibility wrappers fornmclithat are present by default) - the
/usr/sbin/usernetctlcommand - and the associated documentation and example files
So, when you’re not using the deprecated network-scripts RPM, you would now expect the /etc/sysconfig/network-scripts/ directory to only contain the ifcfg-* files for your network interfaces, and possibly route-* files for custom routes, but no other files at all. If you needed the usernetctl command, it’s among the deprecated functionality and you should start using the appropriate nmcli subcommands as its replacement.
ifup and ifdown will still be available, but now do their job through NetworkManager, unless you install the deprecated network-scripts RPM.
Method 2
We in our environment have seen some instability when we use NetworkManager to configure the network using kickstart while performing a PXE install of RHEL 7, which is why we had to manually configure the network interfaces; and we also decided to disable NetworkManager in our configuration, but now with this news we are moving towards NetworkManager.
As of now RHEL still supports the usage of legacy behaviour using network-scripts rpm instead of initscripts.
https://access.redhat.com/solutions/3777201
The article below covers this topic in more detail in case you still wish to use NM_CONTROLLED=no in your configuration file and disable NM.
https://www.golinuxcloud.com/unit-network-service-not-found-rhel-8-linux/
But looks like the smart choice would be to slowly adapt NetworkManager and follow up with Red Hat support for any issues with NM as we don’t know when Red Hat will start completely forcing NM on the users.
Method 3
RHEL 8 still supports network-scripts, and it’s available by default in the minimal config.
Check the Configuring and managing networking chapter in the RHEL documentation.
Also see these tutorials: How to configure a static IP address on RHEL 8 and How to configure a static IP address on RHEL 8 and Centos 8.
Method 4
There remains very valid reasons to keep supporting the deprecated network scripts (RHEL8 doesn’t support aliasing anycast IPs on loopback interface for example), but there are things beyond our control.
Here is a way forward for most scenarios:
- Configure NetworkManager to read “keyfiles”
- Create/Edit NetworkManagers version of network-scripts in keyfile format
- Ensure NM keyfiles are owned by root with permissions of 600
- Reboot or
nmcli con reload(systemctl restart NetworkManagerworks, but is said not to be guaranteed).
-
Configure NetworkManager to read “keyfiles”
/etc/NetworkManager/NetworkManager.conf
or read in asciibetical order
/etc/NetworkManager/conf.d/50-whatevername.conf
Under the “main” section set/add “keyfile” to plugins:
[main] plugins=keyfile
Note that if you are remotely administering and your connection is based on the older network scripts than you may want to ensure both plugins are loaded:
[main] plugins=keyfile,ifcfg-rh -
Create/Edit NetworkManager keyfiles (name of file doesn’t seem to matter):
Now in
/etc/NetworkManager/system-connectionsyou can edit NetworkManager network-scripts files in the new (but old MS Windows-like) “keyfile” format.Get the actual MAC address of the interface and either omit the uuid (it will be autogenerated) or generate it yourself using the cli tool
uuidgen.Example keyfile:
# Translate REF - https://people.freedesktop.org/~lkundrak/nm-docs/nm-settings-ifcfg-rh.html [connection] type=ethernet uuid=969fc159-a48f-4930-8de1-e3e5b952769 interface-name=ens34 id=ens34 autoconnect=true [ethernet] #cloned-mac-address=da:d0:ed:00:06:86 mac-address=00:50:00:00:00:02 [dummy] #cloned-mac-address=da:d0:ed:00:06:86 #mac-address=da:d0:ed:00:06:86 [ipv4] method=manual address=10.1.1.2/20 gateway=10.1.0.1/20 #never-default=true #dns=8.8.8.8;8.8.4.4 #[ipv6] #method=manual #address=2001:db8::2/64 #gateway=2001:db8::1 [proxy] -
Ensure NM keyfiles are owned by root with permissions of 600
chown root.root ${nm-whatever.conf} && chmod 600 ${nm-whatever.conf} -
Just reboot.
systemctl restart NetworkManageroften works, but they state it is not meant to be restarted, but instead use thenmclitool like so:nmcli con reload
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0