[riot-devel] Connectivity between new NG stack and loopback

Lennart Dührsen lennart.duehrsen at fu-berlin.de
Thu Jun 25 16:14:59 CEST 2015

Hi Cen,

the method you suggested now works halfway for me, but I still can't
send packets from RIOT to netcat. Would you (or anyone else) mind having
a look at what I did, maybe you know what's wrong...?

Below are the exact commands I typed and the corresponding output:


linux~ sudo openvpn --mktun --dev tap0

Thu Jun 25 15:42:47 2015 TUN/TAP device tap0 opened
Thu Jun 25 15:42:47 2015 Persist state set to: ON

linux~ sudo ip link set dev tap0 up

linux~ cd /home/lennart/git/RIOT/examples/ng_networking && make

linux~ ./bin/native/ng_networking.elf tap0

riot> ifconfig

Iface  7   HWaddr: b6:00:b1:63:f3:3d
           inet6 addr: ff02::1/128  scope: local [multicast]
           inet6 addr: fe80::b400:b1ff:fe63:f33d/64  scope: local
           inet6 addr: ff02::1:ff63:f33d/128  scope: local [multicast]

linux~ ip addr show dev tap0

4: tap0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast
state UP group default qlen 100
    link/ether b6:00:b1:63:f3:3c brd ff:ff:ff:ff:ff:ff
    inet6 fe80::b400:b1ff:fe63:f33c/64 scope link
       valid_lft forever preferred_lft forever

riot> udp server start 54545

Success: started UDP server on port 54545

linux~ nc -u fe80::b400:b1ff:fe63:f33d%tap0 54545



PKTDUMP: data received:
~~ SNIP  0 - size:  14 byte, type: NETTYPE_UNDEF (0)
000000 68 65 6c 6c 6f 2d 66 72 6f 6d 2d 6e 63 0a
~~ SNIP  1 - size:   8 byte, type: NETTYPE_UDP (3)
   src-port: 55187  dst-port: 54545
   length: 22  cksum: 0x4fc7f
~~ SNIP  2 - size:  40 byte, type: NETTYPE_IPV6 (1)
traffic class: 0x00 (ECN: 0x0, DSCP: 0x00)
flow label: 0x00000
length: 22  next header: 17  hop limit: 64
source address: fe80::b400:b1ff:fe63:f33c
destination address: fe80::b400:b1ff:fe63:f33d
~~ SNIP  3 - size:  19 byte, type: NETTYPE_NETIF (-1)
if_pid: 7  rssi: 0  lqi: 0
src_l2addr: b6:00:b1:63:f3:3c
dst_l2addr: b6:00:b1:63:f3:3d
~~ PKT    -  4 snips, total size:  81 byte

riot> udp send fe80::b400:b1ff:fe63:f33c 55187 hello-from-riot

Success: send 15 byte to fe80::b400:b1ff:fe63:f33c:55187


So as you can see, the RIOT node has the IP  address fe80:...:f33d,
whereas the other end of the channel has the address fe80:...:f33c.

The RIOT node listens on port 54545, so when I start netcat, »connect«
to the nodes address on port 54545 and send data, the node receives it
(as expected).

However, this doesn't work the other way around: When I try send data
from the RIOT node to netcat, using the source address and source port
from the packet RIOT just received before, nothing arrives at netcat.
Both packets appear in wireshark with the right address/port fields,
just as one would expect.

Additionally, what I don't really understand is how one device (tap0)
can have two IPv6 addresses. In the default example for RIOT, where two
nodes communicate with each other, you have to set up two tap devices
and a bridge which connects them, which makes sense to me.
When and how is the second address assigned (the nc source address)?

Btw, using nc as you initially described did not produce any output on
either side (nc -ul fe80:...:f33c%tap0 54545).

Any help / explanation would be greatly appreciated.


More information about the devel mailing list