rhel6和fedora15后网卡名的改变---biosdevname (em1 p3p1)

来源:互联网 发布:ps aux grep php 编辑:程序博客网 时间:2024/05/16 01:39

原来的网卡名:eth0/1/2

新的网卡名 rhel6在dell的server上 em1 em2 em3

fedora在电脑上 p3p1


http://www.linuxidc.com/Linux/2012-07/64267.htm


于是查看RHEL6U1的 Release Notes ,发现原来RHEL6U1启用了 biosdevname 。查看Release Notes请猛击这里。

Red Hat Enterprise Linux 6.1 introduces biosdevname, an optional convention for naming network interfaces. biosdevname assigns names to network interfaces based on their physical location. Note, however that biosdevname is disabled by default, except for a limited set of Dell systems.

在RHEL6U1中,biosdevname是默认被关闭的,但是除了在Dell的服务器上是被默认开启的.

那什么是biosdevname呢?

请猛点击这里网址:

-----------以下摘自上面网址------------

biosdevname 是一款 udev 帮助程序,可根据系统 BIOS 提供的信息对网络接口进行重命名。

新的命名规则如下:

em[1-N] 表示主板(嵌入式)NIC(# 对应机箱标签)

pci#

表示 PCI 插槽中的卡,端口 1 至 N

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

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

由此,Linux 网络接口名称与外部可见的网络端口(RJ-45 机架)之间建立了明确的对照。

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

在Fedora 15中已经启用了biosdevname,RHEL6.1默认不开启。只针对DELL服务器。



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

http://hi.baidu.com/stealth_space/item/d083d436cff488f82784f4d5


Fedora 15 (Lovelock) 中对网络设备的命名进行了新的定义,默认不再显示ethx,这是Fedora的一项新属性 - Consistent Network Device Naming .


官方描述摘录:
Change the network device naming scheme from ethX to a physical location-based name foreasy identification and use.
Ethernet NICs embedded on the motherboard will be named em[1234] rather than ethX. PCI add-in card NICs will be named pci<slot>p<port>_<vf>.
Linux guests running under virtualization platforms such as KVM, Xen, VMware Workstation or ESX, or Microsoft Hyper-V will not have their devices renamed.
System Administrators may disable this feature by passing"biosdevname=0"on the kernel command line.

This feature affects all physical systems that expose network port naming information in SMBIOS 2.6 or later (specifically field types 9 and 41).
Dell PowerEdge 10G and newer servers (PowerEdge 1950 III family, PowerEdge R710 family, and newer),
and HP ProLiant G6 servers and newer are known to expose this information, as do some newer desktop models.
Furthermore, most older systems expose some information in the PCI IRQ Routing Table, which will be consulted if information is not provided by SMBIOS.


详细资料请阅读:
http://fedoraproject.org/wiki/Features/ConsistentNetworkDeviceNaming


测试系统环境:
OS:         Fedora-15-Alpha (Lovelock)
Kernel:   2.6.38-0.rc5.git1.1.fc15.i686


# 默认设置, 未修改kernel启动参数时,原有的ethx不再显示
sh-4.2$ ifconfig
lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

pci2p1    Link encap:Ethernet  HWaddr 08:00:27:B0:C8:7F                                               # ethx 消失了,转而成了pci<slot>p<port>_<vf>.
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:feb0:c87f/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3 errors:0 dropped:0 overruns:0 frame:0
          TX packets:9 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1770 (1.7 KiB)  TX bytes:1494 (1.4 KiB)

pci7p1    Link encap:Ethernet  HWaddr 08:00:27:63:BD:F1  
          inet addr:10.0.3.15  Bcast:10.0.3.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe63:bdf1/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3 errors:0 dropped:0 overruns:0 frame:0
          TX packets:9 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1770 (1.7 KiB)  TX bytes:1494 (1.4 KiB)

pci8p1    Link encap:Ethernet  HWaddr 08:00:27:84:F3:82  
          inet addr:10.0.4.15  Bcast:10.0.4.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe84:f382/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3 errors:0 dropped:0 overruns:0 frame:0
          TX packets:9 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1770 (1.7 KiB)  TX bytes:1494 (1.4 KiB)

sh-4.2$ 

 

# 修改添加 biosdevname=0 至内核启动参数,然后reboot,启动后原有的ethx都又回来了.
# 此时我们可以使用biosdevname来查看ethx对应的BIOS-given name

sh-4.2$ sudo biosdevname -i eth0
pci2p1                                                  # pci<slot>#<port>_<virtual instance>   for cards in PCI slots
sh-4.2$ sudo biosdevname -i eth1
pci7p1
sh-4.2$ sudo biosdevname -i eth2
pci8p1
sh-4.2$

sh-4.2$ cat /etc/udev/rules.d/70-persistent-net.rules                                   # 如果要改回到系统默认的新命名规则,除改回kernel启动参数外 还需要把此文件删掉或清空
# 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 0x8086:0x100e (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:84:f3:82", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"

# PCI device 0x8086:0x100e (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:b0:c8:7f", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x8086:0x100e (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:63:bd:f1", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
sh-4.2$


# 是否使用这个新属性,选择权在你手里,自己决定吧 ;-)

 


这个新属性还是不错的。其实FreeBSD做的也很好,在FreeBSD上我们可以看到em0、fxp0、bge0、bce0...这样的命名,很容易辨别网卡所属的系列,类似的还如 mpt - mfi ....


所以在使用Fedora 15 时如果没看到ethx的话,不要惊慌就是啦。

因为,你找,或是不找,网卡都在那里,不离不弃。




原创粉丝点击