Linux
為什麼我的 eth0 叫 eno16777736?
我看過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
所以假設我有設備
eno16777736
:為什麼叫它?這是一張乙太網卡,我知道了。但是我怎樣才能自己回到這個介面的其餘部分呢?我檢查
/sys/class/net/eno16777736
並看到:eno16777736 -> ../../devices/pci0000:00/0000:00:11.0/0000:02:01.0/net/eno16777736
也不知道如何解釋這一點,或者我是否可以使用這些資訊來獲取
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.
而且,確實:
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
此外,要協調來自
ifconfig
orip 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
注意“設備中斷 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
在這裡您還可以看到“物理插槽 33”,實際上,有時 VMWare 會引導
ens33
作為介面名稱獲取的 VM。因此,不清楚為什麼其他時候它選擇 eno16777736。但是 16777736 來自acpi_index
, 33 來自 PCI 插槽。
en
用於乙太網
o
機載
16777736
是韌體 (BIOS/EFI) 提供的設備索引。從 開始索引是合乎邏輯的1
。要麼,要麼您擁有合理的韌體和超過 1600 萬個板載設備!但更有可能的是,您在VMware 社區上看到了這個問題(但沒有得到回答)——這個數字似乎來自acpi_index
.您可以通過以下方式查看系統的類似資訊
udev
:udevadm info --name=/dev/eno16777736 --attribute-walk