Как перезапустить сетевой linux

How to Restart the Network on Ubuntu 22.04

In Linux distribution, the network manager is responsible for managing the network on your system. The latest release of Ubuntu 22.04 provides the facility to change or restart the network status with the help of the Command Line Interface or Graphical User Interface. Restarting the network helps in setting the connection and resolving network connection issues.

In this write-up, we will provide you with a deep insight into the methods to restart the network on Ubuntu 22.04. The outcomes are as follows:

Let’s dig into the CLI method first:

Method 1: Restarting the Network on Ubuntu 22.04 Using CLI

The CLI of Ubuntu 22.04 offers various commands to manage the network. This section enlists various commands that can be used to restart the network on Ubuntu 22.04.

Method 1.1: Using nmcli Command

The nmcli utility is used to control the network’s connections. Using the nmcli utility, users restart the network on Ubuntu 22.04. For this purpose, follow the given steps one by one.

Step 1: Check device status

First, check the network status, whether it is connected or not. For this purpose, run the following command:

The output shows that the network is connected.

Step 2: Turn off the Network

To turn off the network, run the following command:

$ sudo nmcli networking off

The successful execution of the command shows that the network is disabled now.

Step 3: Switch on the Network

Now, to reconnect the network, utilize the below script:

After this connection, the network’s active state will be restored.

Method 1.2: Using the Network Manager Service

The network manager service manages the network and connectivity settings on your device.

First, to check the network status on your device, use the below script:

$ systemctl status NetworkManager.service

The output showed that the network is in an active state.

To restart the network on Ubuntu 22.04, execute the below script in the terminal:

$ sudo systemctl restart NetworkManager.service

Upon successful execution, the network will take a quick restart.

Method 2: Restarting Network on Ubuntu 22.04 Using GUI

The Graphical-User-Interface is the utility that provides an easy and user-friendly interface to the user. You can graphically interact with Ubuntu 22.04 to restart the network using the following steps.

Читайте также:  Linux echo all env

Step 1: Open the Network Menu

First, open the network menu and check the network status:

The wire is connected, and the network icon shows that the network is in an active state.

Step 2: Turn off Network

To turn off the network, click on “Wired Connected” and then click on the “Turn off” option:

It will disconnect the network of your device.

Step 3: Turn on Network

After turning off the network, choose the“Connect” button to turn on the network again:

It will connect to the network of your device.

Step 4: Check Network Status

Furthermore, the network restarts the process, and the user can check the network status of their device:

The output shows that the device is connected to the network.

Congratulations! You have learned the process for restarting the network on Ubuntu 22.04.

Conclusion

A user can restart the network on Ubuntu 22.04 with the help of the Command Line Interface or Graphical User Interface. Restarting the network refreshes the network connection quickly and resolves the errors, if any. This short blog illustrated the knowledge to restart the network on Ubuntu 22.04 using CLI and GUI. The CLI uses the nmcli utility and NetworkManager service while the GUI restarts the network graphically on Ubuntu 22.04.

TUTORIALS ON LINUX, PROGRAMMING & TECHNOLOGY

Источник

How to Restart Network on Ubuntu 20.04

There are various situations where you may have to restart the network on Ubuntu. It may be because the network settings were changed. It may be because the network connection is acting weird. Generally, whenever there’s a problem with the system, a common treatment is performing a reboot. However, if it’s a problem related to the network, then it’s possible to just restart the network.In this guide, check out how to restart the network on Ubuntu 20.04. There are various methods you can follow to restart the network on Ubuntu. It can be performed directly from the GUI or through the terminal. Depending on your preference, follow the one that suits you.

Restart network from GUI

In this section, I’ll be assuming that you’re using Ubuntu 20.04 with the default GNOME desktop.

Restart network from the desktop

Click on the top-right network icon on the screen.

Select the network connection and press “Turn Off”. It will disable the network connection.

To enable it again, go through the same process. This time, there’ll be a different option “Connect”. Click “Connect” to re-establish the network connection.

Restart network from GNOME Settings

You can also do this directly from the GNOME “Settings”.

From the left panel, select “Network”.

Disable and enable the connected network(s).

Restart network from CLI

When working with the CLI, there are multiple ways of taking action. We can take action on the network manager service or use other tools like nmcli, ifup, nmtui, etc.

Restart network manager service

This is one of the easiest ways of restarting the network service. It’s equivalent to the graphical method demonstrated above.

Fire up a terminal and run the following command.

Restart network service using systemd

Systemd offers an array of system components to the system. Part of it is handling the services. The previous method is only an alternative one of this method. Systemd is directly told to restart the service rather than going through any hoops.

Читайте также:  Linux network connected devices

Restart network using nmcli

The nmcli tool is a powerful tool for managing the network connection on Linux machines. It’s a popular one among system admins because of its ease of use.

First, turn off the network connection.

Restart network using ifup and ifdown

The ifup and ifdown commands handle a network interface directly. It’s one of the most basic networking commands on Linux. The ifdown command turns off all network interfaces and the ifup command turns them on.

The ifup and ifdown commands come with the ifupdown package. By default, it doesn’t come with Ubuntu. Thankfully, it’s directly available from the official Ubuntu repo. Install them right away.

Once the installation is complete, perform the network restart.

It’s a good practice to combine both commands in a single line.

Restart network using nmtui

The nmtui tool is yet another network management tool that’s widely popular among system admins. Unlike the other CLI tools, it offers an interactive way of managing network connections that’s similar to the GUI method.

In the case of Ubuntu 20.04, it comes by default. Launch the tool.

To navigate the tool, use the arrow keys. Select “Activate a connection”.

You’ll land on a screen with a list with all the network connections. Select the appropriate one and select “Deactivate”.

Once deactivated, activate the connection.

The network has been successfully restarted. Quit the application.

Restart network using IP command

The ip command is a powerful way of managing the network connections on Linux. It can be used for restarting the network connection. This method is applicable to any Linux distro.

To work with the ip command, first, we need to know the target network interface. Use the following command for the network interface.

In my case, the target network interface is enp0s3. Let’s restart the network.

Final thoughts

Restarting the network is a common solution to various network-related problems. If it didn’t yet solve the issue, then the next recommended action is restarting the system. If the problem persists, then it’s worth investigating further.

Interested in learning more about network configuration? Check out this guide on Ubuntu 20.04 network configuration.

About the author

Sidratul Muntaha

Student of CSE. I love Linux and playing with tech and gadgets. I use both Ubuntu and Linux Mint.

Источник

Перезапуск сети в Ubuntu

В Ubuntu и Debian инициализацией сетевых интерфейсов и настройкой сети занимается специальная сетевая служба — networking. Информация о конфигурации сетевых интерфейсов хранится в файле /etc/network/interfaces.

Если вы что-либо измените в этом файле, нужно будет перезапустить сеть, чтобы применить изменения. В этой статье мы рассмотрим как выполнить перезапуск сети Ubuntu 16.04.

Перезагрузка сети в Ubuntu

Можно, конечно, выполнить полную перезагрузку компьютера, но это не совсем удобно если можно просто перезапустить сеть Ubuntu. Для перезапуска сети используйте следующую команду:

sudo service networking restart

В современных дистрибутивах уже давным давно используется система инициализации Systemd, поэтому можно использовать команду systemctl вместо команды service:

Читайте также:  Delete all but one file linux

sudo systemctl restart networking.service

Кроме того, можно перезапустить NetworkManager, это тоже помогает, если сеть настроена через него:

sudo systemctl restart NetworkManager

Перезапуск сети в NetworkManager

Чаще всего, для управления сетью в современных дистрибутивах используется программа Network Manager. Можно сразу же использовать ещё для наших целей. Просто отключите, а затем включите сеть обратно следующими командами:

sudo nmcli networking off

После отключения сети значок NetworkManager пропадёт с панели, а потом снова появится после включения. Аналогично, вы можете использовать NetworkManager в графическом интерфейсе. Кликните по его иконке, выберите нужное сетевое подключение и нажмите Выключить:

Затем включите его обратно.

Команды ifup и ifdown

Эти команды работают на более низком уровне, они управляют непосредственно самими сетевым интерфейсами. Для перезапуска сети мы можем отключить все интерфейсы, а затем включить обратно:

Вы не увидите никаких изменений в графическом интерфейсе, но когда сетевой интерфейс будет отключён, вы не будете иметь доступа к интернету.

Выводы

Как видите, не всегда обязательно перезагружать компьютер после изменений настроек, в большинстве случаев достаточно перезапустить только нужный сервис. Надеюсь, эта информация была вам полезной.

Обнаружили ошибку в тексте? Сообщите мне об этом. Выделите текст с ошибкой и нажмите Ctrl+Enter.

Источник

How to restart network interfaces on Linux

restart network interface

O nce you make changes in the network interface, they affect the network services manager of your system. To enable the system or machine to connect to the network, one needs to restart the network interface to apply the changes without rebooting your server.

This article will guide you on restarting the network interface in various Linux distributions.

Note: When running SSH/ VNC or other remote-based sessions, you should take precautions since restarting the network interface or service can result in network disconnectivity, resulting in connection loss.

We will handle the following topics.

What is a network interface?

A network interface refers to the point of connection between a computer and the network. It can be either software (especially with Virtual machines) or a hardware component. When dealing with network interfaces, there is one term that you will likely come across – NIC (Network Interface Card).

A Network Interface Card is a circuit board chip inserted/ soldered on the motherboard allowing your computer to connect to the internet. If you have worked with many earlier Desktop computers (even some today), you know that most cannot connect to a WiFi network, and that’s because they don’t have a wireless NIC. You are advised to purchase a USB Network Adapter that will act as your wireless interface connection in such a situation.

How to list network interfaces on Linux

You can use different ways to see all the available network interfaces on your system. You can use the GUI or the Command-line (CLI). In this post, we highly recommend using the Terminal (CLI) since the GUI settings app might not list specific interfaces.

1. The ifconfig command

This command has long been used to list and configure network interfaces on Linux. Unfortunately, this command is marked as ‘deprecated’ and does not come pre-installed in certain distributions like recent Debian and Kali Linux releases.

To list network interfaces using ifconfig, execute the command below.

Источник

Оцените статью
Adblock
detector