首先在网上找到文章一般是“虚拟机ubuntu网卡不见(网络图标不见)解决方法”这类,方法是
重新启动network-manager.
sudo service network-manager stop
sudo rm /var/lib/NetworkManager/NetworkManager.state
sudo service network-manager start
sudo gedit /etc/NetworkManager/NetworkManager.conf
(把false改成true)
sudo service network-manager restart
执行以上命令时报错:
[root@localhost ~]# service network-manager restart
Failed to restart network-manager.service: Unit network-manager.service not found.
[root@localhost ~]#
[root@localhost ~]# service network restart
Redirecting to /bin/systemctl restart network.service
Failed to restart network.service: Unit network.service not found.
最后按照以下命令恢复:
sudo service NetworkManager stop
sudo rm /var/lib/NetworkManager/NetworkManager.state
sudo vi /etc/NetworkManager/NetworkManager.conf
//打开.conf文件后,找到里面的managed,将managed=false改为managed=true。
sudo service NetworkManager start
结论:
如果出现该问题,可以把以上命令都尝试下。