2

I'm trying to figure out how to restore the simple interface names in Ubuntu 16.04. I.e. enp3s0 renamed to eth0.

  • I have tried to modify the GRUB configuration. I have tried editing /etc/udev/rules.d/10-network.rules, but both methods did nothing for me. Help is greatly appreciated.

    /etc/udev/rules.d/10-network.rules: (I hid the mac address names.)

    SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="XX:XX:XX:XX:XX:XX″,KERNEL=="enp0s0″, NAME="eth0″
    SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="XX:XX:XX:XX:XX:XX″,KERNEL=="wlx02c5c1866772″, NAME="wlan0″
    
  • And I changed this line in the GRUB configuration (/etc/default/grub) ...

    GRUB_CMDLINE_LINUX=""
    

    to look like this:

    GRUB_CMDLINE_LINUX="net.ifnames=1"
    
user.dz
  • 48,105
  • 1
    Check this out https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/. Looks complicated indeed. – mikewhatever Jun 11 '16 at 21:26
  • Is this a virtualbox or real machine? If it is real what's the brand/model? Are you running in UEFI mode or BIOS legacy ? – user.dz Jun 17 '16 at 18:02

1 Answers1

2

Tested on VBox with Ubuntu 16.04, enp0s3eth0

Option 1:

  1. Override udev rule

    sudo ln -s /dev/null /etc/udev/rules.d/80-net-setup-link.rules
    
  2. Update RAMDisk

    sudo update-initramfs -u
    

Option 2:

  1. Create a systemd link file

    sudo vim /etc/systemd/network/10-eth.link
    
  2. Let's define name related to MAC: (There are many options, see the linked reference)

    [Match]
    MACAddress=08:00:27:de:dd:4c
    
    [Link]
    Name=eth0
    
  3. Update RAMDisk

    sudo update-initramfs -u
    

Option 3:

  1. Add net.ifnames=0 to boot parameters

    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash net.ifnames=0"
    
  2. Update grub

    sudo update-grub
    

Reference: systemd: Predictable Network Interface Names, Thanks @mikewhatever .

poige
  • 342
user.dz
  • 48,105
  • 1
    Option 2 appears to be the most resilient to upgrades because it only makes changes to the network devices you're concerned about. Option 1 and 3 both have side-effects that may change other devices/interfaces. However, I can't seem to get option 2 to work after a 14.04.3 to 16.04 upgrade. I may be missing a systemd service. dmesg lists the interfaces being renamed from ethX to enpXsY but not back again so I suspect a systemd service is needed to be enable for option2 to work. To be clear, I'm doing option 2 in isolation. Do you have any idea what service is required for option 2? – tudor -Reinstate Monica- Aug 15 '16 at 02:57
  • @tudor, I think this is the related /lib/udev/rules.d/80-net-setup-link.rules, seems systemd using a udev rule actually as explained here (man systemd.link) https://www.freedesktop.org/software/systemd/man/systemd.link.html . and the next seems also related for boot parameter option3: /lib/udev/rules.d/73-usb-net-by-mac.rules – user.dz Aug 15 '16 at 05:04
  • 1
    I've corrected Option 2 cause it doesn't work the way you thought it did. Try using different name, say, eth5 and you'll realise that eth0 is just default name you get if you don't run update-initramfs -u – poige Mar 08 '19 at 08:09