问题描述
是否可以通过IPv6(不带WMI)从同一网络中的另一台PC获取MAC?使用IPv4,很容易(ARP).
Is it possible to get the MAC from an another PC in the same Network via IPv6 (without WMI)? With IPv4 it is easy (ARP).
IPv6使用邻居发现协议"(NDP)来获取MAC地址. .Net中是否有任何方法可以做到这一点?
IPv6 uses the "Neighbor Discovery Protocol" (NDP) to get the MAC address. Are there any methods in .Net for this?
推荐答案
您可以运行外部命令"netsh int ipv6 show neigh",并过滤出您感兴趣的主机.您应该在此之前联系过它,所以您知道它在NC中.
You can run the external command "netsh int ipv6 show neigh", and filter out the host you are interested in. You should have contacted it just before that, so you know it is in the NC.
如果您要使用该API,请使用 GetIpNetTable2 ,或更直接地,是 ResolveIpNetEntry2 .我怀疑是否有用于此功能的.NET API,因此您必须使用PInvoke.
If you want an API for that, use GetIpNetTable2 or, more directly, ResolveIpNetEntry2. I doubt there is a .NET API for this, so you'll have to use PInvoke.
这篇关于通过IPv6获取远程MAC地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!