为什么每次重启时网卡都会重命名? - Ubuntu 20.04 LTS

为什么每次重启时网卡都会重命名? - Ubuntu 20.04 LTS

原来是 enp4s0,现在是 enp10s0,原来是 enp9s0,现在是 enp5s0。

我害怕重新启动,因为这可能会破坏网络,直到我使用 KVM 连接它。

运行 Ubuntu 20.04 LTS。

由于我的 10G 网卡桥接为 br0,因此我不得不将其从 enp4s0 更改为 enp10s0 才能使其正常工作。这是配置,也许我弄错了。论坛将文本视为代码的方式会产生额外的空格,实际上我的 yaml 文件的空格是正确的。

    network:
  ethernets:
    enp10s0:
      dhcp4: no
    enp5s0:
      dhcp4: true
  version: 2
  bridges:
    br0:
      interfaces: [enp10s0]
      addresses: [10.1.1.254/24]
      gateway4: 10.1.1.1
      mtu: 1500
      nameservers:
        addresses: [8.8.8.8]
      parameters:
            stp: true
            forward-delay: 4
  vlans:
    vlan.20:
      id: 20
      link: enp5s0
      addresses: [10.10.10.2/24]

_

#ifconfig | grep enp
enp10s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
enp5s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
# dmesg | grep enp
[    0.512047] igb 0000:0a:00.0 enp10s0: renamed from eth0
[    3.532720] mlx4_core 0000:05:00.0 enp5s0: renamed from eth0
[    5.789093] mlx4_en: enp5s0: Link Up
[  470.823880] mlx4_en: enp5s0: Link Down
[  471.688577] mlx4_en: enp5s0: Link Up
[  990.440296] br0: port 4(enp10s0) entered blocking state
[  990.440297] br0: port 4(enp10s0) entered disabled state
[  990.440336] device enp10s0 entered promiscuous mode
[  990.454325] mlx4_en: enp5s0: Steering Mode 1
[  990.469279] 8021q: adding VLAN 0 to HW filter on device enp5s0
[  990.492621] 8021q: adding VLAN 0 to HW filter on device enp10s0
[  993.472880] igb 0000:0a:00.0 enp10s0: igb: enp10s0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
[  993.688400] IPv6: ADDRCONF(NETDEV_CHANGE): enp10s0: link becomes ready
[  993.688465] br0: port 4(enp10s0) entered blocking state
[  993.688467] br0: port 4(enp10s0) entered listening state
[  997.824093] br0: port 4(enp10s0) entered learning state
[ 1012.928185] br0: port 4(enp10s0) entered forwarding state

答案1

这是因为网络子系统没有与之前的启动硬件匹配。

我使用以下内容来给出一个一致的名称,而不管物理类型如何。

网络:以太网:eth0:dhcp4:false 匹配:macaddress:set-name:eth0 版本:2

相关内容