将centos系统中的网卡em1还原为eth0

1、修改系统grub

操作:vi /boot/grub/grub.conf

增加一个 biosdevname=0 的启动参数

示例:

[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
splashimage=(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.img

------------------------------------------------------------------------------------------------------------------------------------------------

2、删除udev的配置文件

操作:rm -f /etc/udev/rules.d/70-persistent-net.rules

------------------------------------------------------------------------------------------------------------------------------------------------

3、修改当前网卡配置文件的名称

示例:

mv ifcfg-em1 ifcfg-eth0
mv ifcfg-em2 ifcfg-eth1
mv ifcfg-em3 ifcfg-eth2
mv ifcfg-em4 ifcfg-eth3

----------------------------------------------------------------------------------------------------------------------------------------------------

4、修改网卡配置文件内容,把em1全部修改改为eth0

示例:

[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"

可以使用命令进行替换,如下:

perl -p -i -e 's/em1/eth0/g' ifcfg-eth0 或sed -i 's/em1/eth0/g' ifcfg-eth0

-----------------------------------------------------------------------------------------------------------------------------------------------------

5、给/etc/resolv.conf加i属性

chattr +i /etc/resolv.conf

-----------------------------------------------------------------------------------------------------------------------------------------------------

6、重启系统

shutdown -r now

-----------------------------------------------------------------------------------------------------------------------------------------------------

posted on 2013-12-11 14:06  风转云溪  阅读(254)  评论(0编辑  收藏  举报

导航