System network restart linux

How to restart the networking service?

Note that you might reanimate your keyboard, if you unplug and replug it — and it is hot pluggable, i.e. USB.

I also faced similar issue on Gnome 3 on Ubuntu 13.03. Screen disorted as top bar gone. Short keys not worked. As no menu/Activies shown I get no way to operate the system. Luckily console was opened already. So reboot command can be typed.

if you are looking for GUI method just open dash, type «Network» and select that. now press «On/Off» button to turn off and again click to on. your networking is restarted now.

18 Answers 18

For Desktops

sudo service network-manager restart 

Or on recent Ubuntu versions:

sudo systemctl restart systemd-networkd 

Ubuntu uses network-manager instead of the traditional Linux networking model. so you should restart the network-manager service instead of the network service. Or use ifup/down.

For Servers

hmm, strange that restarting just networking breaks the system. Does it happen to you too or is it just me?

For Servers

Restarting networking on a desktop machine will cause dbus and a bunch of service to stop and never be started again, usually leading to the whole system being unusable.

As Ubuntu does event based network bring up, there quite simply isn’t a way to undo it all and redo it all, so a restart just isn’t plain possible. The recommended way instead is to use ifdown and ifup on the interfaces you actually want to reconfigure:

sudo ifdown --exclude=lo -a && sudo ifup --exclude=lo -a 

@waspinator the bug is marked fixed as of march of this year: bugs.launchpad.net/ubuntu/+source/dbus/+bug/1072518

Worked on Ubuntu Server 16.04.1. Ubuntu Server doesn’t appear to include Network Manager, so askubuntu.com/a/230751/13756 doesn’t work.

Источник

How to Restart Network on Ubuntu 22.04

Ubuntu Network Restart

Whenever a problem occurs with the system, the main solution is to perform a restart or reboot the system. Similarly, if a problem occurs with the network, then its easy treatment is to restart the network. There are many scenarios where you may need to restart the network on Ubuntu like settings of the network were changed or the active network connection not working properly. Restarting the network services is equally important for all Linux systems.

In this article, we will check how to restart the network on Ubuntu 22.04 and Ubuntu 20.04 systems.

Using the following different methods, you can restart the network on Ubuntu.

Читайте также:  What is drwxr xr x in linux

Depending on your ease, you can choose one that suits you.

Prerequisites

We are assuming that you are using the Gnome desktop on your Linux system. You should be logged in as a root user or you have sudo privileges to run all commands.

Method 1: Restart Network using GUI

When you restart the network using the GUI, then you can follow the following two different options.

Restart Network from the Desktop

In this method, you can restart the network from the Desktop. To do that, right-click on the top right corner on the network icon, and the following drop-down list will display on the right corner:

Desktop network Icon on Ubuntu

Click on the ‘wired connected’ option from the list and select ‘Turn off’ that will disable the network connection.

Turn off network connection

Now, follow the above-mentioned process and again enable the network by clicking the connect option as follows:

Connect to network

The network connection has been re-establish now.

Network Restart using Gnome Settings

Click on the arrow sign located at the top right corner and then choose ‘Settings’.

Open Settings

You can also go into the Settings by using the application search bar as follows:

GNOME settings manager

You will see the following window on the desktop. Select the ‘network’ option from the left sidebar and here you can enable or disable the connected network connection.

Network settings

Method 2: Restart network using the command line

Using this method, you can restart the network using the following different ways:

Restart Network using the service manager

The most simple and easiest way to restart the network using the network service manager. Launch the terminal and type the following command on it:

$ sudo service network-manager restart

Restart network manager service

Use Systemd to Restart Network

Systemd has an array of system components that can also handle network services. Restart network service using systemd, directly restart the network services instead of going through any other hoops.

$ sudo systemctl restart NetworkManager.service

Use systemctl command to restart network on Ubuntu

Restart Network through the Nmcli

Nmcli is the most commonly used tool for managing network connections. You can turn off the connect using the following command:

$ sudo nmcli networking off

network restart with nmcli

Use the command below to turn on the network connection.

Turn on network using nmcli

Using ifdown and ifup commands Restart Network

The ifdown and ifup commands are used to handle the different network interfaces on Linux.

These two packages are not preinstalled on Ubuntu. Therefore, you need to install these packages by using the following command:

$ sudo apt update && sudo apt install ifupdown -y

Install ifup and ifdown scripts

To turn off the network, use the ifdown and turn it on by using the ifup command as follows:

$ sudo ifdown -a && sudo ifup -a

Restart Network using the nmtui

Nmtui is another tool for managing network connections and provides an interactive environment. This tool comes pre-installed by default on Ubuntu. Therefore, just launch it using the following command:

The following interface will display on the terminal:

Start nmtui

Choose ‘Activate a connection’ using the downward arrow key and then hit ‘Enter’.Now, deactivate this connection by selecting the ‘deactivate’ option and hitting ‘Enter’.

Deactivate network connection

Once the connection is deactivated, again ‘Activate’ this connection as follows:

Activate network connection

Once the network is restarted, quit this application as follows:

Quit nmtui

Restart network using the IP command

The IP command is one more alternative that you can use in managing the network connections on Linux.

Читайте также:  Alt linux swap file

First, you will find your target network interface by using the following command:

get network device name with ip command

Here, enp0s3 is our target network. Start the network by typing the following command:

$ sudo ip link set enp0s3 down

Shutdown network link using ip command

$ sudo ip link set enp0s3 up

Turn on network link with the help of the ip command

Conclusion

Restarting the network is a good solution for solving a network problem. If you still have the same problem then you can also reboot or restart your system. From the above all mentioned ways, I hope you have learned a lot. But, in case of any issue, you can send us your feedback.

About This Site

Vitux.com aims to become a Linux compendium with lots of unique and up to date tutorials.

Latest Tutorials

Источник

How to restart network services in Linux

Restart Networking in Linux

Sometimes, when you changed the network configuration or due to some network problems, you may need to restart the network services again on your Linux system to solve your problem. In this article, we will talk about how to restart the networking services on in different Linux distributions (Ubuntu, Debian, LinuxMint and CentOS) by using the command line. We have implemented different commands on Ubuntu 20.04 and CentOS 8 system. All commands which we have executed on Ubuntu 20.04 can be also used for Debian and LinuxMint distributions.

Get network Service Status

You can get the network services running status by using the following command:

For latest (Ubuntu/Debian/Mint)

To check the networking services are running on your system or not, by using the following ‘systemctl’ command you can view the networking service status on your Ubuntu/Debian/Mint system:

$ sudo systemctl status networking
$ sudo systemctl status networking.service

You can also display the networking service status by using the service command which is given as follows:

$ sudo service networking status

$ /etc/init.d/networking status

For CentOS 8 / Fedora

If you are using CentOS 8 then you can check the network service status by using the following command:

If you received an error like ‘network.service unit not found’ then, you will run the following command to start the network manager:

# systemctl start NetworkManager

Now, start the network services and you can get network status by using the above-mentioned command.

Stop Network Services

You can stop your network services through the method which is mentioned below. But, if you have a remote connection with SSH, we are not recommended you to stop the service because it may create problems.

For Ubuntu/Debian/Mint

You can use the ‘stop’ option with the above ‘networking’ command on Ubuntu, Debian, Kali, Mint distributions in order to stop network services.

$ sudo /etc/init.d/networking stop

$ sudo systemctl stop networking.service

linux restart network

For CentOS 8/Fedora

In CentOS 8, using the following command you can stop network services:

Now, if you will check the network status you will see that network services are stopped on your system.

linux restart network

Start Network Service

If networking services are stopped on your system then, you start these services on the Linux system.

For Ubuntu/Debian/Mint

You can also start the network services by using the service command. Use ‘start’ option to start the network service on your Ubuntu. Debian and LinuxMint distributions.

$ sudo service networking start

linux restart network

$ sudo systemctl start networking.service
$ $ sudo /etc/init.d/networking start

For CentOS 8/Fedora

In CentOS 8, by using the following command you can start the network service on your system:

Читайте также:  Remove all file and folder in linux

Restart Network Service

You can also restart the network service by using the following command on Linux distributions:

For Ubuntu/Debian/Mint

Type the following command to restart the network service on Ubuntu, Debian, and Linux Mint:

$ /etc/init.d/networking restart
$ sudo systemctl restart networking.service
$ sudo systemctl restart networking

For CentOS 8/Fedora

Use the following command to restart the network service on CentOS 8:

# systemctl restart network

If you get the following error on the terminal then, you need to start the NetworkManager services on your system by using the following command:

# systemctl start NetworkManager

Now, again restart the network service. You will see the following output on the CentOS system:

linux restart network

Conclusion

From the above information, we have explored how to start, stop, and restart the network service on different Linux distribution like Ubuntu, Debian, Linux Mint, and CentOS 8. Moreover, you can troubleshoot the network error through the NetworkManager tool on CentOS 8. If you need more details then, you can implement all command on your system and then let us know about your problems. Please don’t stop services if you have a remote ssh connection that may create a problem.

Samreena Aslam holds a master’s degree in Software Engineering. She’s a technical writer and has written various articles on different Linux flavours including Ubuntu, Debian, CentOS and Mint as well as programming guides in various programming languages

Источник

Перезапуск сети в 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