V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
ppbaozi
V2EX  ›  宽带症候群

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

  •  
  •   ppbaozi · 2023-03-13 18:39:37 +08:00 · 1118 次点击
    这是一个创建于 612 天前的主题,其中的信息可能已经有所发展或是发生改变。
    希望能看到 hostname-ipv4-ipv6-MAC 的关系表。最好设备品牌也显示下。

    现在拿到个 ipv6 都不知道在哪台设备上
    neroxps
        1
    neroxps  
       2023-03-13 20:34:02 +08:00 via iPhone
    蹲个工具
    ppbaozi
        2
    ppbaozi  
    OP
       2023-03-15 10:41:31 +08:00

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

    ppbaozi
        4
    ppbaozi  
    OP
       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);
    }
    }
    }
    }
    }
    ```
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   3466 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 04:56 · PVG 12:56 · LAX 20:56 · JFK 23:56
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.