怎樣把centos 6.2 系統裡的網卡em1還原為eth0

來源:互聯網
上載者:User

標籤:

第一步 :修改系統grub
vi /boot/grub/grub.conf

增加一個 biosdevname=0 的啟動參數,我修改的結果如下:

[[email protected] ~]# 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

第二步:刪除udev的設定檔rm -f /etc/udev/rules.d/70-persistent-net.rules

第二步可以不需要操作。

第三步:修改當前網卡設定檔的名稱
mv ifcfg-em1 ifcfg-eth0
mv ifcfg-em2 ifcfg-eth1
mv ifcfg-em3 ifcfg-eth2
mv ifcfg-em4 ifcfg-eth3

第四步:修改網卡設定檔內容,把em1全部修改改為eth0

[[email protected] ~]# 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

最後一步:重新啟動系統 shutdown -r now 啟動之後你就發現熟悉的eth0-eth4已經回來啦,順便說下centos 6.2 還有一個問題就是如果你沒有在網卡設定檔裡寫dns的話,重啟之後你就會發現 /etc/resolv.conf 檔案被清空了,一個方法就是在網卡設定檔中寫DNS,另一個方法就是給/etc/resolv.conf加i屬性,chattr +i /etc/resolv.conf

怎樣把centos 6.2 系統裡的網卡em1還原為eth0

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.