首页 > 代码库 > Linux_Networking_restart network on Ubuntu

Linux_Networking_restart network on Ubuntu

The following commands will assist you with network restart procedure on Ubuntu 16.04 Xenial Xerus Linux. We will start with the most recommended commands and move down to more obscure or obsolete commands in case the above commands will fail from some reason. Let‘s begin with system and service manager by using systemctl command to restart network service:

$ sudo  systemctl restart NetworkManager.service

Next command service will restart a relevant networking System V init script:

$ sudo service network-manager restart

The following command nmcli is a command-line tool for controlling NetworkManager which will restart the Network Manager directly:

$ sudo nmcli networking off
$ sudo nmcli networking on

The old fashion way using System V init scripts directly is still available on Ubuntu 16.04 Xenial Xerus Linux:

$ sudo /etc/init.d/networking restart
OR
$ sudo /etc/init.d/network-manager restart

In the last example we will restart the netowrk interface directly using ifup and ifdown commands. Note the -a option instructs ifup and ifdown commands to restart all available network interfaces marked "auto":

$ sudo ifdown -a
$ sudo ifup -a

Linux_Networking_restart network on Ubuntu