Centos6.4 modify the NIC name

Source: Internet
Author: User

Centos6.4 modify the NIC name

In my work today, the NIC interfaces of one server in centos6.4 are em1 and em2, And the NIC interfaces of other machines are eth0 and eth1. Because the script involves reading the NIC information, therefore, in order to better manage these game servers in a unified manner, I decided to change the NIC interfaces to eth0 and eth1. The method is as follows:


1. Modify/etc/grub. conf and add the start parameter biosdevname = 0.
Vim/etc/grub. conf
# Boot =/dev/sda
Default = 0
Timeout = 5
Splashimage = (hd0, 0)/grub/splash.xpm.gz
Hiddenmenu
Title CentOS (2.6.32-279. el6.x86 _ 64)
Root (hd0, 0)
Kernel/vmlinuz-2.6.32-279.el6.x86_64 ro root = UUID = 3dbe2570-4321-4af3-b108-87979ed32fdd rd_NO_LUKS rd_NO_LVM LANG = en_US.UT
F-8 rd_NO_MD SYSFONT = latarcyrheb-sun16 crashkernel = auto KEYBOARDTYPE = pc KEYTABLE = us rd_NO_DM rhgb quietBiosdevname = 0
Initrd/initramfs-2.6.32-279.el6.x86_64.img

2. Modify the NIC configuration name

Cd/etc/sysconfig/network-scripts/

Mv ifcfg-em1 ifcfg-eth1

Mv ifcfg-em2 ifcfg-eth0


3. Modify the name of the NIC in the NIC configuration file

[Root @ network-scripts] # vim ifcfg-eth0.
DEVICE =Eth0

HWADDR = 00: 26: b9: fa: ef: 7a
TYPE = Ethernet
UUID = dce362b1-8707-4ec6-a27f-4d93b116b901
ONBOOT = yes
NM_CONTROLLED = yes
BOOTPROTO = static
IPADDR = 117.103.xxx.xxx
NETMASK = 255.255.255.255.192
IPV6INIT = no
USERCTL = no
GATEWAY = 117.103.xxx.xxx
DNS1 = 203.119.8.106

[Root @ network-scripts] # vim ifcfg-eth1.

DEVICE =Eth1

HWADDR = 00: 26: b9: fa: ef: 78
TYPE = Ethernet
UUID = 36c024d5-c4e9-4bd1-8198-b247a59b20d3
ONBOOT = yes
NM_CONTROLLED = yes
BOOTPROTO = static
IPADDR = 10.112.10.142
NETMASK = 255.255.255.0
IPV6INIT = no
USERCTL = no

4. Restart the server
Init 6

These commands place the generated configuration file under the/etc/sysconfig/networking/devices/directory by default. Remember to change it to the current Nic name after restart.

Mv ifcfg-em1 ifcfg-eth1
Mv ifcfg-em2 ifcfg-eth0

Note: After you restart the system init 6, you will find that the familiar eth0-eth1 has come back, by the way, centos 6.4 also has a problem if you do not write dns in the NIC configuration file, after restart, you will find/etc/resolv. the conf file is cleared. One method is to write DNS in the NIC configuration file, and the other is to give/etc/resolv. conf and I attributes, chattr + I/etc/resolv. conf.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.