红联Linux门户
Linux帮助

Linux网卡命名enp3s0说明

发布时间:2017-06-24 10:26:30来源:linux网站作者:AnswerCard
用了很多年Linux的我在升级Ubuntu 16.04之后竟然发现我的以太网卡的名字竟然不是eth0,变成了enp3s0,每次想要修改什么配置,都要先ifconfig查一下网卡名,真是让我很郁闷!
 
去网上搜索一下才知道,这次的Ubuntu 16的更新幅度很大,当属systemd替换掉了initd来引导系统这个动作给用户带来的影响最大,原来习惯service什么的来控制系统服务什么的,现在竟然被systemctl这个命令替换了(虽然service依旧可用)。systemd带来的另外一个副作用(或者可以说是优点)就是网络接口的命名方式变了:
 
/*
* 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
*   c<bus_id>                             — CCW bus group name, without leading zeros [s390]
*   o<index>[d<dev_port>]                 — 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
*/
 
上面一段是systemd源码的注释,意思是:
1.en代表以太网卡
2.p3s0代表PCI接口的物理位置为(3, 0), 其中横座标代表bus,纵座标代表slot
 
更加详细的历史及优缺点可以参考freedesktop的wiki:
Linux网卡命名enp3s0说明
 
本文永久更新地址:http://www.linuxdiyf.com/linux/31696.html