Connectivity between new NG stack and loopback

Hello everyone,

I’m new to RIOT and currently trying to test the connectivity between a RIOT instance on native and the loopback. I’m currently using the ng_networking.elf from the examples and while I can pass messages between 2 RIOT instances using this example I would also like to be able to have a connection with the loopback on my machine for future tests but I can’t seem to make it work. If someone could give me a quick walkthrough or help me figure out where my mistake is I would really appreciate it. I’m sure this must seem trivial .

Thank you, Alex

Hello Alexandru,

I am not certain that this method is bullet-proof, but you can try the following:

  • Create a tun/tap interface:

sudo openvpn --mktun --dev tap0 [FYI: I did not test this method with the tapsetup script]

  • Enable the interface:

sudo ip link set dev tap0 up

  • start ng-nativenet

make term PORT=tap0 [FYI: Starting RIOT with tap0 will assign an ip address to tap0]

  • In Linux: lookup the ipv6 address of tap0

ifconfig tap0

  • Start a udp server on Linux

nc -ul %tap0 13377 [ It is necessary to use the suffix %tap0 in order to give a hint to Linux that this is a tun/tap device]

  • In RIOT: start a udp server and happily communicate with linux

udp server start 13377 udp send 13377 HELLO-RIOT

  • In Linux: netcat will receive this message and you can reply by just typing something in your shell

I hope this helps

cheers, Cenk

Hi Alex,

have a look at the microcoap example [1], which uses marz [2] to connect the RIOT node with your »normal« localhost. The RIOT application in this example is a just a server (and only reacts on requests), but it shouldn't be too hard to extend/customize.

The marz code is a bit spaghetti like, and maybe I will build a better solution in the near future, as I need the same functionality you do for testing a gateway.

As for the microcoap example: beware of pip, you may want to install Twisted and bidict manually by downloading it from the respective websites, because (on my system) pip installed only parts of the libraries. Also, check the $PYTHONPATH variable and which version of python the respective file/program uses when things don't work, this caused some trouble for me.

As soon as I know more, I'll let you know.

The method described by Cenk did not work for me, but I'll try and make that (or something similar) work as well.

Best, Lennart

[1] https://github.com/RIOT-OS/applications/tree/master/microcoap

[2] https://github.com/sgso/marz

Hello Lennart,

I might be wrong and Sebastian might be able to shed some light on this, BUT isn't marz restricted to the old network stack? As far as I know it strips/adds the old nativenet header from outgress/ingress packets.

BTW, are you also using the old network stack? My described method works only for the new network stack and with ng_nativenet (:

cheers, CG

Hello Cenk,

I tried your method and it works ! Thanks for the help !

Cheers, Alex

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:

Hello Lennart,

the method you suggested now works halfway for me, but I still can't

that's half the battle (:

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

Using nc without the -l flag will start a udp client and connect to the riot server. You will however not be able to receive messages on Linux without starting a udp server (-l flag). You need to also specify the tap0's ipv6 address here > f33c < with the %tap0 suffix, instead of riot's ipv6 address, in order to listen on the tap0 device.

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

In general, it is completely valid for a device to have multiple ipv6 addresses. However, this is not the case in this situation. In Linux you should only see >one< ipv6 address when you use ip/ifconfig on tap0 with this method.

I am not really experienced enough to tell how ng_nativenet utilizes the tun/tap interface in detail.. Maybe it's possible to use tap0 and tap1 and the additional bridge to establish a connection between riot and linux.. But one tap interface seems to be sufficient for this purpose.

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

Could you try this again and re-check the ipv6 addresses you used? I don't know why this shouldn't work..

Best, Cenk

Hello Lennart,

Did you by any chance forgot to edit the makefile to include the module for ng_nativenet and recompile?

Cheers, Alex

Hi everyone,

I'm sorry for answering so late (I had some other things to take care of), and I would like to thank you for your help.

The reason why this wasn't working on my system was just my firewall that interfered. After turning it off, everything worked just as you described.

To make it easier for other newcomers, who might have to deal with this, I created a wiki article that describes how to talk to your RIOT process and mentions some of the pitfalls. It's not published yet, for now it's just a gist, but feel free to check it out:

https://gist.github.com/backenklee/2dbdaae90af5b5878200

If you feel like something is missing or think something could be improved, please let me know.

Cheers, Lennart

Hey Lennart, at the IETF hackathon we started documenting this in the README of ng_networking, since it seemed to be a better place for this (things tend to get lost in the Wiki and most peoble trying to network with the GNRC stack will probably stumble upon this app). Maybe you can just update there?

Cheers, Martine

Forgot the link: https://github.com/RIOT-OS/RIOT/blob/master/examples/ng_networking/README.md

Hi,

that would be a good example for great communication :smiley:

Personally, I would add

- the link to the Wikipedia page about link-local address

- some short explanations what the netcat options are for (for people   like me, who are too lazy to open the man page and search for it)

- the note at the end of my article about writing your own software

- and, most important, the note at the beginning of my article   concerning the damn firewall and the modprobe ipv6 stuff on a   Raspberry Pi.

If you want to, I can update the article and add a Pull Request, or you can just copy&paste it (would be much faster), if the others agree..?

Cheers, Lennart

Hi,

If you want to, I can update the article and add a Pull Request, or you can just copy&paste it (would be much faster), if the others agree…?

Please do. I would also have to make a PR, just like you do so it would not be faster if you just do it as you think is best ;-). The review will decide if others agree.

Cheers, Martine