Need help?

Our experts have had an average response time of 11.7 minutes in August 2021 to fix urgent issues.

We will keep your servers stable, secure, and fast at all times for one fixed price.

Failed to restart network.service – How to fix

by | Mar 9, 2021

Wondering how to fix ‘Failed to restart network.service’? We can help you.

Network scripts are deprecated in Red Hat Enterprise Linux 8 and 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 we try to use legacy network.service unit file it will not be available and may end up showing the following error.

[[email protected] ~]# systemctl restart network
Failed to restart network.service: Unit network.service not found.

Here at Bobcares, we fix similar issues as a part of our Server Management Services. Today, let’s see how our Support Techs fix this for our customers.

How to fix ‘Failed to restart network.service’ on RHEL 7 and RHEL 8

Red Hat Enterprise Linux 8 uses the default networking service, NetworkManager. As it is a dynamic network control and configuration daemon to keep network devices and connections up and active when they are available.

Before going into the steps for fixing this issue we will see some basic commands.

Starting Network Service with NetworkManager

To start NetworkManager:

# systemctl start NetworkManager

To enable NetworkManager automatically at boot time:

# systemctl enable NetworkManager

Start Network Service without NetworkManager

If we use NM_CONTROLLED=no in ifcfg file, then we 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.

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

On the RHEL system, we must have an active subscription to RHN. However, wecan configure a local offline repository using which “yum” package manager and install the provided rpm and its dependencies.

We can use the following commands to install deprecated network-scripts:

# yum install network-scripts

Let us see the content of network-scripts rpm.

[[email protected] ~]# 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.

[[email protected] ~]# 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)

After that we can use systemctl to restart the network service.

[[email protected] ~]# systemctl restart network
[[email protected] ~]# systemctl is-active network
active

How to fix “Failed to restart network.service: Unit network.service not found” in RHEL 7

This error can be seen in RHEL 7 based systems due to any network configuration or network interface issues.

Following are the steps to fix “Failed to restart network.service: Unit network.service not found” in RHEL 7

First, we need to check the network interface status.

For example, suppose the network interface is eth1. So we need to run ifconfig eth1 command to check the status of interface eth1.

[[email protected] ~]# ifconfig eth1
eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.150 netmask 255.255.255.0 broadcast 192.168.0.255
inet6 fe80::a00:27ff:fe1d:8e54 prefixlen 64 scopeid 0x20<link>
ether 08:00:27:1d:8e:54 txqueuelen 1000 (Ethernet)
RX packets 105385 bytes 129825301 (123.8 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 28452 bytes 4965590 (4.7 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

Now, we can bring down the interface using ifdown eth1 and bring up again using ifup eth1 command.

[[email protected] ~]# ifdown eth1
[[email protected] ~]# ifup eth1

Next, we can restart the network and check if the network is active or not.

[[email protected] ~]# systemctl restart network
[[email protected] ~]# systemctl is-active network
active

Now if we check the network status, we can see that network service is up and running.

[[email protected] ~]# systemctl status network
● network.service - LSB: Bring up/down networking
Loaded: loaded (/etc/rc.d/init.d/network; generated)
Active: active (exited) since Mon 2021-03-08 07:01:58 EDT; 23min ago
Docs: man:systemd-sysv-generator(8)
Process: 1068 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=0/SUCCESS)

Mar 7 19:43:30 localhost.localdomain systemd[1]: Starting LSB: Bring up/down networking...
Mar 7 19:43:30 localhost.localdomain network[1068]: WARN : [network] You are using 'network' service provided by 'network-scripts', which are now deprecated.
Mar 7 19:43:30 localhost.localdomain network[1089]: You are using 'network' service provided by 'network-scripts', which are now deprecated.
Mar 7 19:43:30 localhost.localdomain network[1068]: WARN : [network] 'network-scripts' will be removed in one of the next major releases of RHEL.
Mar 7 19:43:30 localhost.localdomain network[1090]: 'network-scripts' will be removed in one of the next major releases of RHEL.
Mar 7 19:43:30 localhost.localdomain network[1068]: WARN : [network] It is advised to switch to 'NetworkManager' instead for network management.
Mar 7 19:43:30 localhost.localdomain network[1091]: It is advised to switch to 'NetworkManager' instead for network management.
Mar 7 19:43:30 localhost.localdomain network[1068]: Bringing up loopback interface: [ OK ]
Mar 7 19:43:30 localhost.localdomain network[1068]: Bringing up interface eth1: [ OK ]
Mar 7 19:43:30 localhost.localdomain systemd[1]: Started LSB: Bring up/down networking.

 [Still, stuck with the error? – We can help you]

Conclusion

To conclude we saw how our Support Techs fix ‘Failed to restart network.service’ on both RHEL 7 and RHEL 8

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF