Does anyone know if there is a way to determine what a network interface will be called in NetBSD if you know which NIC/driver you will be using before hand?

I'm trying to automate parts of a NetBSD set-up for a variety of different machines and would like to write an /etc/ifconfig.xx file but never know what the 'xx' part will be. I know that, for example, my Intel NIC uses 'wm' as the suffix, but where does NetBSD get that information from?


No, you cannot know beforehand what driver will be attached for some mystery hardware configuration. Of course if you're working from a hardware inventory of known configurations and you have pre-determined what what driver will be used for each type of interface in your known systems, then it's pretty deterministic.

On the other hand as the system is booting, or after first boot, the list of known interfaces is given by the command ifconfig -l.

Of course that still doesn't tell you which interface has an ethernet cable plugged into it, e.g. if your system has multiple interfaces on the motherboard, or multiple ethernet cards installed, or a multi-port card, etc. Some interfaces come up automatically though whenever they negotiate a connection with the switch/hub/whatever and if so then ifconfig -a will show you all the information about all known interfaces, including which one(s) is(are) active and what media they are using (the status: and media: lines, respectively).

However, if your target environment uses DHCP to assign addresses then you can usually get away with just using the following line in /etc/rc.conf


as by default it will try to ask for an address on each available (broadcast-capable) interface.


I think you could either use dhcpd.conf or some post-boot ifconfig(8) scripting to reassign the interfaces by referencing their hardware MAC addresses which will be unique even if you're using multiple identical NICs. It would be nice to be able to reference the MAC addresses instead of the XXn interface names but ifconfig(8) doesn't appear to have that option.


I thought NetBSD probing this via usage of Vendor- and PCI-ID. Maybe pcidevs.h and pcidevs_data.h is helpful for you.

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.