3

I am working with Digital Ocean and their help team is unable after over a dozen emails to help me register the network on a VPS spun up from their backup image. Their instructions to try to change grub so a network device showing as ens3 will show as eth0 are not working. I need to stop it from being renamed as ens3 so I can follow their instructions for configuring the eth0 as a static IP.

$ dmesg | grep -i eth
[     8.676459] virtio_net virtio0 ens3: renamed from eth0

The output from

$ ip addr show

enter image description here

Their instructions that I have completed without errors from grub were:

  1. Open the file "/etc/default/grub.d/50-cloudimg-settings.cfg" with your favorite text editor, such as vim. Look for the line that says "GRUB_CMDLINE_LINUX_DEFAULT" and add "net.ifnames=0" at the end of the line, within the quotations. It should look like this afterward:

    GRUB_CMDLINE_LINUX_DEFAULT="console=tty1 console=ttyS0 net.ifnames=0"

  2. Save and close the file

  3. Update GRUB with the new settings and reboot the Droplet by running these commands:

    $ update-grub

    $ reboot

I have done that, and also followed similar instructions again without success at https://www.itzgeek.com/how-tos/mini-howtos/change-default-network-name-ens33-to-old-eth0-on-ubuntu-16-04.html

Edit: based on comments especially from @Terrance and also @Stephen Boston, this file seems likely problematic, but I am not sure what to change it to:

 $ cat /etc/udev/rules.d/70-persistent-net.rules
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="72:9d:39:b5:f6:ef", NAME="ens3"

(There are no other files in that dir.)

Is the ATTR the MAC address? The value in this file is the one that showed up above in ip addr show for ens3. How would I determine what it should be. Question: Is the single = after NAME instead of double == causing a problem?

Once I get ens3 to be just eth0 I think the rest is simple. (FWIW whereis netplan shows no results, there is no /etc/netplan directory and I am not really a sysadmin.)

5
  • Does this help? serverfault.com/questions/601483/… Apr 21, 2021 at 21:30
  • Is there a /etc/udev/rules.d/ folder? I wonder if there is a 70-persistent file in there setting it to another name with maybe the wrong MAC.
    – Terrance
    Apr 21, 2021 at 22:33
  • Also, I came across this gem: askubuntu.com/questions/1317036/…
    – KGIII
    Apr 21, 2021 at 22:59
  • @KGIII, there is no /etc/netplan directory which I think is related to the troubles somehow. This is an image for a server that seems to have had an OS upgrade (or two??), or maybe Digital Ocean has its own build (I'm just trying to recover some stuff from a backup as part of a short assignment).
    – Joe Murray
    Apr 24, 2021 at 15:51
  • add eth0 alias to /etc/netplan
    – petep
    Dec 9, 2023 at 2:43

1 Answer 1

0
mkdir -p /etc/systemd/network && ln -s /dev/null /etc/systemd/network/99-default.link

In v197 systemd introduced Predictable Network Interface Names to ensure that any specific interface always gets the same name assigned at boot. This is controlled by /usr/lib/systemd/network/99-default.link, which can be "masked" (overriden) with the command above.

2
  • Thanks @Bachsau for providing an answer to this old question that may help others. The instance no longer exists so I cannot determine if your answer would have solved the problem.
    – Joe Murray
    Dec 7, 2023 at 9:35
  • @JoeMurray This is how it works on all modern systems. I edited the answer to provide some context. Ubuntu had been using the 70-persistent-net.rules before to preserve the names of interfaces it had already seen, but no longer. It's better to understand how things work and why, instead of just trying a bunch of suggested solutions until you get lucky and then forget about it.
    – Bachsau
    Dec 8, 2023 at 19:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .