第一步:修改系統grub
vi /boot/grub/grub.confios
增長一個 biosdevname=0 的啓動參數,我修改的結果以下:centos
[root@xingfujie ~]# cat /boot/grub/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You do not have a /boot partition. This means that
# all kernel and initrd paths are relative to /, eg.
# root (hd0,0)
# kernel /boot/vmlinuz-version ro root=/dev/sda1
# initrd /boot/initrd-[generic-]version.img
#boot=/dev/sda
default=0
timeout=5
splashp_w_picpath=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.32-220.el6.x86_64)
root (hd0,0)
kernel /boot/vmlinuz-2.6.32-220.el6.x86_64 ro root=UUID=360d089b-d466-4005-abcb-c5e517d31a96 rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD quiet SYSFONT=latarcyrheb-sun16 rhgb crashkernel=auto KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM biosdevname=0 #--->這裏是新加的
initrd /boot/initramfs-2.6.32-220.el6.x86_64.imgide
第二步:刪除udev的配置文件rm -f /etc/udev/rules.d/70-persistent-net.rulesui
注:第二步能夠不須要操做。this
第三步:修改當前網卡配置文件的名稱
mv ifcfg-em1 ifcfg-eth0
mv ifcfg-em2 ifcfg-eth1
mv ifcfg-em3 ifcfg-eth2
mv ifcfg-em4 ifcfg-eth3dns
第四步:修改網卡配置文件內容,把em1所有修改改成eth0ip
[root@xingfujie ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
BOOTPROTO="dhcp"
HWADDR="24:B6:FD:F8:D5:84"
NM_CONTROLLED="yes"
ONBOOT="yes"it
能夠使用命令進行替換,以下:io
perl -p -i -e 's/em1/eth0/g' ifcfg-eth0 或sed -i 's/em1/eth0/g' ifcfg-eth0class
最後一步:從新啓動系統 shutdown -r now 啓動以後你就發現熟悉的eth0-eth4已經回來啦,順便說下centos 6.2 還有一個問題就是若是你沒有在網卡配置文件裏寫dns的話,重啓以後你就會發現 /etc/resolv.conf 文件被清空了,一個方法就是在網卡配置文件中寫DNS,另外一個方法就是給/etc/resolv.conf加i屬性,chattr +i /etc/resolv.conf