In Ubuntu Debian, a special networking service is responsible for initializing network interfaces and configuring the network. You can familiarize yourself with the network configuration and network settings by looking at the /etc/network/interfaces
file. If you open the file, make changes and save them, you will need to restart the network for them to take effect. Next, let's see how to do this using Ubuntu 16.04 as an example.
Yes, you can simply restart your computer, but in some cases this is not entirely convenient. Sometimes it's easier to perform a network restart, because it's easier and more comfortable, and most importantly, it's also faster. To do this, you only need to execute one command:
$ sudo service networking restart
Current distributions have long used the Systemd initialization system, so you can use the systemctl command instead of the service command:
$ sudo systemctl restart networking.service
You can also restart NetworkManager, which is especially useful if the network is configured through it.
$ sudo systemctl restart NetworkManager
There is nothing complicated about this operation. Just run a couple of commands and the network will be rebooted.
The Network Manager program is used for network management in modern distributions. It is easy to disable it and then immediately enable it (actually perform the restart process) with the following two commands:
$ sudo nmcli networking off
$ sudo nmcli networking on
If done correctly, you will notice that the NetworkManager icon has disappeared from the panel, but it should reappear seconds later.
These commands are responsible for the network interfaces and are at a lower level. To perform a restart, we can first disable and then enable all interfaces. This is done like this:
$ sudo ifdown –a
$ sudo ifup -a
There will be no change in the GUI, but once the disabling of the network interface happens, the connection to the internet will be lost.
This way, you don't have to reboot your computer every time to restart the network. Use the simple commands and tools that the Ubuntu system offers.