Ethernet Interface Naming With Systemd
Systemd has a new way of specifying names for Ethernet interfaces as documented in systemd.link(5). The Debian package should keep working with the old 70-persistent-net.rules file, but I had a problem with this that forced me to learn about systemd.link(5).
Below is a little shell script I wrote to convert a basic 70-persistent-net.rules (that only matches on MAC address) to systemd.link files.
#!/bin/bash
RULES=/etc/udev/rules.d/70-persistent-net.rules
for n in $(grep ^SUB $RULES|sed -e s/^.*NAME..// -e s/.$//) ; do
NAME=/etc/systemd/network/10-$n.link
LINE=$(grep $n $RULES)
MAC=$(echo $LINE|sed -e s/^.*address….// -e s/…ATTR.*$//)
echo "[Match]" > $NAME
echo "MACAddress=$MAC" >> $NAME
echo "[Link]" >> $NAME
echo "Name=$n" >> $NAME
done
Related posts:
- Ethernet Interface Naming As far as I recall the standard for naming Linux...
- Maintaining Screen Output In my post about getting started with KVM I noted...
- Ethernet bonding Bonding is one of the terms used to describe multiple...
- Ethernet Bonding on Debian Etch I have previously blogged about Ethernet bonding on Red Hat...
- systemd – a Replacement for init etc The systemd projecct is an interesting concept for replacing init...
3 thoughts on “Ethernet Interface Naming With Systemd”
Comments are closed.
System is now starting to replace Udev rules as well‽ Will it ever stop?
I would like this kind of things being done automatically on upgrade if I havent touched anything manually (no file in /etc/systemd/network for example)
Hi, could you show how before and after files look like ?
Would be great!