Web lists-archives.com

Re: Enet names




Glenn English, onb 2019-01-25 :
> Buster, computer with MAC identified Ethernet ports
>
> Is there a way to relabel Ethernet ports? Without changing things in a
> number of config files?
>
> I see on the web that changing udev used to do that, but now there are
> at least 2 files to modify.
>
> I'm gently moving to a new ISP, and I'm trying to set up new, virtual IP
> addresses on my Enet ports. Webmin tells me that enp0s31f6 is too long.
> I could do it in /etc/network/interfaces, but Webmin does all that quite
> painlessly. Without typos.
>
> I'd like to replace the /dev/random names with something understandable
> to a mortal.

Good Day Glenn,

Disclaimer: if the machine is remote, be very careful when
fiddling with network interfaces, you could lock yourself out.
Now, if it's a more local machine, like your laptop, then let's
proceed.  :^)

If you are trying to say that you wish to go back to the ethN
network interface naming convention, then one way to do it is
enable it at boot time, using kernel command line option
"net.ifnames=0".

To set this option on each reboot, edit /etc/default/grub to put
it in your GRUB_CMDLINE_LINUX:

	GRUB_CMDLINE_LINUX="net.ifnames=0"

Then update your Grub entries, reboot and enjoy (don't forget to
reconfigure your network interfaces, to take the new name in
account):

	$ sudo update-grub
	$ sudo reboot

This is something I used recently, when so called predictable
interface names have proved to cause issues with some Digital
Handcu^H^H^H^H^H^H Right Management software.  One file is to be
modified and one command to run, faster, easier, more dangerous
perhaps.


Now the interesting part, if you want to reliably identify your
network interfaces, I'll just shamelessly copy and paste this
example extracted from systemd.link(5) which sounds a lot like
something I would have loved to stumble upon earlier :
>      Example 2. /etc/systemd/network/10-dmz.link
>
>      This example assigns the fixed name "dmz0" to the
>      interface with the MAC address 00:a0:de:63:7a:e6:
>
>          [Match]
>          MACAddress=00:a0:de:63:7a:e6
>
>          [Link]
>          Name=dmz0

Have just had the occasion to test this, and worked like a charm
to rename my enp354f21s2p3wtf to if0. Sounds like the end result
could be interesting to you.  Even though it's systemd, it
sounds clearer than udev rules and moving to sysvinit (or any
other init of your choice).

Kind Regards,
-- 
Étienne Mollier <etienne.mollier@xxxxxxxxxx>