重命名我的 wlan 网络接口

Gog*_*a70 14 wifi udev

我知道这个问题类似于“ Udev:重命名我的网络接口”,但我不认为它是重复的,因为我的接口不是通过 udev 规则命名的,并且该问题中的其他答案都不适用于我。

所以我在这台笔记本电脑上有一个 WiFi 适配器,我想将接口从 wlp5s0 重命名为 wlan0:

root@aj-laptop:/etc/udev/rules.d# iwconfig
wlp5s0    IEEE 802.11  ESSID:off/any  
          Mode:Managed  Access Point: Not-Associated   Tx-Power=off   
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:on

eth0      no wireless extensions.

lo        no wireless extensions.

root@aj-laptop:/etc/udev/rules.d# ifconfig wlp5s0
wlp5s0: flags=4098<BROADCAST,MULTICAST>  mtu 1500
        ether 00:80:34:1f:d8:3f  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
Run Code Online (Sandbox Code Playgroud)

但是,在 70-persistent-net.rules 或 /etc/udev/rules.d/ 目录中的任何其他文件中没有针对此接口的规则。

有什么办法可以重命名这个接口吗?

Ipo*_*cer 19

选择一个解决方案:

  1. ip link set wlp5s0 name wlan0 - 不是永久性的
  2. 为自己创建一个 udev 规则文件/etc/udev/rules.d- 永久
  3. net.ifnames=0内核参数添加到 grub.cfg - 永久,如果您的发行版不会覆盖它。