用ESX克隆虛擬機的時候,會發現網卡編號變化了,原來的eth0,eth1不見了,而出現了eth2,eth3。我估計可能的原因是ESX在創建虛擬機時,會重新創建網卡,當系統發現網卡和配置不一樣時,就新建了新的網絡接口。
可以用下面的方法把eth0改回來:
修改70-persistent-net.rules文件
- [root@RedHat89178 ~]# cat /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 0x15ad:0x07b0 (vmxnet3)
- # 把原來的配置注釋掉
- #SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:9c:00:99", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
- # PCI device 0x15ad:0x07b0 (vmxnet3)
- # 把新出現的eth2改為eth0
- SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:9c:00:9a", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
更改網卡配置文件
- [root@redhat89178 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
- DEVICE="eth0"
- BOOTPROTO=static
- # 把MAC地址改成新的地址
- HWADDR="00:50:56:9C:00:3A"
- ...
更新主機名
- [root@redhat89178 ~]# cat /etc/sysconfig/network
- NETWORKING=yes
- HOSTNAME=<new_hostname>
- GATEWAY=10.10.10.1