How to get a stable MAC address for PC?

We use MAC addresses to identify computers licensed to run software. (Do not care about MAC spoofing, licenses are difficult to obtain :) PCs can have several Ethernet controllers (we also don’t worry about the case when it is not there; we did not see such a machine after 5 years), and therefore there is a problem with a reliable choice of a stable one .

I thought we had this nail, but no. We use GetAdaptersInfo from the iphlpapi Microsoft SDK module and go down the list. We use the latest adapter as the supposedly motherboard for an Ethernet controller. Alas, we are faced with the Thinkpad, which appears to change the last controller depending on whether it is docked or not.

Is there a way to reliably find the MAC address for the Ethernet controller motherboard in the system, if one exists? And for those motherboards that have 2 or more, choose one that is stable? [If I knew that the kit was based on the motherboard, I can easily select the MAC address with the lowest address.

+6
licensing nic
source share
5 answers

This is a muddy problem. How do you deal with virtualization? On my machine, I have several Ethernet adapters, only one of which is actually hardware based. And my virtual machines have MAC addresses created using software. And, if I really want to, I can configure several virtual machines on different computers with the same MAC address (of course, not on the same network).

+3
source share

No - there is no reliable way to do this. USB keys are cheap and easy - use them.

I had the “pleasure” of using MAC-locked software before and all I can say is not to do it.

+2
source share

I do not think that there is any reliable way to determine which interface is "stable". Of course, you can not do without equipment parts.

But what if you approached this differently. You can force the user to select an interface from the list during installation, which is probably not very user-friendly. Or simply write down all the MAC addresses in the system and authenticate while it is still active.

Also, for reference, the order that GetAdaptersInfo returns can be changed by the user in the "Advanced Settings" menu in the "Network Connections" section.

+2
source share

I have no solution, but there may be another problem:

There is a VPN software that creates a virtual network card and randomly assigns a new mac address to this card every time a VPN connection is established.

+1
source share

I also ran into the same problem and found a different approach here .

Windows stores the description of physical network cards in the registry at HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows NT \ CurrentVersion \ NetworkCards. The same description is also indicated in the Description element of the IP_ADAPTER_INFO structure. Therefore, I assume that I can check whether this value in the registry indicates whether the MAC address belongs to a physical network card or not.

+1
source share

All Articles