:: home : bio : blog : art
My copy of Alexej Von Jawlensky "Girl with Red Ribbon", oil, 2024 (detail)
September
Sun Mon Tue Wed Thu Fri Sat
         
6

Contact


 

Archives

Recent Posts

Wed, 06 Sep 2023
WILL: Naming My Ethernet Device
# 15:24 in ./tech

My server has USB 2.0 only and I thought I'd upgrade it to USB 3.0 via a Startech USB 3.0 PCI card. Installation was straightforward but after restarting the computer I discovered my networking was broken.

It turns out that my ethernet device used to be enp2s0 but was now enp3s0 and my network setup failed.

This type of kernel device name is created based on various schemes e.g. the physical location of the connector of the hardware on the PCI bus. See the Redhat Docs.

I've been using Linux for many years now and computers have changed a lot in this time. Leaving aside the huge advances in CPU, RAM and storage, many computer devices are not "fixed" in place but can come and go (even CPU's and RAM). Mostly, these devices might get plugged in or out, such as a USB mouse or external USB hard drive. PCI devices are also capable of being "hotplugged" and when any of this happens, the kernel has to scan the new configuration and determine what devices are present. Sometimes it has to re-arrange the device names.

My server is an old HP Microserver (N36L) : 12 years old now but still going strong (although it needed a new power supply last year). Because I use an external USB disk for backup, USB 3.0 will speed things up a lot (I hope). On to the reboot and networking failure ...

To fix this, I could just change my ethernet device name in my network setup files (i.e. /etc/network/interfaces on Debian). I decided to use systemd and create my own persistent and simple (old-fashioned) name for the device.

Systemd Link

This is "link" as in a network link (man page : systemd.link).

Use :

ip l

to get the MAC address for the network device enp3s0. Then create the file :

/etc/systemd/network/10-eth0.link

The file must end with ".link" and preferably begin with numbers (as a run order). It contains :

[Match]
MACAddress=<YOUR MAC ADDRESS>

[Link]
Name=eth0

I edited my network setup scripts (Debian : /etc/network/interfaces) to use the network name "eth0". Now, when I boot the system, the name "eth0" is set on the network device with my main ethernet MAC address and will stay that way.

I must add that I like systemd and how it's changed the Linux boot and system control landscape.


© Alastair Sherringham 2023
Powered by Blosxom.
Still going after all these years.