Ubuntu 14.04 server: Change em1 to eth0 – no /etc/udev/rules.d/70-persistent-net.rules file

interfacenetworkingUbuntuudev

I am trying to rename one of my network interfaces from em1 to eth0. I do not have /etc/udev/rules.d/70-persistent-net.rules. I have tried to regenerate this file by running these commands:

udevadm trigger
udevadm trigger --action=add
udevadm trigger --action=change

I tested each command individually, rebooted, looked for the 70-persistent file, before trying the next. None of the commands work, as the file is still not there, even after reboot.

I have also tried manually running the /lib/udev/write_net_rules and I get this error:

Cannot lock /etc/udev/rules.d/70-persistent-net.rules!

This is what is in my /etc/network/interfaces file (nothing else):

auto lo
iface lo inet loopback

My ifconfig output results in no eth0 interface, but I have an em1 interface that I need to change to eth0. I don't know how to do this without re-creating the 70-persistent file. Any help in either recreating this file or changing em1 to eth0, or both, would be greatly appreciated!

Best Answer

EDIT: After a small troubleshooting session with OP I'm modifying the answer to remove the quotes for "biosdevname"

Edit the following lines in /etc/default/grub:

GRUB_CMDLINE_LINUX_DEFAULT=""
GRUB_CMDLINE_LINUX=""

To:

GRUB_CMDLINE_LINUX_DEFAULT=biosdevname=0
GRUB_CMDLINE_LINUX=biosdevname=0

Next, run sudo update-grub and then reboot.

After this, you should have the udev rules persisted in /etc/udev/rules.d/70-persistent-net.rules and you can edit them as necessary.

Make sure you're changing the right interface by comparing MAC address information properly, e.g. via ifconfig -a.

Related Question