Renaming network interfaces on linux (easiest way)

Today i was playing with network interfaces on a embedded system and i have to rename some enp2s* interface to the conventional eth1 or similar.

Yes, i could have used the net.ifnames=0 options in /etc/default/grub, but, in that way, the naming will not be deterministic.

So i discovered the easiest way to rename a network interface:

Editing the file /etc/network/interfaces and adding the line:

rename enp2s1=eth1

That’s all! Now reboot your system or just restart the networking service.

The one more thing about this scenario is that this method could coexist with NetworkManager too!

P.S. If you have NetworkManager running, you may need to stop it before restarting the networking service. Or, i repeat, just reboot your system 🙂

Lascia un commento

Il tuo indirizzo email non sarĂ  pubblicato. I campi obbligatori sono contrassegnati *

The maximum upload file size: 30 MB. You can upload: image, audio, video, document, spreadsheet, interactive, text, archive, code, other. Links to YouTube, Facebook, Twitter and other services inserted in the comment text will be automatically embedded. Drop file here