Solved: Failed to restart network.service: Unit network.service not found in RHEL 8

Network scripts are deprecated in Red Hat Enterprise Linux 8 and they are no longer provided by default. In Red Hat Enterprise Linux 8, to run the ifup and the ifdown scripts, NetworkManager must be running. By default if you try to use legacy network.service unit file is not available with RHEL 8.

[root@rhel-8 ~]# systemctl restart network
Failed to restart network.service: Unit network.service not found.

You can use "NetworkManager.service" as the default networking service in RHEL 8. Red Hat Enterprise Linux 8 uses the default networking service, NetworkManager, which is a dynamic network control and configuration daemon to keep network devices and connections up and active when they are available.

 

Starting Network Service with NetworkManager

To start NetworkManager:

[root@rhel-8 ~]# systemctl start NetworkManager

To enable NetworkManager automatically at boot time:

[root@rhel-8 ~]# systemctl enable NetworkManager

 

Start Network Service without NetworkManager

If you use NM_CONTROLLED=no in ifcfg file then you will be unable to bring up interfaces with 'ifup' command.

The basic installation of RHEL 8 provides a new version of the ifup and ifdown scripts which call the NetworkManager service through the nmcli tool.

NOTE:

The custom commands in /sbin/ifup-local, ifdown-pre-local and ifdown-local scripts are not executed.

 

How to fix "Failed to restart network.service: Unit network.service not found" in RHEL 8

If any of these scripts are required, the installation of the deprecated network scripts in the system is still possible with the following command:

NOTE:

On RHEL system you must have an active subscription to RHN or you can configure a local offline repository using which "yum" package manager can install the provided rpm and it's dependencies.
[root@rhel-8 ~]# yum install network-scripts

In RHEL 7 /etc/rc.d/init.d/network was owned by initscripts but with RHEL 8 this tool is part of network-scripts rpm

Next you can check the content of network-scripts rpm

[root@rhel-8 ~]# rpm -ql network-scripts-10.00.1-1.el8.x86_64 | grep "/etc/rc.d/init.d/network"
/etc/rc.d/init.d/network

The ifup and ifdown scripts link will be installed with legacy network scripts.

Calling the legacy network scripts shows a warning about their deprecation.

[root@rhel-8 ~]# ifup eth0
WARN      : [ifup] You are using 'ifup' script provided by 'network-scripts', which are now deprecated.
WARN      : [ifup] 'network-scripts' will be removed in one of the next major releases of RHEL.
WARN      : [ifup] It is advised to switch to 'NetworkManager' instead - it provides 'ifup/ifdown' scripts as well.
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/6)

Now you can use systemctl to restart the network service

[root@rhel-8 ~]# systemctl restart network

[root@rhel-8 ~]# systemctl is-active network
active

 
Lastly I hope the steps from the article to fix "Failed to restart network.service: Unit network.service not found" in RHEL 8 Linux was helpful. So, let me know your suggestions and feedback using the comment section.

 

9 thoughts on “Solved: Failed to restart network.service: Unit network.service not found in RHEL 8”

  1. the default workstation install sets ONBOOT to no, there's ur problem! so look at your /etc/sysconfig/network-scripts/ifcfg-ens33 or w/e name it used and change ONBOOT to yes then reboot.

    Reply
    • This will only happen if you do not activate the NIC card during installation stage. One cannot definitely reboot the system every time he/she has to restart the network 🙂

      Reply
  2. I know this might be old but I resolved the issue by setting:
    dhcp=dhclient
    in the /etc/NetworkManager/NetworkManager.conf file
    Once done, restart the Network Manager:
    systemctl restart NetworkManager

    Reply
  3. It is crucial to be clear on the solution one provides where every step towards resolution matters.. I referred to your solution and it helped me resolve the issue which I think would have taken hours otherwise. Thank you!

    Reply

Leave a Comment

Please use shortcodes <pre class=comments>your code</pre> for syntax highlighting when adding code.