linux虚拟机没有ip,网卡服务无法启动的解决

最近使用虚拟机做实验,挂起虚拟机后再回复,发现经常无法使用xshell连接。

进入虚拟机后,使用 ifconfig 命令查看网卡状态,发现网卡的ip没有了

[root@host103 ~]# ifconfig ens33

 

 

 

 

 

 

重启网卡,发现报错。查看网卡目录,也就只有这一个网卡文件,也就是不存在其他网卡配置错误导致服务无法启动。

为了稳妥,又单独重启了 ens33网卡,依旧无法重启

[root@host103 ~]# systemctl restart network
Job for network.service failed because the control process exited with error code. See "systemctl status network.service" and "journalctl -xe" for details.

[root@host103 ~]# ls /etc/sysconfig/network-scripts/

[root@host103 ~]# ifdown ens33
[root@host103 ~]# ifup ens33
错误:激活连接失败:No suitable device found for this connection.

 

 

 

然后我就查看网卡文件的配置,查看配置是否正确,查看配置的ip是否和其他虚拟机或者vmnet网卡冲突。

 

 

 

 

然后就想到了centos7里有个NetworkManager服务,可能与network服务冲突,造成 ip 消失,network服务无法重启可能也是因为此原因

查看NetworkManger服务,发现是启动的。

[root@host103 ~]# systemctl status NetworkManager

 

 

 

关闭NetworkManager服务,并取消开机自启.

[root@host103 ~]# systemctl restart network
[root@host103 ~]# ifconfig ens33

 

重启network服务,查看ip

 

posted @ 2024-03-28 16:04  Tozhang  阅读(9)  评论(0编辑  收藏  举报