Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to restart the Network in Linux system

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to restart the network in the Linux system, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

Restart the network from the command line if you are using the Ubuntu server version, then you are already using the command line terminal. If you are using the desktop version, you can use the keyboard shortcut Ctrl+Alt+T Ubuntu to open the command line terminal.

In Ubuntu, there are several commands to restart the network. These commands, some or most, also apply to restarting the network in Debian or other Linux distributions.

1. Network manager service this is the easiest way to restart the network through the command line. It is equivalent to restarting the network (restart the Network-Manager service) through a graphical interface.

Sudo service network-manager restart at this point, the network icon disappears for a while and then reappears.

2. The systemdservice command is just an encapsulation of this way (also an encapsulation of init.d series scripts and Upstart-related commands). The systemctl command is far more functional than the service command. Usually I prefer to use this command.

At this point in sudo systemctl restart NetworkManager.service, the network icon will disappear for a while. If you want to learn about other options for systemctl, you can refer to the man help documentation.

3. Nmcli this is another tool on Linux that can manage the network. This is a powerful and practical tool. Many system administrators like to use this tool because it is very easy to use.

There are two steps in this method: shut down the network and then turn it on.

Sudo nmcli networking off will shut down the network and the network icon will disappear. Next, turn on the network:

Sudo nmcli networking on you can learn more about the use of nmcli through the man help documentation.

4. Ifup & ifdown these two commands directly operate the network port and switch the status of whether the network port can send and receive packets. This is one of the most important network commands you should know about in Linux.

Use ifdown to close all network ports, and then use ifup to re-enable network ports.

It is generally recommended to use these two commands together.

Sudo ifdown-a & & sudo ifup-a Note: this method will not make the network icon disappear from the system tray, in addition, various network connections will be broken.

Supplementary tools: nmtui this is another method commonly used by system administrators. It is a text menu tool for managing the network in a command line terminal.

Nmtui opens the following menu:

Nmtui Menu

Note: in nmtui, you can select options through the up and down arrow keys.

Select "Activate a connection":

Nmtui Menu Select "Activate a connection"

Press enter to open the connections menu.

Nmtui Connections Menu

Next, select the network preceded by an asterisk (*). In this case, it is MGEO72.

Select your connection in the nmtui connections menu.

Press enter. This will "disable" your network connection.

Nmtui Connections Menu with no active connection

Select the network you want to connect to:

Select the connection you want in the nmtui connections menu.

Press enter. This reactivates the selected network connection.

Nmtui Connections Menu

Press the Tab key twice and select "Back":

Select "Back" in the nmtui connections menu.

Press enter to return to the main menu of nmtui.

Nmtui Main Menu

Select "Quit":

Nmtui Quit Main Menu

Exit the interface and return to the command line terminal.

In this way, you have successfully restarted the network.

Obviously, this is the easiest way for Ubuntu desktop users to restart the network through a graphical interface. If this method doesn't work, you can try to restart the network using the command line mentioned above.

NM Mini Program is the system tray program logo of NetworkManager. We will use it to restart the network.

First, look at the top status bar. You will find a network icon in the system tray (because I use Wi-Fi, so here is a Wi-Fi icon).

Next, click the icon (you can also click the volume icon or the battery icon). Open the menu. Select Turn Off to shut down the network.

Restart network in Ubuntu

The network icon disappears in the status bar, indicating that you have successfully shut down the network.

Click the system tray again to reopen the menu, select "Turn On", and reopen the network.

Restarting network in Ubuntu

Congratulations! You've restarted your network now.

Other tips: refresh the list of available networks if you are already connected to another network, but you want to connect to another network, how do you refresh the WiFi list to find other available networks? Let me show you.

Ubuntu does not have the option to "refresh the WiFi network" directly, it is a bit covert.

You need to open the configuration menu again and click "Select Network".

Refresh wifi network list in Ubuntu

Select the corresponding network to modify your WiFi connection.

You can't see a list of available wireless networks right away. After opening the list of networks, it will take about 5 seconds to display other available wireless networks.

Select another wifi network in Ubuntu

Wait about 5 seconds to see other available networks.

Now, you can select the network you want to connect to and click Connect. That's it.

Thank you for reading this article carefully. I hope the article "how to restart the Network in the Linux system" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report