Ethernet interface IDs change and break network

Lambda Blade, Ubuntu 18.04 and Ubuntu 20.04

The ID of our primary ethernet interface frequently changes after a software update, adding a GPU, etc. The result is that DHCP is not used and there is no network connectivity. Running sudo dhclient -r; sudo dhclient fixes it until the next reboot but that is just a temporary fix.

How can we configure things so that the interfaces always use DHCP at startup? Currently, the file /etc/netplan/01-netcfg.yaml looks like this:

  version: 2
  renderer: networkd
      dhcp4: true
      dhcp4: true
      dhcp4: true

We are only using one interface, but every time a new interface ID shows up, we add it to this file to try to catch it next time. This is obviously just a hack and is not robust. What is the right way to do this?

This name change is because of the way SystemD enumerates devices - I’m not sure why this would be the intended behavior.
Put the following in /etc/udevd/rules.d/10-ethernet.rules:

SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="01:23:45:67:89:ab", NAME="eth1"

The address above will be the MAC of the NIC, and eth1 will be the name you want to give it.

Hope that helps :slight_smile: