So I have run into the common problem of eth0 being called something else (enpXsX) with systemd. So I have tried creating the file /etc/udev/rules.d/10-network.rules. That works just fine. The problem is that I need to take this exact copy of my server and using an SD card move it between several physical servers on a regular basis for testing. Because 10-network.rules needs the MAC address, it keeps changing everytime I plug the card into a new device. I have created a script that changes it automatically and I have it run as a service (changeMAC.service) on boot up.

This service runs fine. Unfortunately despite changing the MAC address before networking.service starts, networking always fails. To make it work, I have to reboot. I need it to start up correctly on the first boot.

Using systemd-analyze plot, I can tell changeMAC.service is in fact completing before networking.service. I thought the problem might be that it needs to start sooner. However I currently have one SD card where it does manage to start up in one go. But when I take that image and put it on my computer to run in VirtualBox, it goes back to needing a reboot. I can't find the differences between the SD card and the vhd.

I have also tried using ifup, ifdown, /etc/init.d/networking restart, systemctl start networking.service to force networking to reevaluate its situation and see 10-network.rules. The first three produce errors and won't execute, the last will execute but networking.service will again fail to start.

So I need to know either how to get changeMAC.service to run in time so that whoever needs 10-network.rules can get it, or I need to know how to force whoever needs 10-network.rules to restart without rebooting the whole system.

  • 1
    Why don't you just set the GRUB_CMDLINE_LINUX_DEFAULT in /etc/default/grub to GRUB_CMDLINE_LINUX_DEFAULT="net.ifnames=0" that way you don't have to worry about having a 10-network.rules file. You can keep other options on that line as well. After changing that line, update the grub sudo update-grub – Terrance Jan 3 '17 at 15:42
  • That worked. I have no idea why I didn't see that answer before somewhere. Thank you very much. – khm Jan 3 '17 at 15:50
  • I am going to write that as an answer for you that can help others. – Terrance Jan 3 '17 at 16:29

You can add an option to GRUB_CMDLINE_LINUX_DEFAULT in /etc/default/grub to turn off the predictive names.


and you can keep the other options on that line. This way you don't have to worry about having a 10-network.rules file with set MAC Addresses in them.

Make sure that you update the grub after modifying that line before you reboot the host.

sudo update-grub

Hope this helps!

| improve this answer | |

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.