Ubuntu often cannot connect to the Internet after locking the screen, and the networking icon in the upper right corner will disappear.
If you can connect to the Internet but there is no icon see this article:
http://t.csdn.cn/orho1
http://t.csdn.cn/hhVua
Solution:
generally:
suspend network service
sudo service NetworkManager stop
Delete the old network configuration and let networkmanager automatically configure the file again
sudo rm -rf /var/lib/NetworkManager/NetworkManager.state
Restart the network service
sudo service Network-Manager start
Method 1 .: Open the terminal and enter the commands in sequence
sudo service NetworkManager stop
sudo gedit /var/lib/NetworkManager/NetworkManager.state
Change NetworkingEnable = false to NetworkingEnable = true , save and exit
sudo service network-manager start
Method 2: network manager service
This is the easiest way to restart the network via the command line. It is equivalent to restarting the network through the graphical interface (restarting the Network-Manager service).
Solution steps
step one:
sudo vim /etc/NetworkManager/NetworkManager.conf
Change managed = false in the conf file to managed = true
Step 2: Restart the network-manager service:
sudo service network-manager restart
For different Linux systems, the network service name is different, mine is the following successful solution
sudo service NetworkManager restart
Method 3: ifconfig view (universal method)
No network card, only local loopback
Ifconfig -a has ens33 network card but no ip address
Mount the network card directly
Still no ip, use sudo dhclient ens33 command to dynamically assign IP
Display: Wired Unhosted.
It is also possible that you changed the /etc/network/interfaces file
(In the Ubuntu20.04 version, there is no /etc/network/interfaces file, but the /etc/netplan/01-network-manager-all.yaml file is used to configure the network)
It is really impossible to restore the network settings of the factory virtual machine
Go online to find information and solve it yourself
You can see this article to solve it:
If you still can't solve it, please have a look at my solution: