Debiana

How to Restart Networking in Debian Linux

How to Restart Networking in Debian Linux
On Linux, one of the basic things you do is configure the network. Once you make changes, you have to restart the networking service in order for the changes to take effect.

In this article, I will show you how to configure the network easily and restart them properly on Debian Linux. Let's get started.

Restarting Networking on Debian 8 Wheezy and Older:

On Debian Linux, the network configuration is stored in /etc/network/interfaces file. On older version of Debian, when you make changes to /etc/network/interfaces file, you can restart networking with the following command:

$ sudo /etc/init.d/networking restart

The network service should be restarted. But on Debian 9 Stretch, that no longer works due to a bug.

Installing Network Manager on Debian 9 Stretch:

You can directly configure a network interface using /etc/network/interfaces file manually if you like. But the good news is, you don't have to do that. On recent Linux distributions such as Debian 9 Stretch, networking can be managed by the Network Manager. It makes configuring a network really easy. Network Manager has command line utilities for network configuration.

If you have minimal server version of Debian 9 Stretch installed, you may not have Network Manager installed. In that case, you have to install Network Manager.

First update the package repository cache with the following command

$ sudo apt update

The package repository cache should be updated.

Now install Network Manager with the following command:

$ sudo apt install network-manager

Press y and then press to continue.

Network Manager should be installed.

Using Network Manager to Configure Networking:

Network Manager has nmtui terminal based interactive tool that you can use to configure networking on Debian 9 Stretch.

To start nmtui, run the following command:

$ sudo nmtui

You should see the following window. From here you can set hostname, edit/add network connection, and active/deactivate network connections that you created.

To create a connection, go to Edit a connection. Then press to select and then press .

Now select your connection method. I am going for Ethernet as I have a wired connection. Now press and select and then press .

Now type in a Profile name. It can be anything you want. I recommend you make it short and easy. Now type in a Device identified. I have only one physical Ethernet cable connected to my computer and is recognized as ens33, so I typed that. You can run ip link show command to find out your Device identifier.

If you want to use DHCP to get the IP address for this network interface, then that's pretty much everything you need to do. But if you want to assign a static IPv4 or IPv6 address, then you have to press to go to for IPv4 CONFIGURATION or IPv6 CONFIGURATION or both depending on your need. Then press . Then you should see something like this. Type in your IP Address, Gateway, DNS servers information, Routing and other information.

Once you're done, scroll down using the and go to and then press .

Your connection should be created and activated.

NOTE: Network Manager do not manage interfaces defined in /etc/network/interfaces file. So if the interface you're configuring with Network Manager is also configured using the /etc/network/interfaces file, then be sure to comment it out or remove it from the /etc/network/interfaces file for Network Manager to work with that interface.

Restarting a Single Connection Using Network Manager:

In the earlier section, I showed you how to create a connection using Network Manager. In this section I will show you how to restart the connection.

When you edit a connection, you must restart the connection for the changes to take effect.

You can use the nmtui utility to restart a connection using the Terminal based user interface.

Run nmtui and go to Activate a connection.

Now select your Connection from the list, in my case the Home Router, then press .

Now while is selected, press to deactivate the connection first.

Now while is selected, press to activate the connection again. Your changes should be applied.

You can do the same thing from the terminal using the nmcli command.

Deactivate the Home Router connection with the following command:

$ sudo nmcli connection down "Home Router"

To Activate the Home Router connection again, run the following command:

$ sudo nmcli connection up "Home Router"

You can also Restart the connection with a single command:

$ sudo nmcli connection reload "Home Router"

Restarting Network Manager:

If you have a lot of connection, which may take a lot of time to restart one by one, then you can just restart the Network Manager service with the following command:

$ sudo systemctl restart network-manager

The Network Manager service should restart.

That's how you Restart Networking Properly on Debian Linux. Thanks for reading this article.

Gry Najlepsze dystrybucje Linuksa do gier w 2021 r
Najlepsze dystrybucje Linuksa do gier w 2021 r
System operacyjny Linux przeszedł długą drogę od pierwotnego, prostego, serwerowego wyglądu. Ten system operacyjny znacznie się poprawił w ostatnich l...
Gry Jak przechwytywać i przesyłać strumieniowo sesję gry w systemie Linux
Jak przechwytywać i przesyłać strumieniowo sesję gry w systemie Linux
W przeszłości granie w gry było uważane tylko za hobby, ale z czasem branża gier odnotowała ogromny wzrost pod względem technologii i liczby graczy. P...
Gry Najlepsze gry do grania ze śledzeniem rąk
Najlepsze gry do grania ze śledzeniem rąk
Oculus Quest niedawno wprowadził świetny pomysł śledzenia rąk bez kontrolerów. Przy stale rosnącej liczbie gier i działań, które wspierają zarówno for...