今天在克隆虚拟机后,配置好克隆机器的IP后重启网络报错
service network restart
Shutting down loopback insterface: [ OK ]
Bringing up loopback insterface: [ OK ]
Bringing up interface eth0: Device eth0 does not seem to be present,delaying initialization.
Bringing up interface eth0: Device eth0 does not seem to be present,delaying initialization.
原因是在克隆前未删除源机的 70-persistent-net.rules文件, 在克隆或者重装虚拟机软件时,由于你使用的是以前系统虚拟硬盘的信息,而该系统中已经有eth0的信息,对于这个新的网卡,udev会自动将其命名为eth1 (累加的原则),所以在你的系统启动后,你使用ifconfig看到的网卡名为eth1。但实际上 ifconfig时只能发现eth1这一个网卡的信息,这时因为eth0根本就不存在。将其中eth0 的信息删掉,并将eth1这行信息中的设备名改为eth0,重启系统,你看到的网卡就是eth0了,或者删掉其中所有的信息重启系统udev会帮你发现新的设备的。
所以简单粗暴方法 删除克隆机器的70-persistent-net.rules文件。
rm -rf /etc/udev/rules.d/70-persistent-net.rules
然后再重启,重启通过ifconfig看到,系统使用的网卡为eth0,同时IP也是我们所配置的。