It is well-known that systemd changes the network interface names from e.g. eth0 to enp0s25, and this is called "Predictable Network Interface Names".
On my system, eth0 is called "enp0s31f6".
And I'm sorry to say this, but I too agree with this user that says "I see little irony in word "predictable"" https://askubuntu.com/questions/704361/why-is-my-network-interface-named-enp0s25-instead-of-eth0
Back on topic:
On my system (Debian 9.8 with one physical PCI Ethernet adapter), I suddenly discovered that DHCP doesn't work any longer.
I need to manually run dhclient to get an IP.
Then, I look into /etc/network/interfaces and see:
auto eth0
iface eth0 inet dhcp
Shouldn't this be enp0s31f6?
However, how am I supposed to know what to put there, what if it changes again, e.g. if I move the Ethernet PCI card to a different slot?
Am I really supposed to edit this file manually, and change eth0 to whatever systemd decides to call my interface?
Surely I must be missing some crucial piece of information here regarding how either systemd works, how Debian works, or how Predictable Network Interfaces work. Perhaps a combination of those.
Am I supposed to refer to an abstract network interface in /etc/network/interfaces? Some abstract string that always means "the first network interface card" (isn't this just eth0?)? Or by some UID? By its PCI domain:bus:device?
This is very confusing, and a lot of documentation refers to what I would consider a mess of legacy scripts, modern systemd, and many distros seem to use a combination of old style scripts and systemd functionality which is hard to grasp.
Questions:
Why did it stop working?
What did I do wrong?
Why was it ever eth0 in my /etc/network/interfaces, when Debian uses systemd and Predictable Network Interfaces?
What is the correct way to fix this?
eth0
would show up aseth1
, and vice versa. A machine could be rebooted ten times without a problem, and then suddenly on the eleventh booteth0
andeth1
would be swapped even if no configuration changes had been done to the machine. This is a bigger problem than a card getting renamed when you move a PCI card to a different slot.