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

The method of restarting Network Service by ubuntu

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article will explain in detail the method of restarting the network service by ubuntu. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.

Restart the network from the command line

If you are using the Ubuntu server version, you are already using a 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 from 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 、 systemd

The service command is just one wrapper in 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.

Sudo systemctl restart NetworkManager.service

At this point, 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

This shuts down the network and the network icon disappears. 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 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 cut off.

Supplementary tool: 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

Open the following menu:

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

Select "Activate a connection":

Press enter to open the connections menu

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

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

Select the network you want to connect to:

Press enter. This reactivates the selected network connection.

Press the Tab key twice and select "Back":

Press enter to return to the main menu of nmtui.

Select "Quit":

Exit the interface and return to the command line terminal.

In this way, you have successfully restarted the network.

This is the end of the method for ubuntu to restart network services. I hope the above content can be of some help to you and learn more knowledge. If you think the article is good, you can share it for more people to see.

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

Servers

Wechat

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

12
Report