Как перезапустить network linux

Как перезагрузить сеть в Ubuntu?

img

Вы используете систему на основе Ubuntu и просто не можете подключиться к своей сети? Вы будете удивлены, сколько проблем можно исправить простым перезапуском.

Nmtui

Перезагрузка сети в Ubuntu с помощью командной строки

Если вы используете Ubuntu Server Edition, вы уже находитесь в терминале. Если вы используете настольную версию, вы можете получить доступ к терминалу с помощью сочетания клавиш Ctrl + Alt + T в Ubuntu.

Теперь у вас есть несколько команд для перезагрузки сети в Ubuntu. Некоторые (или, возможно, большинство) упомянутые здесь команды должны быть применимы для перезапуска сети в Debian и других дистрибутивах Linux.

Network manager service

Это самый простой способ перезагрузить сеть с помощью командной строки. Это эквивалентно графическому способу сделать это (перезапускает службу Network-Manager).

sudo service network-manager restart

Значок сети должен на мгновение исчезнуть, а затем снова появиться.

systemd

Второй способ – это команда systemctl, которая гораздо более универсальна, чем service.

sudo systemctl restart NetworkManager.service

Значок сети снова должен исчезнуть на мгновение. Чтобы проверить другие параметры systemctl, вы можете обратиться к его справочной странице.

nmcli

Это еще один инструмент для работы с сетями на компьютере с Linux. Это довольно мощный инструмент, и многие системные администраторы предпочитают его, поскольку он прост в использовании.

Этот метод состоит из двух шагов: выключить сеть, а затем снова включить ее.

sudo nmcli networking off

Сеть отключится и значок исчезнет. Чтобы включить его снова:

Вы можете проверить справочную страницу nmcli для большего количества вариантов.

ifup & ifdown

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

Чтобы закрыть все сетевые интерфейсы, используйте ifdown, а затем используйте ifup, чтобы снова включить все сетевые интерфейсы.

Хорошей практикой было бы объединить обе эти команды:

sudo ifdown -a && sudo ifup -a
nmtui

Это еще один метод, часто используемый системными администраторами. Это текстовое меню для управления сетями прямо в вашем терминале.

Это должно открыть следующее меню:

Nmtui

Обратите внимание, что в nmtui вы можете выбрать другой вариант, используя клавиши со стрелками вверх и вниз.

Выберите Activate a connection

Nmtui

Нажмите Enter. Должно открыться меню с соединениями.

Nmtui

Далее, выберите сеть со звездочкой (*) рядом с ней и нажмите Enter. Это должно деактивировать это соединение.

Читайте также:  Как посмотреть вывод сервиса linux

Nmtui

Выберите соединение, которое вы хотите активировать

Nmtui

Нажмите Enter, соединение должно снова стать активным.

Nmtui

Дважды нажмите Tab чтобы выбрать пункт Back

Nmtui

Нажмите Enter, это вернет вас в главное меню.

Nmtui

Nmtui

Это должно закрыть приложение и вернуть вас в ваш терминал.

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

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

Чтобы открыть окно управления сетью, щелкните правой кнопкой мыши значок сети в правом верхнем углу и найдите сетевое соединение, которое вы хотите перезагрузить, затем нажмите «Выключить».

GUI

Значок сети исчезнет. Чтобы снова включить сеть, щелкните левой кнопкой мыши в правом верхнем углу стрелку вниз, найдите сетевой интерфейс и нажмите «Подключиться».

Источник

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.

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.

Читайте также:  Astra linux номер hdd

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:

sudo systemctl restart networking.service

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

sudo systemctl restart NetworkManager

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

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

Читайте также:  Finding large file linux

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