windows 有无好用的 ipv6 ndp 查看的工具

2023-03-13 18:39:37 +08:00
 ppbaozi
希望能看到 hostname-ipv4-ipv6-MAC 的关系表。最好设备品牌也显示下。

现在拿到个 ipv6 都不知道在哪台设备上
1021 次点击
所在节点    宽带症候群
4 条回复
neroxps
2023-03-13 20:34:02 +08:00
蹲个工具
ppbaozi
2023-03-15 10:41:31 +08:00

ppbaozi
2023-03-15 10:44:48 +08:00

ppbaozi
2023-03-15 10:59:10 +08:00
```
using System.Net;
using System.Net.NetworkInformation;

// Get the list of network interfaces
NetworkInterface[] interfaces = NetworkInterface.GetAllNetworkInterfaces();

// Loop through each interface
foreach (NetworkInterface ni in interfaces)
{
// Check if the interface is an IPv6 interface
if (ni.Supports(NetworkInterfaceComponent.IPv6))
{
// Get the list of IPv6 addresses for the interface
IPAddressCollection addresses = ni.GetIPProperties().UnicastAddresses;

// Loop through each IPv6 address
foreach (IPAddress address in addresses)
{
// Check if the address is an IPv6 address
if (address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetworkV6)
{
// Get the list of neighbors for the address
IPv6NeighborCollection neighbors = ni.GetIPv6Properties().GetIPv6Neighbors(address);

// Loop through each neighbor
foreach (IPv6Neighbor neighbor in neighbors)
{
// Display the neighbor's IP address and MAC address
Console.WriteLine("Neighbor IP Address: {0}", neighbor.Address);
Console.WriteLine("Neighbor MAC Address: {0}", neighbor.LinkLayerAddress);
}
}
}
}
}
```

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/923669

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX