Linux網卡命名enp3s0說明


用了很多年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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM