I recently temporarily added an additional network card to my system for
testing, thus moving all my interface names about; em0 becomes em1, etc,
necessitating annoying configuration changes and/or cable juggling.
Many Linux distributions solve this problem with /etc/iftab or /etc/mactab,
wiring an interface name to a MAC address so they're no longer dependent on
This patch adds similar functionality to network.subr's ifnet_rename function,
so things like the following can be added to rc.conf:
Also included is a small patch against the rc.conf(5) manpage.
Both patches are against RELENG_7, but should apply relatively cleanly against
It would be nice to have this patch merged as I think it's quite useful :-)
Created attachment 195121 [details]
Patch against CURRENT
Since this hasn't had much love lately, I've done a bit of work to update the network.subr patch against CURRENT so at least there's something new to look at.
This patch changes how it works a little - the original example now looks like this:
Not quite as pretty, but the patch is a fair bit simpler now.
Renaming is still pretty rudimentary - it can't reliably pin, say, "em0", because another interface may already have that name, but one step at a time.
Care also needs to be taken if a system is sharing "ether" across multiple interfaces, e.g. with lagg. hwaddr might be more appropriate in these cases, and this naming scheme helpfully leaves room for that in future.
Can't be in progress without an assignee
I have/use several multi-port NIC's where something like this
would be wonderful to have available. It's now been more than
a decade. Any chance we can get this committed before 2030?
A big thanks to everyone involved -- especially Thomas. :-)
> Any chance we can get this committed before 2030?
Loved that one. Made my day :)
The https://www.freshports.org/sysutils/ethname port is available that performs essentially the same function while waiting for 2030. ;)
Required entries in rc.conf:
What needs to be done to get this merged?
If testing is required I can do some.
One question, has it been tested with lagg(4) interfaces?
Not sure on FreeBSD but on Linux when I had bond0 interface and the scripts 'per interface' had MAC address then they failed because after bond0 was activated/created the network interfaces had MAC addresses changed.
Triage: de-prioritised (this is not a security bug);