Rename Ethernet interfaces to eth0

systemd in Debian & Ubuntu generates robust Ethernet interface names like p1p1 or enp48a instead of the traditional eth0 to avoid race conditions.

Robust systemd eth0 | wlan0

  1. create a file /etc/systemd/network/10-eth0.link with the content, using your Raspberry Pi MAC address obtained from ip a:
    [Match]
    MACAddress=00:11:22:33:44:55
    
    [Link]
    Name=eth0
    
  2. ensure the file /etc/systemd/network/99-default.link exists with the content
    [Link]
    NamePolicy=kernel database onboard slot path
    MACAddressPolicy=persistent
    

I find this method more intuitive than using udev rules, which is another alternative method.

Alternative GRUB

This method is simpler, but does not work on non-GRUB hardware (e.g. ARM systems like Raspberry Pi).

  1. edit /etc/default/grub:
    GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0"
    
  2. in Terminal,
    update-grub
    
  3. reboot
  4. type
    ip a
    

    to confirm your network adapter is at eth0

Notes

When is eth0 name needed? Some old software (e.g. old Matlab versions) will only accept eth0 for licensing using the MAC address (low security!) Also sometimes for convenience in embedded/IoT systems where you know you’ll only have one Ethernet interface, you’d like to simply use eth0.

Discussion

Which software have you found it necessary to use this procedure for? Let us know in the comments below.

Tags:

Categories:

Updated:

Leave a Comment