Ethernet Interface Naming With Systemd


Systemd has a new way of specifying names for Ethernet interfaces as documented in 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

Below is a little shell script I wrote to convert a basic 70-persistent-net.rules (that only matches on MAC address) to files.



for n in $(grep ^SUB $RULES|sed -e s/^.*NAME..// -e s/.$//) ; do
  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

3 thoughts on “Ethernet Interface Naming With Systemd”

  1. Elessar says:

    System is now starting to replace Udev rules as well‽ Will it ever stop?

  2. aL says:

    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)

  3. pywy says:

    Hi, could you show how before and after files look like ?
    Would be great!

Comments are closed.