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].

Nicholas Riley
  • 43,532
  • 6
  • 101
  • 124
Ira Baxter
  • 93,541
  • 22
  • 172
  • 341

5 Answers5

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).

Vinay Sajip
  • 95,872
  • 14
  • 179
  • 191
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.

teambob
  • 1,994
  • 14
  • 19
  • Agree. If we evalauted this software (adn several virtual environments), we'd reject this because of an inane MAC licensing system... – gbn Aug 29 '09 at 12:15
  • 1
    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? – Matthew Talbert Aug 29 '09 at 12:21
  • 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). – Ira Baxter Mar 13 '10 at 19:54
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.

shf301
  • 31,086
  • 2
  • 52
  • 86
  • The bit about users shuffling them around isn't making me happy. But probably not a big problem; almost nobody will do it. – Ira Baxter Mar 13 '10 at 19:55
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.

Wolfgang
  • 3,460
  • 3
  • 28
  • 38
  • What I want is the MAC address for the ethernet controller on the motherboard. That presumably isn't fiddled by VPNs or anything else. – Ira Baxter Mar 13 '10 at 19:54
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.

Martin
  • 3,396
  • 5
  • 41
  • 67