Перезагрузить сетевую карту 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. Это должно деактивировать это соединение.

Читайте также:  Зеркало обновлений dr web linux

Nmtui

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

Nmtui

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

Nmtui

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

Nmtui

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

Nmtui

Nmtui

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

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

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

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

GUI

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

Источник

How do I reset the network adapter using a terminal command?

enter image description here

Well ,when I turn the Router off and then I turn it on again while running Ubuntu , it doesn’t obtain an IP address automatically : I click on disconnect , but it remains like above. It works only if I log out and switch to another session and then back the default one. So How do I reset the network adapter using a terminal command, or any another suggestions? Edit: I’ve tried using sudo dhclient , but it didn’t work.

Have you tried disabling/enabling the whole wireless networking through nm? (cannot remember if 11.04 has this feature, though).

Network Manager? It used to allow to disable Networking or Wireless Networking in the menu you obtain clicking on its icon.

4 Answers 4

If you really want to reset the network adapter you usually need to unload and reload the kernel module that it uses.

If you just want to reconfigure it you can usually do:

sudo /etc/init.d/network-manager restart 

But if you just want a new dhcp lease (that’s the technical name for obtain a new IP from the router), you just need to use:

@Binarylife yes, that should get you a new IP address. If it doesnt, the router’s DHCP may be at fault, and not your wifi card.

IMHO this answer will not work, as both mentioned commands refer to listed devices in /etc/network/interfaces. In a normal Ubuntu install, only ‘loopback’ is listed there.

This sound like a network-manager problem to me.

I would try the following: (in a gnome-terminal)

  1. ‘Softblock’ your wireless device with rfkill block wifi
  2. rfkill list will show you if you were successful.
  3. killall nm-applet You kill the network-manager process (panel icon will be gone).
  4. rfkill unblock wifi Enable wifi again.
  5. nm-applet Load a new network-manager session.

Maybe simply killing/loading nm-applet will do. Also note, that you don’t need to use ‘sudo’ for this.

I do know that some router and wifi devices do not ‘like’ each other very well. This is often a problem of a somehow ‘beta’ wifi linux-driver.

nmcli radio wifi off nmcli radio wifi on 

I wrote a script to try various methods to reset the wifi when it dropped the connection or was otherwise non-responsive (it is called every 2 minutes in a cron):

 #!/bin/sh # program to check wifi and reset if not running IPTEST=192.168.1.1 iwconfig=/sbin/iwconfig rfkill=/usr/sbin/rfkill DEVICE=`$iwconfig | egrep 802 | awk ' '` if ping -c 1 $IPTEST >/dev/null 2>&1 ; then #echo $IPTEST ok exit 0 else # Failed, try to reset wifi - sometimes works ok ( date echo "Apagando wifi. " nmcli nm wifi off sleep 3 echo Iniciando wifi. nmcli nm wifi on sleep 10 if ping -c 1 $IPTEST >/dev/null 2>&1 ; then #echo $IPTEST ok exit 0 else # try another way echo "Apagando wifi $iwconfig . " $iwconfig $iwconfig $DEVICE txpower off sleep 3 echo Iniciando wifi. $iwconfig $DEVICE txpower auto fi sleep 10 if ping -c 1 $IPTEST >/dev/null 2>&1 ; then #echo $IPTEST ok exit 0 else # try another way echo "Apagando wifi $rfkill . " $rfkill list $rfkill block wifi sleep 3 echo Iniciando wifi. $rfkill unblock wifi fi #echo Cerrar esta ventana cuando sale el estado #sleep 3 #iftop -i $DEVICE ) >> $HOME/wificheck.log 2>&1 fi exit 0 

Источник

Читайте также:  Linux переподключить usb устройство

How to restart Network Interface / Network Adapter on Linux & Windows Cloud Servers

Once you make changes in the server network configuration file, then require to restart the server networking service in order to reflect the changes.

This guide will describe the steps to restart the network interface or network adapter in the Linux and Windows servers.

Restarting Network interface/adapter in Linux OS

Ubuntu / Debian

    Use the following command to restart the server networking service.

# sudo /etc/init.d/networking restart or # sudo /etc/init.d/networking stop # sudo /etc/init.d/networking start else # sudo systemctl restart networking 

networkadapter1networkadapter2
Once this is done, use the following command to check the server network status.

# sudo /etc/init.d/networking status or # sudo systemctl status networking 

networkadapter3networkadapter4

Ubuntu 17.10 and higher versions use NetPlan as the default network management tool and its configuration files are written in YAML syntax with a .yaml file extension .

Run the below command to update networking and then any changes that have been made to the network will take effect:

networkadapter5

AlmaLinux

    Use the following command to restart the server networking service.

# nmcli networking off # nmcli networking on or # systemctl restart NetworkManager 

networkadapter6networkadapter7
Once this is done, use the following command to check the server network status.

# nmcli -o or # systemctl status NetworkManager 

networkadapter8networkadapter9

Rocky Linux

    Use the following command to restart the server networking service.

# nmcli networking off # nmcli networking on or # systemctl restart NetworkManager 

restartnetworkrockylinux1restartnetworkrockylinux2
Either of the below commands can be executed to check the status of the networking service.

# nmcli -o or # systemctl status NetworkManager 

restartnetworkrockylinux3restartnetworkrockylinux14

CentOS 8

    Use the following command to restart the server networking service.

# nmcli networking off # nmcli networking on or # systemctl restart NetworkManager.service 

networkadapter11networkadapter10
Either of the below commands can be executed to check the status of the networking service.

# systemctl status NetworkManager.service or # nmcli -o 

networkadapter12networkadapter13

Читайте также:  Узнать основной шлюз линукс

CentOS 7

    Use the following command to restart the server networking service.

# systemctl restart network.service or # service network restart or # /etc/init.d/network restart 

networkadapter14networkadapter15
The status of the networking service can be checked by making use of any of the below commands.

# systemctl status network.service or # service network status or # /etc/init.d/network status 

networkadapter17networkadapter16networkadapter19

CentOS 6

    Use the following command to restart the server networking service.

# service network restart or # /etc/init.d/network restart 

networkadapter20networkadapter21
Once this is done, use the following command to check the server network status.

# service network status or # /etc/init.d/network status 

networkadapter22networkadapter23

Windows OS

Using the Enable/Disable mode of network adapter

  1. Click on the Windows key to open start and search Settings and go to the Network and Internet then click on Change adapter option which is shown in the below image. restartnetworkwin1Then will get the below page: restartnetworkwin2
  2. Right-click the Ethernet device and click on Disable option. restartnetworkwin3restartnetworkwin4
  3. Again, Right-click the Ethernet device and click on enable option. restartnetworkwin5
  4. Once this is done, Right-click the Ethernet device and click on status . restartnetworkwin6restartnetworkwin7

Using the netsh command

In Windows OS, the command line method involves using the netsh command for resetting the network and TCP/IP stack.

restartnetworkwin8

  1. Go to Start and type CMD in the search window.
  2. Once opened the Command Prompt , the command for restarting the network interface, as provided below, can be executed.

restartnetworkwin9

  • Regularize the networking process as indicated in the message after restarting the server.
  • In addition to the above command, may also use the command which resets the TCP/IP stack. The command is as follows.

    restartnetworkwin10

    The output will be as follows:

    Using the Network Reset option (Windows 10/11)

    The reset button method can be used in Windows 10 & 11 versions by which the user can restart the Network interface. The steps for this are given below.

    1. Click on Windows Start Menu button and then select Settings . restartnetworkwin11
    2. From the Settings option, select Network & Internet option. restartnetworkwin12
    3. Here you would be able to see the adapter options i.e Advanced Network Settings , from which you can click on Network Reset option. restartnetworkwin13
    4. Click on the Reset Now button on the right side of Network reset option and you will be prompted for the confirmation. Choose Yes for proceeding with resetting the network settings. restartnetworkwin14
      Once clicked on Yes , the network adapter will start to reset and you will be able to restart the network interface. restartnetworkwin15

    Источник

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