将 VMware 网络适配器与物理网络适配器区分开来 - 或 - 检测虚拟网络适配器 [英] Differentiate VMware network adapter from physical network adapters -or- Detect Virtual Network Adaptor

查看:108
本文介绍了将 VMware 网络适配器与物理网络适配器区分开来 - 或 - 检测虚拟网络适配器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须使用任何 Windows API 区分真实地址和 VM 地址.我正在使用 GetAdaptersAddresses API 来填充本地机器的 IP 地址列表.除了与 VMware 网络适配器关联的地址和其他地址(自动配置和隧道适配器地址)之外,我只需要提取真实"地址.我找不到任何 API 或任何标志来区分这一点.有什么办法可以做到吗?

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 addresses for the local machine. I need to extract only the "real" addresses apart from the addresses associated with the VMware network adapter and other addresses (auto-configuration and tunnel adapter addresses). I've not been able to find any API or any flag to differentiate this. Is there any way this can be done?

PS:GetAdaptersAddresses 返回的 IP_ADAPTER_ADDRESSES 结构中的 IfType 标志不能帮助我区分VMware 地址和真实地址.

PS: The IfType flag in the IP_ADAPTER_ADDRESSES structure returned by GetAdaptersAddresses doesn't help me differentiate between VMware addresses and the real addresses.

推荐答案

mac地址的开头(前3段)显示接口是否为虚拟:

The beginning (first 3 segments) of the mac address shows if a interface is virtual:

"00:05:69"; //vmware1
"00:0C:29"; //vmware2
"00:50:56"; //vmware3
"00:1C:42"; //parallels1
"00:03:FF"; //microsoft virtual pc
"00:0F:4B"; //virtual iron 4
"00:16:3E"; //red hat xen , oracle vm , xen source, novell xen
"08:00:27"; //virtualbox

编辑
更清楚地说,如果一个接口有一个 MAC 地址 以上述任意字符串开头,则它是虚拟的.

EDIT
To be more clear, if a interface has a MAC address that starts with any of the above given strings, then it's virtual.

这篇关于将 VMware 网络适配器与物理网络适配器区分开来 - 或 - 检测虚拟网络适配器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆