I have to differentiate between the real addresses and the VM addresses using any Windows API.
I\'m using GetAdaptersAddresses
API to populate a list of IP addr
You can pass NetworkInterface in below method and it will return boolean to indicate that the NIC is Physical or not.
private static bool IsPhysicalAdapter(NetworkInterface ni)
{
bool isPhysical = false;
ManagementObjectSearcher searcher = new
ManagementObjectSearcher(@"root\CIMV2",
string.Format(@"SELECT * FROM Win32_NetworkAdapter
WHERE GUID='{0}' AND NOT PNPDeviceID LIKE 'ROOT\\%'",
ni.Id));
foreach (ManagementObject share in searcher.Get())
{
isPhysical =
Convert.ToBoolean(share.Properties["PhysicalAdapter"].Value);
break;
}
return isPhysical;
}