How to Restart Network Services in CentOS/RHEL?

In CentOS, the “Network Services” refer to the network-related processes and daemons that run on the system to provide network connectivity and communication. These services include protocols like “TCP/IP”, “DHCP”, “DNS”, and others that are essential for connecting to the internet and other networks. 

This article will explain the various methods to restart the network services in CentOS/RHEL. 

Method 1: Using the systemctl Command

It is the recommended method for systems running on CentOS 7 and later versions. To restart the network service, the “systemctl” command is utilized with the “restart” option below: 

# systemctl restart network

The output takes some seconds to restart the services on the operating system.

Method 2: Using the service Command

This method can be used for systems running CentOS 6 and earlier versions (it also works on later versions). To restart the network service, utilize the “service” command in the following command:

# service network restart

The outcome of the above executions shows that the network services have been restarted.

Method 3: Using the nmcli command

This “nmcli” command is utilized to restart the network service by specifying the connection name. For instance, the network state of the “ens33” interface is set to down first and then up: 

# nmcli con down ens33 && nmcli con up ens33

The output shows that first “ens33” is deactivated and then activated in the system.

Method 4: Using the nmtui Command (TUI-based)

This is a TUI-based method (Terminal User Interface) that can be utilized to restart the network service in CentOS. You can open the Network Manager TUI by running the below command: 

# nmtui

Once you are in the Network Manager TUI, navigate to “Activate a connection” and hit “Enter”: 

Select the active connection name as “ens33”, then press “Enter” to deactivate first. Then, again press “Enter” to activate the network services:

In this way, the network services will be restarted in the system.

Conclusion

CentOS offers the “systemctl”, “service”, “nmcli”, and “nmtui” commands to restart the network services. These commands can also be utilized to manage the network interfaces, assign IP addresses, resolve hostnames, route network traffic, and many more. This article has explained all possible methods to restart the network services in CentOS/RHEL.