I've put together a rc.d script  for renaming ethernet devices at boot time, keeping MAC address <-> devname mappings consistent.
This isn't typically needed on PCIe systems, but for systems with multiple USB ethernet (ue) devices, which seem to like to come up in non-deterministic order, it is very helpful; doubly so when the system in question is a router / firewall where the network config and security concerns vary wildly from one device to the next.
It could also be of use for traditional NICs (PCIe) when adding a new card to a system, for example, and ensuring that the existing, previously configured device sticks to the MAC address, and not having to worry about which ends up /dev/xxxN vs /dev/xxxM.
The script inserts itself before netif, waits an adjustable delay for the expected devices to appear, and then renames them as requested by the user. All of the device configuration, pf, etc., can be written with the new names. It does not attempt to automatically handle devices added after boot.
Perhaps there is some other (pre-existing) way to handle this, but all of the Google-fu I've thrown at it returns "you could write a script to rename then at boot" ... so I did. If there is a simple knob I've missed, please point me at it close this at.
It came up recently  in freebsd-stable, and a suggestion was made to file a PR for either base / port inclusion, so here we are.
Having never gone through the process here before, please let me know if there are any changes I can make on my end to accommodate this. As the installation is placement of a single rc.d script, I don't have any installation scripts currently in place.
Would you like this as a port or would you prefer this in base?
My initial reaction would be ports. If enough people use it and decide it's the best thing since sliced bread, it can always be moved into base.
That said, I'll defer to your judgement.
This tool was mentioned on the BSDNow podcast. Alan mentioned in passing avoiding a config file and doing it all in rc. Seemed like a good idea, so I did it.
See also my PR from 2007, trying to get similar functionality in base: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=118111
There I added to the existing /etc/network.subr ifnet_rename() function, which is called from /etc/rc.d/netif start.
I'll take a look at it. Thanks!
Hi! Thanks for the ping. This one slipped through the cracks.
If the desire is to move this functionality into base, Thomas's patch in bug #118111 is likely the right way to go -- integrated as part of netif, as opposed to a precursor to netif.
What is the status of this one?
I'm in the exact same situation as Thomas Hurst in bug #18111.
I've just updated #118111 with a patch that applies against CURRENT.
I've updated ethname to have a more succinct configuration:
Will make sure the ethernet device with the matching MAC will be named 'external'.