ipv6 ndptool 用于邻居发现

ipv6 ndptool 用于邻居发现

我正在尝试收集 LAN 中的所有全局 IPv6 地址。因此,我正在使用它ndptool来查看可以收集多少个地址。

该命令可以报告路由器广播:

# ndptool  -i eth1 monitor -t ra
NDP payload len 96, from addr: fe80::4e5e:cff:feea:365, iface: eth1  
  Type: RA  
  Hop limit: 64  
  Managed address configuration: no  
  Other configuration: yes  

但我的 NS 或 NA 类型失败了:

# ndptool -t ns -i eth1 monitor

不返回任何内容。

我曾经tshark捕获过 icmpv6,例如:

tshark -R icmpv6 -i eth1  

显示数据包已接收:

4533 43.369934717 2001:b030:214:100:4e5e:cff:feea:366 -> ff02::1:ff78:99f9 ICMPv6 86 Neighbor Solicitation for 2001:b030:214:100:48d0:319d:5b78:99f9 from 4c:5e:0c:ea:03:66  
4578 44.014239120 fe80::1c41:89b5:6460:8e6d -> ff02::16     ICMPv6 110 Multicast Listener Report Message v2  
4601 44.369626481 2001:b030:214:100:4e5e:cff:feea:366 -> ff02::1:ff78:99f9 ICMPv6 86 Neighbor Solicitation for 2001:b030:214:100:48d0:319d:5b78:99f9 from 4c:5e:0c:ea:03:66  
4705 45.369780078 2001:b030:214:100:4e5e:cff:feea:366 -> ff02::1:ff78:99f9 ICMPv6 86 Neighbor Solicitation for 2001:b030:214:100:48d0:319d:5b78:99f9 from 4c:5e:0c:ea:03:66  
4761 45.747995672 fe80::4e5e:cff:feea:366 -> ff02::1:ff93:9da3 ICMPv6 86 Neighbor Solicitation for 2001:b030:214:100:20c:29ff:fe93:9da3 from 4c:5e:0c:ea:03:66  
4769 46.021538598 fe80::1c41:89b5:6460:8e6d -> ff02::16     ICMPv6 110 Multicast Listener Repo  

看起来数据包在那里,但ndptool没有输出它们。

我希望获取局域网内的全局 IP 和 mac 信息。该如何解决?

答案1

ndptool 只是一个邻居发现协议消息的包装器。因此它只允许发送和接收 NDP 消息。如果我理解正确的话,协议消息(例如来自如何:IPv6 邻居发现),将发送 NA 来响应 NS。尝试在一个窗口中监视 NA,并在另一个窗口中发送 NS,您将看到邻居以 NA 进行响应。

例如,假设eth0以及一个邻居2001:db8::2

  • 窗口A, 跑步ndptool -t na -i eth0 monitor
  • 窗口B, 跑步ndptool -t ns -i eth0 -D 2001:db8::2 send
  • 窗口A, 观察NDP payload len 24, from addr: 2001:db8::2, iface: eth0 ...

如果你需要知道邻居的 MAC 地址,可以尝试ndisc6

# ndisc6 2001:db8::2 eth0
Soliciting 2001:db8::2 (2001:db8::2) on eth0...
Target link-layer address: 02:42:AC:14:00:02
 from 2001:db8::2

或者邻居

# ip neigh show
2001:db8::2 dev eth0 lladdr 02:42:ac:14:00:02 STALE

相关内容