为什么我的 eth0 叫 eno16777736?

Dmi*_*sky 27 networking linux udev

我看过http://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/,它描述了一致/可预测设备命名的基本原理,然后是生成设备名称的规则

 * Two character prefixes based on the type of interface:
 *   en -- ethernet
 *   sl -- serial line IP (slip)
 *   wl -- wlan
 *   ww -- wwan
 *
 * Type of names:
 *   b<number>                             -- BCMA bus core number
 *   ccw<name>                             -- CCW bus group name
 *   o<index>                              -- on-board device index number
 *   s<slot>[f<function>][d<dev_port>]     -- hotplug slot index number
 *   x<MAC>                                -- MAC address
 *   [P<domain>]p<bus>s<slot>[f<function>][d<dev_port>]
 *                                         -- PCI geographical location
 *   [P<domain>]p<bus>s<slot>[f<function>][u<port>][..][c<config>][i<interface>]
 *                                         -- USB port number chain
Run Code Online (Sandbox Code Playgroud)

所以假设我有设备eno16777736:为什么叫它?这是一个以太网卡,我明白了。但是我怎样才能自己回到这个界面名称的其余部分呢?

我检查了/sys/class/net/eno16777736,看到:

eno16777736 -> ../../devices/pci0000:00/0000:00:11.0/0000:02:01.0/net/eno16777736
Run Code Online (Sandbox Code Playgroud)

不知道如何解释这一点,或者我是否可以使用这些信息来访问eno16777736.

更新

所以16777736是设备的acpi_index. 根据https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-bus-pci

What:       /sys/bus/pci/devices/.../acpi_index
Date:       July 2010
Contact:    Narendra K <narendra_k@dell.com>, linux-bugs@dell.com
Description:
        Reading this attribute will provide the firmware
        given instance (ACPI _DSM instance number) of the PCI device.
        The attribute will be created only if the firmware has given
        an instance number to the PCI device. ACPI _DSM instance number
        will be given priority if the system firmware provides SMBIOS
        type 41 device type instance also.
Run Code Online (Sandbox Code Playgroud)

而且,确实:

core@localhost /sys/devices/pci0000:00/0000:00:11.0/0000:02:01.0 $ find . -type f | xargs grep 1677 2> /dev/null
./net/eno16777736/uevent:INTERFACE=eno16777736
./acpi_index:16777736
Run Code Online (Sandbox Code Playgroud)

此外,要协调ifconfig或 中的输出ip link和您的设备lspci

$ ifconfig
eno16777736: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.0.37  netmask 255.255.255.0  broadcast 10.0.0.255
        inet6 fe80::20c:29ff:fe70:c039  prefixlen 64  scopeid 0x20<link>
        inet6 2601:a:7c0:66:20c:29ff:fe70:c039  prefixlen 64  scopeid 0x0<global>
        ether 00:0c:29:70:c0:39  txqueuelen 1000  (Ethernet)
        RX packets 326  bytes 37358 (36.4 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 172  bytes 45999 (44.9 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 19  base 0x2000 
Run Code Online (Sandbox Code Playgroud)

请注意“设备中断 19”。从lspci -v,它有“IRQ 19”:

02:01.0 Ethernet controller: Advanced Micro Devices, Inc. [AMD] 79c970 [PCnet32 LANCE] (rev 10)
        Subsystem: Advanced Micro Devices, Inc. [AMD] PCnet - Fast 79C971
        Physical Slot: 33
        Flags: bus master, medium devsel, latency 64, IRQ 19
        I/O ports at 2000 [size=128]
        [virtual] Expansion ROM at fd500000 [disabled] [size=64K]
        Kernel driver in use: pcnet32
Run Code Online (Sandbox Code Playgroud)

在这里,您还会看到“Phyiscal Slot 33”,实际上,有时 VMWare 会引导ens33以接口名称获取的 VM 。所以,不清楚为什么其他时候它选择 eno16777736。但是16777736来自于acpi_index,33来自于PCI插槽。

gar*_*Red 30

en 用于以太网

o 机上

16777736是由固件 (BIOS/EFI) 提供的设备索引。从 开始索引是合乎逻辑的1。要么,要么您拥有合理的固件和超过 1600 万个板载设备!但更有可能的是,您会在VMware 社区上看到提出(但未得到答复)的问题- 该数字似乎来自acpi_index.

您可以通过udev以下方式查看系统的类似信息:

udevadm info --name=/dev/eno16777736 --attribute-walk
Run Code Online (Sandbox Code Playgroud)

  • 啊哈,所以它是“acpi_index”。非常感谢。我真的很想在某些输出中看到那个数字!很遗憾那个帖子上的 OP 没有显示他发出的命令,但我相信我可以谷歌搜索。谢谢 (2认同)

Gen*_*ene 9

使用 VMware?

Unix的Stackexchange网站有一问一答这个问题。似乎 BIOS 正在提供有关 NIC 的信息。

如果您想将其更改为eth0(或其他名称),您可以使用 udev 来执行此操作。 这是一个方便的指南