有時候複製出來的虛擬機網卡會變成eth1或者eth2爲了統一方便管理,,能夠經過修改配置來還原。ios
1.修改Grub配置文件
添加參數: net.ifnames=0 biosdevname=0 vim
$ vim /boot/grub/grub.conf #boot=/dev/sda default=0 timeout=0 splashimage=(hd0,0)/grub/splash.xpm.gz hiddenmenu title CentOS 6 (2.6.32-696.el6.x86_64) root (hd0,0) kernel /vmlinuz-2.6.32-696.el6.x86_64 ro root=UUID=bed1966c-c1ce-4ca7-a6d4-4318cd3dea0a rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb net.ifnames=0 biosdevname=0 initrd /initramfs-2.6.32-696.el6.x86_64.img 說明: 開機給kernel傳遞參數,關閉主板dmidecode採集命名 刪除此文件裏的兩行參數: #vim /etc/udev/rules.d/70-persistent-net.rules # PCI device 0x8086:0x100f (e1000) SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:86:f1:d6", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0" # PCI device 0x8086:0x100f (e1000) SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:86:f1:e0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1" 說明: 這個文件系統在開機的時候會從新生成. 修改網卡配置文件,把網卡的配置文件DEVICE= ethX 改爲須要的的字符就好. 重啓系統生效 reboot