19

I know this question is similar to "Udev : renaming my network interface", but I do not consider it a duplicate because my interface is not named via a udev rule, and none of the other answers in that question worked for me.

So I have one WiFi adapter on this laptop machine, and I would like to rename the interface from wlp5s0 to 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

However, there are no rules for this interface in 70-persistent-net.rules or any of the other files in the /etc/udev/rules.d/ directory.

Is there any way that I can rename this interface?

1

2 Answers 2

23

Choose a solution:

  1. ip link set wlp5s0 name wlan0 - not permanent
  2. create yourself an udev rule file in /etc/udev/rules.d - permanent
  3. add net.ifnames=0 kernel parameter into grub.cfg - permanent, if your distro won't overwrite it.
3
  • I never knew you could rename an interface using the "ip" utility, worked great! I'll try the net.ifnames=0 boot parameter to make it permanent. Thanks!
    – Gogeta70
    Commented Oct 27, 2017 at 16:45
  • 1
    solution 1. while eventually generating a sane (memorizable) name, already requires one to go the length to lookup the "predictable name" (thanks systemd), which changes upon inserting usb dongle in a different port. solution 2 is a stub, and solution 3 disables the systemd alias altogethe. Is there no way to keep the contorted systemd permanent name + and still have a sane alias like wlan0? Commented Feb 2, 2019 at 15:22
  • For convenience It's better to add #3 to /etc/default/grub GRUB_CMDLINE_LINUX instead so it will always be effective for all linux boot options .
    – elig
    Commented Jul 16, 2020 at 7:24
2

On Linux Mint 18:

cat /etc/udev/rules.d/70-persistent-net.rules

says in comment:

This file was automatically generated by the /lib/udev/write_net_rules program, run by the persistent-net-generator.rules rules file.

You can modify it, as long as you keep each rule on a single line, and change only the value of the NAME= key.

So, I suppose, just change the NAME key to your liking.

2
  • Yeah, mine has the same on the top. The problem is that there is only one line in that file, for the eth0 interface. I can't change a rule that doesn't exist.
    – Gogeta70
    Commented Oct 27, 2017 at 16:05
  • @Gogeta70 Strange, I have both wlan and eth there. Nevermind, then. Commented Oct 27, 2017 at 16:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .