I am using NetworkInterface.GetAllNetworkInterfaces() to take my network interfaces,
then I trying to take my MAC addreses (NetInterf[i].GetPhysicalAddress())
and it takes me my real interfaces and some trash:
[0]: ""
[1]: "00E018998877"
[2]: "001F3C0B4F5D"
[3]: ""
[4]: "00000000000000E0"
[5]: "00000000000000E0"
[6]: "00000000000000E0"
[7]: "00000000000000E0"
[1] and [2] my real MAC adress but other is wrong,
MAC addres must have 6 bytes, isn’t?
In program I am filtering with such condition
if (NetInterf[i].GetPhysicalAddress().GetAddressBytes().Length == 6)
I’m doing right? Because I can’t find anything about it in MSDN.
The more clear way to get all real interfaces will be to use WMI. You can retrieve all network adapters information from the
Win32_NetworkAdapterclass. To determine whether the adapter is a physical or a logical adapter need to checkPhysicalAdapterproperty. Here is example:Using
NetworkInterface.GetAllNetworkInterfaces()you can’t determine that for sure.