Ubuntu no network connection / no network identification solution

foreword

Opening my Ubuntu every day is like opening a blind box. You never know whether his network is working or not.


Internet problem

Sure enough, when I opened ubuntu today, there was no network logo again and again.

No matter how I change the network connection method of the network adapter, whether it is bridge mode or NAT mode, there is no network representation.
insert image description here


Cause Analysis:

Without even thinking about it, there must be no internet connection.
Ifconfig can only find the local loopback and
insert image description here
ping it will definitely not work
, neither ping domain name nor ping ip
insert image description here


solution:

Share a few effective methods

1 restart the network

1.1 Start the network service and enter the password

sudo systemctl start NetworkManager

1.2 Restart the network service

sudo systemctl restart NetworkManager

2 There may be a problem with Ubuntu's NetworkManager (80% of the problems are his)

2.1 Enter root and enter password

sudo su

2.2 Update the configuration of NetworkManager

You must have gedit or vim first, choose one of the two, gedit is used here, if you don’t have it, get gedit first, if you have it, go to the next step

apt-get install gedit

Open NetworkManager.conf with gedit

gedit /etc/NetworkManager/NetworkManager.conf

Change the fifth line from managed=False to managed=True, then ctrl+s to save and exit.
insert image description here
If it is True, there is no need to change it.

2.3 Delete NetworkManager configuration

service NetworkManager stop
rm /var/lib/NetworkManager/NetworkManager.state 
service NetworkManager start 

Pay attention to the status in the upper left corner of the desktop to automatically restore the network connection, and an icon will appear.

2.4 Restart to restore the network identity


3 VM settings

Change the network adapter in the vm from NAT mode to bridge mode, or from bridge mode to NAT mode.


Don't forget to restart the vm afterwards!

Summarize

I believe there is always one suitable for you, and my ubuntu is fine.
The network logo is also out.
insert image description here

Guess you like

Origin blog.csdn.net/qq_45400167/article/details/125874887