CentOS 7 introduces many changes in the way users handle and manage general Linux services. The same happened with Red Hat Enterprise Linux 7. And the big question here is: How to restart network service on CentOS? And how can I stop and start networking on CentOS or RHEL systems?
Today we will explore CentOS 7 Restart Network procedure, as well as stop and start networking service commands.
CentOS 7 and RHEL 7, the two most popular RedHat based distros in the web hosting industry, are using the new systemd. Systemd is a service manager, a new way to restart, stop and start services.
systemd replaces upstart as the default init system, and a few old-school sysadmins, webmasters and devs are a little bit confused about this new technology, however, don’t get mad… systemd is cool and is in fact a great init replacement.
Let’s see how to stop, start and restart networking on centos and RHEL linux.
The old Init system
In older versions of RHEL and CentOS, the init script were located at /etc/rc.d/init.d/ directory. This were simple scripts written in bash language, this scripts could be easily modified by the system adminstrator, as well as managed to start, stop or restart services on demand.
On the old init system to restart network on centos you only needed to run:
service network restart
And that was all.
The new systemd model
systemd uses service units to manage the linux services, and scripts are no longer located at /etc/rc.d/init.d/ directory. And the old ‘service network restart’ is no longer valid.
CentOS 7 / RHEL 7 Restart Network.Service
In order to restart network on CentOS 7 and RHEL 7, you will need to use the systemd service called ‘network.service’ or just ‘network’ for the short version.
CentOS 7 Restart Network Service using Systemctl Command
systemctl is one of the core functions of systemd, is a command that will let you control the state of systemd and it also allow system users to manage linux services running on the server.
In order to restart network on CentOS 7, you will need to run this command:
systemctl restart network.service
systemctl restart network
CentOS 7 / RHEL 7 Stop Network Service
To stop the network service on RHEL 7 and CentOS 7, you will need to use:
sudo systemctl stop network.service
Or the alterantive and shorter version:
sudo systemctl stop network
CentOS 7 / RHEL 7 Start Network Service
systemctl start network.service
sudo systemctl start network
Chkconfig on CentOS / RHEL 7
Yes it is, it’s available only for compatibility purposes, but that means it will be deprecated on next CentOS and RHEL releases.
The chkconfig equivalent command using systemd is:
systemctl enable servicename systemctl disable servicename
As you see, restarting networking on CentOS 7 and RHEL 7, and even the new chkconfig command replacement isn’t hard to learn at all, you just need to memorize the new restart, stop and start commands using systemctl. What do you think about the new CentOS 7 Restart Network procedure?