0

My ethernet interface changed name from enp6s0 to enp4s0 after a power loss. Something like this has happened before, but don't recall exact details. I modified /etc/netplan/50-cloud-init.yaml to get my ethernet running. How do I prevent this from happening again ? I'm on Ubuntu server 18.04

Edit: 50-cloud-init.yaml file

# This file is generated from information provided by
# the datasource.  Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    ethernets:
        enp4s0:
            addresses: []
            dhcp4: true
            optional: true
    version: 2

Board and bios :

dmidecode -t baseboard
# dmidecode 3.1
Getting SMBIOS data from sysfs.
SMBIOS 3.0.0 present.

Handle 0x0002, DMI type 2, 15 bytes
Base Board Information
        Manufacturer: BIOSTAR Group
        Product Name: TB250-BTC PRO
        Version:
        Serial Number: None
        Asset Tag: None
        Features:
                Board is a hosting board
                Board is replaceable
        Location In Chassis: None
        Chassis Handle: 0x0003
        Type: Motherboard
        Contained Object Handles: 0


dmidecode -s bios-version
5.12
  • Get rid of netplan and use /etc/network/interfaces. Old ways are better. – Gravemind Apr 13 at 6:10
  • Is this a server? How many etherports do you have? Single card with multiple ports? – heynnema Apr 13 at 18:48
  • @Gravemind not very helpful. Servers use netplan. – heynnema Apr 13 at 18:49
  • Very much not helpful. Netplan doesn't cause device names to change unless you tell it to, and /etc/network/interfaces absolutely doesn't have a way of handling devices changing names. – slangasek Apr 13 at 20:39
  • @slangasek my point is - netplan is not the best way for configuring your DebianLike OS network interfaces. – Gravemind Apr 14 at 8:44
1

These network interface names are specifically designed to be persistent and predictable, and not change even if you reinstall your operating system. If this is a physical machine and the device name changed without you moving network hardware within the machine, this sounds like a serious issue that warrants a bug report against the kernel

If this is a virtual machine, then something may have changed in the configuration of your hypervisor, which may be out of your control.

Normally there is no reason to specially handle the possibility of a device name changing because it's not supposed to happen. But netplan does allow you to apply configuration based on matches other than the device name using a device match section. This lets you match on properties such as mac address, or even apply your settings to any device matching a device name glob (such as eth* or en*) which can be useful if you know you will only have one network device but can't be sure its name won't change.

  • This is a physical machine and I haven't moved any network hardware, since I'm using integrated ethernet card. I'm occasionally moving some other hardware tho, peripherals and graphic cards. – John Apr 14 at 14:20
  • You say : These network interface names are specifically designed to be persistent and predictable. What does that exactly mean ? Like in my case my interface is named enp4s0, what these numbers exactly represent ? – John Apr 14 at 14:25
  • @John enp4s0 means ethernet, port 4, slot 0 – heynnema Apr 14 at 14:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.