最近使用虛擬機做實驗,掛起虛擬機后再回復,發現經常無法使用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