有一个名为if_nametoindex()的函数可以将接口名称转换为接口索引。此功能似乎在Linux和Windows上可用。在Linux上,我想这些接口名称可能看起来像"eth0“或"wlan0”。
我的问题是: Win32接口名称看起来像什么?还有什么调用可以让我查询哪些接口名称可用?
发布于 2012-01-24 06:00:25
还有if_indextoname。我已经添加了下面的输出。此名称样式(例如loopback_0)不是Win32接口名称。我猜这些名称的存在只是为了与rfc2553兼容。Win32实际上使用像\DEVICE\TCPIP_{846EE342-7039-11DE-9D20-806E6F6E6963}这样的接口名称。
要枚举您需要使用GetIfTable和friends的所有接口。不支持if_nameindex。
loopback_0
tunnel_0
tunnel_2
tunnel_3
ppp_0
ethernet_0
ethernet_1
ethernet_4
ppp_1
wireless_0
ethernet_9
tunnel_4
tunnel_1
tunnel_7
tunnel_8
wireless_5
tunnel_5
tunnel_9
tunnel_10
tunnel_6
wireless_1
wireless_2
ethernet_2
ethernet_3
ethernet_5
ethernet_6
ethernet_7
wireless_3
wireless_4
wireless_6
wireless_7
wireless_8发布于 2012-01-24 05:56:28
他们看起来像\Device\NPF_{506B4345-1FC0-43F4-BFCF-4FFAD7739AFF}。我不知道是否有更直接的方法来获取接口列表,但我是从wireshark那里获得的,它使用winpcap。
发布于 2019-10-08 22:25:06
getmac将在Windows命令提示符下列出它们
https://stackoverflow.com/questions/8978670
复制相似问题