How to get a stable MAC address for PC?
Asked Answered
L

5

6

We are using MAC addresses to identify PCs as licensed to run software. (Don't care about MAC spoofing; licenses are hard to get :) PCs may have multiple Ethernet controllers (we also don't worry about the case where there isn't one; we haven't met such a machine in 5 years), and so there's a problem with reliably choosing a stable one.

I thought we had this nailed but apparantly not. We use GetAdaptersInfo from the Microsoft SDK iphlpapi module, and walk down the list. We use the last adapter in the as presumably it is the motherboard Ethernet controller. Alas, we've run into a Thinkpad that appears to change which controller is last depending on whether it is docked or not.

Is there a way to reliably find the MAC address for the motherboard Ethernet controller on a system, if it exists? And for those motherboards that have 2 or more, choose one of them that is stable? [If I knew that a set were motherboard-based, I can easily pick the lowest address MAC].

Larimor answered 29/8, 2009 at 11:52 Comment(0)
P
3

It's a muddy issue. 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 all have software-generated MAC addresses. And, if I really want to, I can set up multiple VMs on different computers with the same MAC address (not on the same network, of course).

Possession answered 29/8, 2009 at 12:12 Comment(1)
Agreed, it's not a wise licensing method. The OP should implement another system.Molten
C
2

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

I have had the "pleasure" of using MAC locked software before and all I can say is don't do it.

Carnify answered 29/8, 2009 at 12:9 Comment(3)
Agree. If we evalauted this software (adn several virtual environments), we'd reject this because of an inane MAC licensing system...Hemo
I've had the pleasure myself. In my case, the software chose a "virtual" MAC address created by a VPN software. Guess what happened when I uninstalled the VPN software?Ergocalciferol
Dongles aren't practical for $100 products (of which we have a variety). They work for $1000.00 products (of which we have a few).Larimor
D
2

I don't think that there is any reliable way to determine which interface is "stable". Certainly not without digging down into the hardware details.

But what if you approached this a different way. You could have the user pick the interface from a list on install, which is probably not very user friendly. Or just record all the MAC addresses in the system and authenticate as long as one is still active.

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

Disruption answered 29/8, 2009 at 12:47 Comment(1)
The bit about users shuffling them around isn't making me happy. But probably not a big problem; almost nobody will do it.Larimor
I
1

I do not have a solution, but there might be another issue:

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

Indene answered 29/8, 2009 at 12:14 Comment(1)
What I want is the MAC address for the ethernet controller on the motherboard. That presumably isn't fiddled by VPNs or anything else.Larimor
D
1

I too faced the same issue and found a different approach here.

Windows stores the description of the physical network cards in the registry at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards. The same description is also listed in the “Description” member of the IP_ADAPTER_INFO structure. So I guess I can check whether this value figures in the registry to determine whether the MAC address belongs to a physical network card or not.

Duckworth answered 9/9, 2014 at 6:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.