Перезапустить network manager linux

Make Network Manager restart after dropped connection?

Using Ubuntu 11.10 (Unity 3D) and a cable (DSL) internet connection with no router or modem. If I disconnect my internet connection, I can just reconnect by clicking on the network manager icon and selecting a connection from the drop down menu since my connections are visible. There is no need to restart network manager. But whenever the internet connection drops by itself, I have open a terminal and use sudo service network-manager restart since I don’t see any connection in the network manager drop down menu. Only after the command, does network manager then start and automatically connect. Is there some setting so that network manager does not have to be restarted each time the connection drops (as opposed to my disconnecting it when it doesn’t need a restart)? I guess in other words, I don’t want network manager to stop as long as I’m using the computer, irrespective of whether my connection to the ISP has dropped or not. It’s not a very big deal to open a terminal and type the command and password, but if there’s a way to ensure that network manager doesn’t stop that would be better. edit dated Jan 26, 2012: Lines from syslog

Jan 25 20:09:36 aes-Inspiron-1545 pppd[3539]: No response to 3 echo-requests Jan 25 20:09:36 aes-Inspiron-1545 pppd[3539]: Serial link appears to be disconnected. Jan 25 20:09:36 aes-Inspiron-1545 pppd[3539]: Connect time 241.5 minutes. Jan 25 20:09:36 aes-Inspiron-1545 pppd[3539]: Sent 3575961 bytes, received 79026206 bytes. Jan 25 20:09:36 aes-Inspiron-1545 pppd[3539]: Connection terminated. Jan 25 20:09:36 aes-Inspiron-1545 avahi-daemon[836]: Withdrawing workstation service for ppp0. Jan 25 20:09:36 aes-Inspiron-1545 NetworkManager[3531]: (eth0): device state change: activated -> failed (reason 'ppp-disconnect') [100 120 13] Jan 25 20:09:36 aes-Inspiron-1545 NetworkManager[3531]: Activation (eth0) failed. Jan 25 20:09:36 aes-Inspiron-1545 NetworkManager[3531]: SCPlugin-Ifupdown: devices removed (path: /sys/devices/virtual/net/ppp0, iface: ppp0) Jan 25 20:09:36 aes-Inspiron-1545 NetworkManager[3531]: (eth0): now unmanaged Jan 25 20:09:36 aes-Inspiron-1545 NetworkManager[3531]: (eth0): device state change: failed -> unmanaged (reason 'removed') [120 10 36] Jan 25 20:09:36 aes-Inspiron-1545 NetworkManager[3531]: (eth0): deactivating device (reason 'removed') [36] Jan 25 20:09:36 aes-Inspiron-1545 dbus[802]: [system] Activating service name='org.freedesktop.nm_dispatcher' (using servicehelper) Jan 25 20:09:36 aes-Inspiron-1545 NetworkManager[3531]: could not read ppp stats: No such device Jan 25 20:09:36 aes-Inspiron-1545 NetworkManager[3531]: (eth0): cleaning up. Jan 25 20:09:36 aes-Inspiron-1545 NetworkManager[3531]: (eth0): taking down device. Jan 25 20:09:36 aes-Inspiron-1545 kernel: [18027.155552] sky2 0000:09:00.0: eth0: disabling interface Jan 25 20:09:36 aes-Inspiron-1545 avahi-daemon[836]: Interface eth0.IPv6 no longer relevant for mDNS. Jan 25 20:09:36 aes-Inspiron-1545 avahi-daemon[836]: Leaving mDNS multicast group on interface eth0.IPv6 with address fec0::b:223:aeff:fe2d:2431. Jan 25 20:09:36 aes-Inspiron-1545 avahi-daemon[836]: Withdrawing address record for 2002:1b00:3b4f:b:223:aeff:fe2d:2431 on eth0. Jan 25 20:09:36 aes-Inspiron-1545 avahi-daemon[836]: Withdrawing address record for 2002:1b00:3754:b:223:aeff:fe2d:2431 on eth0. Jan 25 20:09:36 aes-Inspiron-1545 avahi-daemon[836]: Withdrawing address record for 2002:7345:f137:b:223:aeff:fe2d:2431 on eth0. Jan 25 20:09:36 aes-Inspiron-1545 avahi-daemon[836]: Withdrawing address record for fec0::b:223:aeff:fe2d:2431 on eth0. Jan 25 20:09:36 aes-Inspiron-1545 NetworkManager[3531]: Unmanaged Device found; state CONNECTED forced. (see http://bugs.launchpad.net/bugs/191889) Jan 25 20:09:36 aes-Inspiron-1545 NetworkManager[3531]: Unmanaged Device found; state CONNECTED forced. (see http://bugs.launchpad.net/bugs/191889) Jan 25 20:09:36 aes-Inspiron-1545 pppd[3539]: Terminating on signal 15 Jan 25 20:09:36 aes-Inspiron-1545 pppd[3539]: Exit. Jan 25 20:09:36 aes-Inspiron-1545 dbus[802]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher' Jan 25 20:11:56 aes-Inspiron-1545 modem-manager[3529]: Caught signal 15, shutting down. Jan 25 20:11:56 aes-Inspiron-1545 NetworkManager[3531]: caught signal 15, shutting down normally. Jan 25 20:11:56 aes-Inspiron-1545 NetworkManager[3531]: quit request received, terminating. Jan 25 20:11:56 aes-Inspiron-1545 NetworkManager[3531]: (eth1): now unmanaged Jan 25 20:11:56 aes-Inspiron-1545 NetworkManager[3531]: (eth1): device state change: unavailable -> unmanaged (reason 'removed') [20 10 36] Jan 25 20:11:56 aes-Inspiron-1545 NetworkManager[3531]: Unmanaged Device found; state CONNECTED forced. (see http://bugs.launchpad.net/bugs/191889) Jan 25 20:11:56 aes-Inspiron-1545 NetworkManager[3531]: exiting (success) Jan 25 20:11:56 aes-Inspiron-1545 modem-manager[6945]: ModemManager (version 0.5) starting. Jan 25 20:11:56 aes-Inspiron-1545 NetworkManager[6947]: NetworkManager (version 0.9.1.90) is starting. Jan 25 20:11:56 aes-Inspiron-1545 NetworkManager[6947]: Read config file /etc/NetworkManager/NetworkManager.conf Jan 25 20:11:56 aes-Inspiron-1545 kernel: [18167.470749] init: reconnect main process (6948) terminated with status 2 Jan 25 20:11:56 aes-Inspiron-1545 modem-manager[6945]: Loaded plugin Nokia Jan 25 20:11:56 aes-Inspiron-1545 modem-manager[6945]: Loaded plugin Ericsson MBM Jan 25 20:11:56 aes-Inspiron-1545 modem-manager[6945]: Loaded plugin MotoC 

Источник

Читайте также:  Как открыть linux terminal

How to Restart Network in Ubuntu

Here are 6 ways you can restart the network in Ubuntu and other Linux distros. Also learn to refresh wireless network connection in Ubuntu Linux.

Restart the network in Ubuntu via the command line

If you are using the Ubuntu server edition, you are already in the terminal. If you are using the desktop edition, you can access the terminal using Ctrl + Alt + T keyboard shortcut in Ubuntu.

Now you have several commands to restart the network in Ubuntu. Some (or perhaps most) commands mentioned here should also be applicable for restarting the network in Debian and other Linux distributions.

1. Restarting the Network Manager Service

This is the easiest way to restart your network using the command line. It’s equivalent to the graphical way of doing it (restarts the Network-Manager service).

sudo systemctl restart NetworkManager.service

The network icon should disappear for a moment and then reappear.

2. nmcli

This is yet another tool for handling networks on a Linux machine. It is a pretty powerful tool that I find very practical. Many sysadmins prefer it since it is easy to use. This tool is a part of the NetworkManager package.

There are two steps to this method: turning the network off and then turning it back on.

sudo nmcli networking off

The network will shut down and the icon will disappear. To turn it back on:

You can check out the man page of nmcli for more options.

3. nmtui

This is another method often used by system administrators. It is a text menu (in a Terminal User Interface) for managing networks right in your terminal. It is also a part of the Network Manager tool.

Читайте также:  Arm linux gnueabi toolchain

This should open up the following menu:

The interface of nmtui

Note that in nmtui, you can select another option by using the up and down arrow keys.

Select Activate a connection:

Activate a connection

Press Enter. This should now open the connections menu.

The list of connections

Here, go ahead and select the network with a star (*) next to it. In my case, it’s MGEO72.

Select the interface highlighted with a star

Press Enter. This should deactivate your connection.

Connection deactivated

Select the connection you want to activate and press Enter. This should activate the desired connection.

Activate again by selecting desired connection

Press Tab twice to select the button, and exit from the main menu. This is how you can restart a connection with nmtui.

4. ifup & ifdown

These commands handle a network interface directly, changing its state to one in which it either can or can not transmit and receive data. It’s one of the must-know networking commands in Linux.

To shut down all network interfaces, use ifdown and then use ifup to turn all network interfaces back on.

A good practice would be to combine both of these commands:

sudo ifdown -a && sudo ifup -a

Note: This method will not make the network icon in your systray disappear, and yet you won’t be able to have a connection of any sort.

That’s it! You have successfully restarted your network.

Restart the network in Ubuntu graphically

This is, of course, the easiest way of restarting the network for Ubuntu desktop users. If this one doesn’t work, you can of course check the command line options mentioned in the previous section.

NM-applet is the system tray applet indicator for NetworkManager. That’s what we’re going to use to restart our network.

First of all, check out your top panel. You should find a network icon in your system tray (in my case, it is a Wi-Fi icon, since that’s what I use).

Go ahead and click on that icon (or the sound or battery icon). This will open up the menu. Select “Turn Off” here.

Restart network in Ubuntu

The network icon should now disappear from the top panel. This means the network has been successfully turned off.

Click again on your systray to reopen the menu. Select “Turn On”.

Restarting network in Ubuntu

Congratulations! You have now restarted your network.

Bonus Tip: Refresh the available network list

Suppose you are connected to a network already but you want to connect to another network. How do you refresh the WiFi to see what other networks are available? Let me show you that.

Ubuntu doesn’t have a ‘refresh wifi networks’ option directly. It’s sort of hidden.

Читайте также:  Lineage 2 java on linux

You’ll have to open the setting menu again and this time, click on “Select Network”.

Refresh wifi network list in Ubuntu

Now, you won’t see the list of available wireless networks immediately. When you open the networks list, it takes around 5 seconds to refresh and show up other available wireless networks.

Select another wifi network in Ubuntu

And here, you can select the network of your choice and click «Connect». That’s it.

Wrapping Up

Restarting your network or connection is something that every Linux user has to go through at some point in their experience. These tools can come in handy for doing the same.

But, if you’re stranded with not finding any wireless interface to connect with (no Wi-fi hardware detected), you can refer to this article.

You can also check out some of the most important networking commands in Linux:

We hope that we have helped you with plenty of methods for handling such issues!

What do you use to restart/handle your network? Is there something we missed? Leave us a comment below.

Источник

Перезапуск сети в 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. Можно сразу же использовать ещё для наших целей. Просто отключите, а затем включите сеть обратно следующими командами:

sudo nmcli networking off

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

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

Команды ifup и ifdown

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

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

Выводы

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

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

Источник

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