最近新安装的ubuntu 16.04,网卡命名和以前不同,据说15.10就开始了.
udevadm info -e | grep -A 10 ^P.*enp
P: /devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/enp2s0
E: DEVPATH=/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/enp2s0
E: ID_BUS=pci
E: ID_MODEL_FROM_DATABASE=I210 Gigabit Network Connection
E: ID_MODEL_ID=0x1533
E: ID_NET_DRIVER=igb
E: ID_NET_LINK_FILE=/lib/systemd/network/99-default.link
E: ID_NET_NAME_MAC=enx08357104beee
E: ID_NET_NAME_PATH=enp2s0
E: ID_OUI_FROM_DATABASE=CASwell INC.
E: ID_PATH=pci-0000:02:00.0
--
P: /devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/enp3s0
E: DEVPATH=/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/enp3s0
E: ID_BUS=pci
E: ID_MODEL_FROM_DATABASE=I210 Gigabit Network Connection
E: ID_MODEL_ID=0x1533
E: ID_NET_DRIVER=igb
E: ID_NET_LINK_FILE=/lib/systemd/network/99-default.link
E: ID_NET_NAME_MAC=enx08357104beef
E: ID_NET_NAME_PATH=enp3s0
E: ID_OUI_FROM_DATABASE=CASwell INC.
E: ID_PATH=pci-0000:03:00.0
--
P: /devices/pci0000:00/0000:00:1c.2/0000:04:00.0/net/enp4s0
E: DEVPATH=/devices/pci0000:00/0000:00:1c.2/0000:04:00.0/net/enp4s0
E: ID_BUS=pci
E: ID_MODEL_FROM_DATABASE=I210 Gigabit Network Connection
E: ID_MODEL_ID=0x1533
E: ID_NET_DRIVER=igb
E: ID_NET_LINK_FILE=/lib/systemd/network/99-default.link
E: ID_NET_NAME_MAC=enx08357104bef0
E: ID_NET_NAME_PATH=enp4s0
E: ID_OUI_FROM_DATABASE=CASwell INC.
E: ID_PATH=pci-0000:04:00.0
--
P: /devices/pci0000:00/0000:00:1c.3/0000:05:00.0/net/enp5s0
E: DEVPATH=/devices/pci0000:00/0000:00:1c.3/0000:05:00.0/net/enp5s0
E: ID_BUS=pci
E: ID_MODEL_FROM_DATABASE=I210 Gigabit Network Connection
E: ID_MODEL_ID=0x1533
E: ID_NET_DRIVER=igb
E: ID_NET_LINK_FILE=/lib/systemd/network/99-default.link
E: ID_NET_NAME_MAC=enx08357104bef1
E: ID_NET_NAME_PATH=enp5s0
E: ID_OUI_FROM_DATABASE=CASwell INC.
E: ID_PATH=pci-0000:05:00.0
--
P: /devices/pci0000:00/0000:00:1c.4/0000:06:00.0/net/enp6s0
E: DEVPATH=/devices/pci0000:00/0000:00:1c.4/0000:06:00.0/net/enp6s0
E: ID_BUS=pci
E: ID_MODEL_FROM_DATABASE=I210 Gigabit Network Connection
E: ID_MODEL_ID=0x1533
E: ID_NET_DRIVER=igb
E: ID_NET_LINK_FILE=/lib/systemd/network/99-default.link
E: ID_NET_NAME_MAC=enx08357104bef2
E: ID_NET_NAME_PATH=enp6s0
E: ID_OUI_FROM_DATABASE=CASwell INC.
E: ID_PATH=pci-0000:06:00.0
--
P: /devices/pci0000:00/0000:00:1c.5/0000:07:00.0/net/enp7s0
E: DEVPATH=/devices/pci0000:00/0000:00:1c.5/0000:07:00.0/net/enp7s0
E: ID_BUS=pci
E: ID_MODEL_FROM_DATABASE=I210 Gigabit Network Connection
E: ID_MODEL_ID=0x1533
E: ID_NET_DRIVER=igb
E: ID_NET_LINK_FILE=/lib/systemd/network/99-default.link
E: ID_NET_NAME_MAC=enx08357104bef3
E: ID_NET_NAME_PATH=enp7s0
E: ID_OUI_FROM_DATABASE=CASwell INC.
E: ID_PATH=pci-0000:07:00.0
lspci
02:00.0 Ethernet controller: Intel Corporation I210 Gigabit Network Connection (rev 03)
03:00.0 Ethernet controller: Intel Corporation I210 Gigabit Network Connection (rev 03)
04:00.0 Ethernet controller: Intel Corporation I210 Gigabit Network Connection (rev 03)
05:00.0 Ethernet controller: Intel Corporation I210 Gigabit Network Connection (rev 03)
06:00.0 Ethernet controller: Intel Corporation I210 Gigabit Network Connection (rev 03)
07:00.0 Ethernet controller: Intel Corporation I210 Gigabit Network Connection (rev 03)
00:19.0 Ethernet controller: Intel Corporation 82579LM Gigabit Network Connection (rev 06)
02:00.0 Ethernet controller: Intel Corporation I350 Gigabit Network Connection (rev 01)
02:00.1 Ethernet controller: Intel Corporation I350 Gigabit Network Connection (rev 01)
07:00.0 Ethernet controller: Intel Corporation I350 Gigabit Network Connection (rev 01)
07:00.1 Ethernet controller: Intel Corporation I350 Gigabit Network Connection (rev 01)
0b:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection
udevadm info -e | grep -A 11 ^P.*eno
P: /devices/pci0000:00/0000:00:19.0/net/eno1
E: DEVPATH=/devices/pci0000:00/0000:00:19.0/net/eno1
E: ID_BUS=pci
E: ID_MODEL_FROM_DATABASE=82579LM Gigabit Network Connection
E: ID_MODEL_ID=0x1502
E: ID_NET_DRIVER=e1000e
E: ID_NET_LINK_FILE=/lib/systemd/network/99-default.link
E: ID_NET_NAME_MAC=enx0cc47acc9b14
E: ID_NET_NAME_ONBOARD=eno1
E: ID_NET_NAME_PATH=enp0s25
E: ID_OUI_FROM_DATABASE=Super Micro Computer, Inc.
E: ID_PATH=pci-0000:00:19.0
P: /devices/pci0000:00/0000:00:1c.7/0000:0b:00.0/net/eno2
E: DEVPATH=/devices/pci0000:00/0000:00:1c.7/0000:0b:00.0/net/eno2
E: ID_BUS=pci
E: ID_MODEL_FROM_DATABASE=82574L Gigabit Network Connection
E: ID_MODEL_ID=0x10d3
E: ID_NET_DRIVER=e1000e
E: ID_NET_LINK_FILE=/lib/systemd/network/99-default.link
E: ID_NET_NAME_MAC=enx0cc47acc9b15
E: ID_NET_NAME_ONBOARD=eno2
E: ID_NET_NAME_PATH=enp11s0
E: ID_OUI_FROM_DATABASE=Super Micro Computer, Inc.
E: ID_PATH=pci-0000:0b:00.0
是内嵌网卡
根据 udev源码 src/udev/net/link-config.c
if (ctx->enable_name_policy && config->name_policy) {
NamePolicy *policy;
for (policy = config->name_policy;
!new_name && *policy != _NAMEPOLICY_INVALID; policy++) {
switch (*policy) {
case NAMEPOLICY_KERNEL:
respect_predictable = true;
break;
case NAMEPOLICY_DATABASE:
new_name = udev_device_get_property_value(device, "ID_NET_NAME_FROM_DATABASE");
break;
case NAMEPOLICY_ONBOARD:
new_name = udev_device_get_property_value(device, "ID_NET_NAME_ONBOARD");
break;
case NAMEPOLICY_SLOT:
new_name = udev_device_get_property_value(device, "ID_NET_NAME_SLOT");
break;
case NAMEPOLICY_PATH:
new_name = udev_device_get_property_value(device, "ID_NET_NAME_PATH");
break;
case NAMEPOLICY_MAC:
new_name = udev_device_get_property_value(device, "ID_NET_NAME_MAC");
break;
default:
break;
}
}
}
可以知道
Names incorporating Firmware/BIOS provided index numbers for on-board devices (example: eno1)
Names incorporating Firmware/BIOS provided PCI Express hotplug slot index numbers (example: ens1)
Names incorporating physical/geographical location of the connector of the hardware (example: enp2s0)
Names incorporating the interfaces's MAC address (example: enx78e7d1ea46da)
Classic, unpredictable kernel-native ethX naming (example: eth0) - depreciated
By default, systemd will now name interfaces following policy:
if that information from the firmware is applicable and available, falling back to
if that information from the firmware is applicable and available, falling back to
if applicable, falling back to
is not used by default, but is available if the user chooses so.
in all other cases.
如果自己命名
添加
/etc/udev/rules.d/10-network.rules
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="MAC:ADDRESS",KERNEL=="enp4s8", NAME="eth0"
阅读(4355) | 评论(0) | 转发(0) |