Hi Alex,
I set up a VM to test the ‘before udev’ approach with IPFire and was able to get it working. Details follow.
The test machine that I set up was a VM with 2 nics and IPFire installed, nothing special and no actual connections to the outside world.
So the first thing that I did was “Information Gathering”. I went to the “/etc/rc.d/rcsysinit.d” directory and installed some debug scripts. Note that in some of the screen shots I’m using “:” (colon) bash command for inline comments.
After the reboot, I get dropped to bash when rcsysinit is running.
So time to do some detective work. Let’s find out what the kernel assigned my nics to and the current mac addresses of the nics…
Right now, my nics are eth0 and eth1 with mac addresses 08:00:27:6b:36:a9 and 08:00:27:cd:49:0a. And those are the same mac addresses that I set for red0 and green0 when I did the command line setup installing IPFire.
So let’s change those to 08:00:27:aa:aa:aa for eth0 and 08:00:27:bb:bb:bb for eth1.
And check the changes.
Now the mac addresses are the ones that we want, let’s exit bash and continue to boot.
S10udev just ran and we got dropped back into bash by the S11bashdebug, so let’s see what we have.
The mac addresses are changed, but red0 and green0 did not get assigned. That’s because ‘/var/ipfire/ethernet/settings’ don’t match the new IP addresses of the adapters. We’ll need to fix that but can’t here because we are in the middle of a boot and the root partition is mounted read-only. So let’s ‘exit’ bash to continue the boot and get back to the console.
Back at the console we can see that the mac addresses are what we want, but red0 and green0 are not assigned the way that we want them to be.
So first, let’s persist the mac address changes that we made by putting those changes in a script for rcsysinit. I created a file ‘S09macchange’ with the ‘ip link’ commands in ‘/etc/rc.d/rcsysinit’ and made it executable. I used ‘echo’ commands to create the file here for display purposes.
And now I have to change ‘/var/ipfire/ethernet/settings’ to match the IP addresses that I want. Here are the results of that.
Before I reboot and see if this all works, I want to add another bashdebug checkpoint so that I can check before and after the ‘ip link’ commands run. So I copy the S09bashdebug file to S09zbashdebug.
Since the scripts get run in name order, when I reboot, they will get run in this order.
So ready to reboot, let’s see what happens.
On reboot, I get dropped to the first bash checkpoint as expected and do some checking.
Mac changes worked, next udev has to pick those changes up when assigning red0 and green0 so let’s exit this checkpoint and see what happens when udev runs.
Now after udev runs we have red0 and green0 interfaces so this worked for the test VM. For cleanup, delete the ‘S*bashdebug’ files from ‘/etc/rc.d/rcsysinit’ so that boot flows cleanly.
Gotta have a direct console to do this, can’t do it all over ssh, but maybe would work for you.
Stephen