I am using UDP over ipv6 as communication stack.
I have network client running on secondary virtual interface tap0. It generates messages for server which is supposed to run on the same interface but different link-scope ipv6 address. I can see proper messages generated by the client on the wireshark.
For now I don't have the server code ready but I am using netcat as a replacement for server to test receive the messages, which I have done as follows:
nc -l -6 -vvv -u fe80::d4b2:dcff:fe59:6d2%tap0 61616
fe80::d4b2:dcff:fe59:6d2 is the server side link-scope ipv6 address. Wireshark traces on tap0 clearly shows the packets generated are for above mentioned ipv6 address and port but the netcat is NOT able to receive any packets. ifconfig
shows that I have the above IP assigned to tap0. Moreover, if I execute the following command, I am able to receive the packets at the netcat(server).
nc -6 -vvv -u fe80::d4b2:dcff:fe59:6d2%tap0 61616 < raw_message_file
Strangely, the sending of the above netcat "raw_message_file" is not captured by the wireshark running on tap0. Following ping is also not captured by the wireshark.
ping6 -I tap0 fe80::d4b2:dcff:fe59:6d2
How could be possible that even when explicitly specifying the interface for netcat and ping, the packet are not received/sent on that interface?
PS1: Virtual interface tap0 is opened by the client code. After some time it sends the message to the server which is supposed to be listening on that interface with some different but fixed IPv6.
PS2: I think my description is bit confusing; please ask questions, if you have any?
EDIT: tcpdump on localhost showed that the netcat and ping are going through the localhost interface. My question is, why?