经常因为要模拟架构而需要搭建大量的虚拟主机,为了节约时间,采用复制原有虚拟机为另一虚拟机,但复制完后发现虚拟网卡无法使用,错误信息:
当执行 sudo /etc/init.d/networking restart
* Reconfiguring network interfaces...
eth0: ERROR while getting interface flags: No such device
SIOCSIFADDR: No such device
eth0: ERROR while getting interface flags: No such device
SIOCSIFNETMASK: No such device
SIOCSIFBRDADDR: No such device
eth0: ERROR while getting interface flags: No such device
eth0: ERROR while getting interface flags: No such device
Failed to bring up eth0.
解决方法:
sudo rm /etc/udev/rules.d/70-persistent-net.rules
重启系统后就ok了。
同时对主机名及ip地址进行修改,以免冲突,那么可以修改以下文件:
- /etc/hostname - 改主机名称
- /etc/hosts
- /etc/network/interfaces - 改IP地址