在 Debian 下如何固定网卡名称?
<p>有一台主机,安装了 Proxmox (基于 Debian ),每次添加 /删除硬件的时候网卡名称总是会变,比如<code>enp3s0</code>变到<code>enp2s0</code>,导致必须手动修改<code>/etc/networking/interface</code>并重新启动网络服务。请问有什么办法可以固定这个名称呢?谢谢</p>
<p>我搜到的文章( <a href="https://www.itzgeek.com/how-tos/linux/debian/change-default-network-name-ens33-to-old-eth0-on-debian-9.html" rel="nofollow">https://www.itzgeek.com/how-tos/linux/debian/change-default-network-name-ens33-to-old-eth0-on-debian-9.html</a> )是将网卡名称固定为 eth0 ,但是我有三个网卡,想为每个网卡指定特殊的名字。</p>
收藏(0)
分享
相关标签:
注意:本文归作者所有,未经作者允许,不得转载
-
2022年9月9日 20:41
Found it
0
0
-
2022年9月10日 00:12
标准做法是 udev ,匹配网卡的 MAC 地址然后重命名
```
# vi /etc/udev/rules.d/70-persistent-net.rules
# PCI device 0x8086:0x10f7 (ixgbe)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:1b:21:da:73:d9", ATTR{type}=="1", KERNEL=="eth*", NAME="eth7"
# PCI device 0x8086:0x105e (e1000e)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:00:c9:df:c4:47", ATTR{type}=="1", KERNEL=="eth*", NAME="eth9"
```
0
0
-
2022年9月10日 02:43
FYI:
0
0
-
2022年9月10日 06:43
pci 上一级是不会变的,不要按照网卡的来。
0
0