One of the most common activities on a Linux system is, usually, modify some networking parameters to adapt the system to the actual network; so how can we restart networking service using command line options without restarting the whole system? How can I start / stop and restart networking service on a CentOS/RHEL 7 based system?
CentOS 7 / RHEL 7 / Fedora Linux (many other modern distor) uses Systemd. It is a system and service manager for Linux operating systems. In newer distro such as CentOS7/RHEL7 systemd replaces upstart as the default init system.
In older versions of CentOS or Red Hat Enterprise Linux, you used init scripts located in the /etc/rc.d/init.d/ directory.
These init scripts were typically written in Bash, and allowed the system administrator to control the state of services and daemons in their system. In CentOS/RHEL 7, these init scripts have been replaced with service units.
CentOS 7 / RHEL 7 networking service name
To bring up/down networking service you need to use the network.service.
Use the following command to control the systemd system and act as a service manager.
For CentOS 7 / RHEL 7 to get the status of network service:
sudo systemctl status network.service
OR
sudo systemctl status network
CentOS 7 / RHEL 7 restart network service
sudo systemctl restart network.service
OR
sudo systemctl restart network
CentOS 7 / RHEL 7 start network service
sudo systemctl start network.service
OR
sudo systemctl start network
CentOS 7 / RHEL 7 stop network service
sudo systemctl stop network.service
OR
sudo systemctl stop network
Note that service and chkconfig commands are still available in the system and work as expected, but are only included for compatibility reasons and should be avoided as may be dropped in future release.