bash: /etc/init.d/network: No such file or directory CentOS 8

In this article, we will see the solution for below error. We have received this error after modifying the IP and then tried to restart network service to effect the changes.

bash: /etc/init.d/network: No such file or directory

bash: /etc/init.d/network: No such file or directory

Network scripts are deprecated in CentOS 8 and they are no longer provided by default. In CentOS, 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 CentOS 8.

We can use “NetworkManager.service” as the default networking service in CentOS 8. CentOS 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.

Solution to restart network service:

systemctl restart NetworkManager.service

To enable NetworkManager at boot time:

systemctl enable NetworkManager