For whimsy, or for whatever reasons you dream up, you may want to rename your network adapters in Linux. Well, you can. This article will explain how to rename your network adapters, from perhaps eth0 to whatever you want.
I can only be certain that this works in current Ubuntu LTS – 20.04, I didn’t test with any other distros. It’s pretty safe to assume that it will work with most distros out there.
Notably, I am just pulling this from my notes. I forgot why this is in my notes and I really can’t think of too many reasons why you’d need to rename your network adapters. Still, there’s at least one person who needed to know this information, else it’d probably have not been in my notes. It’ll almost certainly work with Debian, Mint, Pop!_OS, and others in that family of operating systems.
This article should be fairly short and will suggest the use of ‘inxi‘. As this article is based around Ubuntu, you can go ahead and install it with:
1 | sudo apt install inxi |
It’s a lightweight application that spits out a ton of information. I think it should be installed by default, but not all distros do. If you’re trying this with a non-Ubuntu distro, and one without apt, just adjust the installation method for your package management system. It’s almost certainly in your default repositories.
Rename Your Network Adapters:
The first thing you’re going to need to do is open your terminal. If you just installed inxi, you may well have your terminal already open. If not, you can open it with your keyboard. Just press
Once you have the terminal open, we’re going to use ‘inxi’ to get some information. The command you’re looking for is:
1 | inxi -v 4 |
Specifically, you’re looking for the networking section. It should look a little something like this picture:
You’re looking for the name of the adapter and the MAC address. You’ll want both of those bits of information, so you might as well keep that terminal open and open up another one. That’ll be easiest, as you can then just copy and paste the data in the next step.
Now, you need to create and edit a file. We can more or less do this with a single step. In the 2nd terminal, use this command:
1 | sudo nano /etc/udev/rules.d/70-persistent-net.rules |
Once that is open, you want to add some text to it. This is the template:
1 | SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="<mac_address>", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="<device_name>*", NAME="<new_name>" |
Now, to use that template, you insert the MAC address that you got from the inxi command where you see <mac_address>.
The <device_name> is a bit more tricky. It’s usually the first three letters – and don’t forget to leave the asterisk there. So, if you use my image above, you’ll see it’s wlo1. To change it, you’d just use ‘wlo*’. If it’s ‘eth0’ for your network adapter then you’d change it to ‘eth*’ being careful in all instances to keep the asterisk.
The last field to change is the name. You can stick anything you want in that field. So, for me, the command will look like this:
1 | SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="8c:8d:28:de:78:1c", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="wlo*", NAME="booger" |
Yes, yes I really did name it booger. I’m pretty much a giant five year old.
When you’re done, save it. Just press
That’s it! Just reboot and you should see that you managed to successfully rename your network adapter. If it doesn’t work, double-check to make sure you got the device name and MAC address correct and reboot again. Done successfully, it looks like this:
See? It works!
Closure:
Again, I’ve only tested it in Ubuntu – so it’ll likely work with any Ubuntu derivative, should work for Debian, and will probably work with any other mainstream distro. I forget why it was in my notes, but I’m sure it was useful for someone. Maybe they just needed a name they could recall a bit easier, perhaps for their wireless connection and they wanted to connect to it in the terminal instead of keeping it always connected? I dunno… It was in my notes, it’s now online.
Either way, there’s another article. Thanks for reading! If you want to help, you can donate, register, write an article, or buy cheap hosting. When you scroll down, you can comment, vote for the article, or sign up for the newsletter. Should you sign up for the newsletter, I won’t share your information with anyone else and I won’t send you any spam.