How to determine MAC Address of the actual physical network card — not virtual network interfaces created by VPN's (.NET C#)

前端 未结 5 1968
我在风中等你
我在风中等你 2020-12-01 07:00

Background

I\'m trying to get obtain a unique identifier out of a computer and want to be able to reliably return the same MAC address each time. Trust me I have

5条回答
  •  清歌不尽
    2020-12-01 07:29

    I've been looking at this problem as well, and believe that without persistent state it's going to be difficult to maintain a stable MAC.

    The solution I'm toying with is take the first NIC found in the adapter order and use that and save it. Then on subsequent UUID generations, use the saved MAC if it's found anywhere in the stack even if not the first. This way the adapter order can move around and we don't worry about blowing up whatever depends on the stable MAC (such as a licensing module).

    If the saved MAC is not found in the stack, it's discarded and we just use the first MAC in the binding order and start over.

提交回复
热议问题