今天在測試opennebula,因爲換了這個虛擬網絡,發現啓動的虛擬機的網卡改名了,eth0改爲了eth3
udev: renamed network interface eth0 to eth3
因爲虛擬機的配置是需要通過其他初始化腳本來生成的,所以網卡的設備名不能改變,需要把eth3修改爲eth0
以rhel6爲例,把以下文件作修改如下:
1、把eth0 ,eth1 ,eth2的相關行刪除掉
2、把eth3的相關行保留,並把eth3改爲eth0即可。
- [root@ovm0246 ~]# vim /etc/udev/rules.d/70-persistent-net.rules
- # This file was automatically generated by the/lib/udev/write_net_rules
- # program, run by the persistent-net-generator.rules rules file.
- #
- # You can modify it, as long as you keep each rule on a single
- # line, and change only the value of the NAME= key.
- # PCI device 0x10ec:0x8139 (8139cp) (custom name provided by external tool)
- SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="52:54:00:12:34:56", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
- # PCI device 0x10ec:0x8139 (8139cp)
- SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="02:00:c0:a8:14:f9", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
- # PCI device 0x10ec:0x8139 (8139cp)
- SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="52:54:00:e4:d4:1d", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"
- # PCI device 0x10ec:0x8139 (8139cp)
- SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="02:00:c0:a8:14:fa", ATTR{type}=="1", KERNEL=="eth*", NAME="eth3"