Dell服务器在安装Centos6.6时网卡名称为em1问题的解决

      公司新买了几台Dell服务器,安装Centos6.6后发现服务器的网卡名称为em1,这个原因是biosdevname引起的,默认情况下Centos6.6下biosdevname是关闭的,但是如果是Dell的服务器则会自动启用该内核参数。 biosdevname是由dell开发的工具,旨在为网络设备的命名理清思路(并且保持一致性!)。biosdevname是一款udev帮助程序,可根据系统BIOS提供的信息对网络接口进行重命名。

新的命名规则如下:

  • em[1-N] 表示主板NIC(内置网卡)

  • pci<slot>#<port> 表示 PCI 插槽中的卡,端口 1 至 N (PCI类的网卡)

  • NPAR & SR-IOV 设备增加后缀 _<vf>,从 0 至  N,取决于各端口可用的分区或虚拟功能的数量。

  • 其他 Linux 命名规则,如 .<vlan> 和 :<alias> 后缀,保持不变且仍然适用。 

      Red Hat 现已推出的 Red Hat Enterprise Linux 6 Service   对网络接口实施了新的命名规则。戴尔同时开发,并遵从GPL协议义发布了‘biosdevname’ udev  helper实用程序。它会根据网络接口在系统中的物理位置来建议新的设备名称。

将RHEL6  安装到支持的戴尔PowerEdge 服务器过程中,新的网络接口名称将变为:

            emN (em1, em2, ..)

以取代主板集成网口过去使用的 ethN 名称。

对于 PCI 扩展网络接口,名称将是:

          pXpY (p<slot  number>p<port number> - p1p1, p1p2, ..).

根据新的命名方案,em1 将映射 ‘Gb1’(em2 映射 ‘Gb2’),与服务器底座上的标签相同,从而使网络接口的有效管理更加轻松。名称  p1p2 可便于识别扩展网卡上的网络端口。

新的命名方案在支持的戴尔PowerEdge 台上默认开启。在安装过程中传送‘biosdevname=0’  内核命令行参数,即可禁用新命名方案,并在运行时中保留。

 

那么如何将网卡修改为我们熟悉的ethx方式呢,有2种方法

  第一种:

(1)修改udev策略

[root@localhost ~]# cd /etc/udev/rules.d/
[root@localhost rules.d]# vim 70-persistent-net.rules

 

# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.

# PCI device 0x14e4:0x165f (tg3) (custom name provided by external tool)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="b0:83:fe:e6:d8:a4", ATTR{type}=="1", KERNEL=="eth*", NAME="em1"

# PCI device 0x14e4:0x165f (tg3) (custom name provided by external tool)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="b0:83:fe:e6:d8:a5", ATTR{type}=="1", KERNEL=="eth*", NAME="em2"

 

改为

# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.

# PCI device 0x14e4:0x165f (tg3) (custom name provided by external tool)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="b0:83:fe:e6:d8:a4", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x14e4:0x165f (tg3) (custom name provided by external tool)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="b0:83:fe:e6:d8:a5", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

 

(2)修改网卡文件名称

[root@localhost ~]# cd /etc/sysconfig/network-scripts/
[root@localhost network-scripts]# mv ifcfg-em1 ifcfg-eth0

[root@localhost network-scripts]# vim ifcfg-eth0

DEVICE=em1

改为

DEVICE=eth0

(3)重新启动系统

 

第二种方法:

(1)修改grub.conf

[root@localhost ~]# vim /etc/grub.conf

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,1)
#          kernel /vmlinuz-version ro root=/dev/mapper/VolGroup-lv_root
#          initrd /initrd-[generic-]version.img
#boot=/dev/sda1
device (hd0) HD(1,800,64000,dd2e2742-0973-4678-9989-276e29b7e967)
default=0
timeout=5
splashimage=(hd0,1)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.32-504.3.3.el6.x86_64)
 root (hd0,1)
 kernel /vmlinuz-2.6.32-504.3.3.el6.x86_64 ro root=/dev/mapper/VolGroup-lv_root rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD rd_LVM_LV=VolGroup/lv_swap SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_LVM_LV=VolGroup/lv_root  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet biosdevname=0
initrd /initramfs-2.6.32-504.3.3.el6.x86_64.img

(2)删除udev策略

 

[root@localhost ~]# cd /etc/udev/rules.d/
[root@localhost rules.d]# rm -rf 70-persistent-net.rules

 

(3)修改网卡设备文件的名称

[root@localhost ~]# cd /etc/sysconfig/network-scripts/
[root@localhost network-scripts]# mv ifcfg-em1 ifcfg-eth0

[root@localhost network-scripts]# mv ifcfg-em2 ifcfg-eth1

 

(4)修改网卡设备文件名

[root@localhost network-scripts]# vim ifcfg-eth0

DEVICE=em1

改为

DEVICE=eth0

 

[root@localhost network-scripts]# vim ifcfg-eth1

DEVICE=em2

改为

DEVICE=eth1

 

(5)重新启动服务器

[root@localhost ~]# reboot

 

 

 


 

你可能感兴趣的:(em1,dell服务器,安装CentOS)