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.