Ubuntu 16.04 Complicated Interface Names
Tested on VBox with Ubuntu 16.04, enp0s3
→ eth0
Option 1:
-
Override udev rule
sudo ln -s /dev/null /etc/udev/rules.d/80-net-setup-link.rules
-
Update RAMDisk
sudo update-initramfs -u
Option 2:
-
Create a systemd link file
sudo vim /etc/systemd/network/10-eth.link
-
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
-
Update RAMDisk
sudo update-initramfs -u
Option 3:
-
Add
net.ifnames=0
to boot parametersGRUB_CMDLINE_LINUX_DEFAULT="quiet splash net.ifnames=0"
-
Update grub
sudo update-grub
Reference: systemd: Predictable Network Interface Names, Thanks @mikewhatever .
Related videos on Youtube
Faith Skater
Updated on September 18, 2022Comments
-
Faith Skater over 1 year
I'm trying to figure out how to restore the simple interface names in Ubuntu 16.04. I.e.
enp3s0
renamed toeth0
.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"
-
mikewhatever almost 8 yearsCheck this out freedesktop.org/wiki/Software/systemd/…. Looks complicated indeed.
-
user.dz almost 8 yearsIs this a virtualbox or real machine? If it is real what's the brand/model? Are you running in UEFI mode or BIOS legacy ?
-
tudor -Reinstate Monica- over 7 yearsOption 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? -
user.dz over 7 years@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
) 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
-
poige about 5 yearsI'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 runupdate-initramfs -u