Linux虚拟机网络配置中,执行重启网络命令:
service network restart
报错:
弹出界面 eth0: 错误:激活连接失败:Device not managed by NetworkManager or unavailable
参考资料:Error:Connection activation failed:Device not managed by NetworkManager
问题现象:
VMWare克隆或复制CentOS虚拟机后,ifconfig -a ,eth0不见了,多了一个eth1,但是有/etc/sysconfig/network-scripts/ifcfg-eth0文件,无ifcfg-eth1
在运行#/etc/init.d/network restart, 重启网络连接时出现以下错误:
Bringing up interface eth0: Error:Connection activation failed:Device not managed by NetworkManager
原因:克隆或复制CentOS虚拟机后,VMWare为了避免网卡冲突又重新为新的CentOS虚拟机虚拟出来了一个网卡eth1,这就是为什么ifconfig时没有eth0了,虽然VMWare为新的CentOS虚拟机虚拟了一个新的网卡eth1,但它并没有更改/etc/sysconfig/network-scripts/ifcfg-eth0的信息,因此错误就出现了。如果克隆多次还可能会有eth2,eth3等
解决方法:
1、mv /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth1
2、修改/etc/sysconfig/network-scripts/ifcfg-eth1中的
DEVICE="eth0"改为DEVICE="eth1"
HWADDR="XX:XX:XX:XX:XX:XX"改为eth1的物理地址(用ifconfig -a查看)
并修改IPADDR里的IP地址
3、service network restart还是会报错:Bringing up interface eth0: Error:Connection activation failed:Device not managed by NetworkManager
4、Remove Network Manager from startup Services.
#chkconfig NetworkManager off
5、Add Default Net Manager
#chkconfig network on
6、Stop NetworkManager first
#service NetworkManager stop
7、and then start Default Manager
#service network start
解决方案:
1、#Remove Network Manager from startup Services.
chkconfig NetworkManager off
2、#Add Default Net Manager
chkconfig network on
3、#Stop NetworkManager first
service NetworkManager stop
4、#and then start Default Manager
service network start
5、#restart network
service network restart