2

I am working on an old code that used to connect different IPv6 devices over a different kind of network (a powe line netwrok, PLC, which is quite similar to 802.15.4). To do that, it created Linux tun/tap interfaces on each device (Tun actually, not the Tap) with C code, which can receive egress packets from tun and deliver them to the PLC and on the other direction it can read ingress packets from PLC and inject into the tun interface.

The system works basically fine, but only I found the NDP function seems not working correctly. Firstly I noticed, with two such devices, I cannot ping each other by their IPv6 link local address (fe80::.../10). I then used tcpdump to monitor the tun traffics and found there is no Neighbor Solicitation/Advertisement message at all. Another strange thing I found is that, there is Route Advertisement sent out from one device of the network (the master PLC device which is so-call coordinator node), but not from any other device in the network.

I want to understand what's the correct behavior I should expect from such kind of network according to IPv6 NDP and how to make it happen.

Will appreciate if someone give me some idea.

-woody

Woody Wu
  • 191

1 Answers1

2

Expected behavior is that NDP is used on TAP interfaces but not on TUN interfaces.

TAP emulates Ethernet, so the kernel will deliver Ethernet frames to your code and expect Ethernet frames from your code. As such it has to first do NDP to know which destination MAC address to use for the IP packets it hands over to your code.

TUN on the other hand does IP without an Ethernet layer. Your code will receive IP packets with no additional headers and it will expect to receive IP packets from your code. Optionally it can be configured to have a small header in front of the IP packet to distinguish IPv4 and IPv6 packets, you can however also use the IP version field to distinguish (unless you are using a very outdated kernel version).

I would expect link-local addresses to work on both kinds of interfaces. As with other addresses NDP will be used on TAP but not on TUN interfaces.

kasperd
  • 31,086