diff --git a/examples/microcoap_server/README.md b/examples/microcoap_server/README.md index 2f4b53acda..56aadecb13 100644 --- a/examples/microcoap_server/README.md +++ b/examples/microcoap_server/README.md @@ -42,15 +42,18 @@ RIOT native hardware initialization complete. main(): This is RIOT! (Version: 2015.12-devel-632-g8f451-booze-add_conn_coap_example) RIOT microcoap example application +Waiting for address autoconfiguration... Configured network interfaces: -Iface 5 HWaddr: fa:bf:2b:01:9e:a3 - MTU:1280 HL:64 +Iface 5 HWaddr: 96:3c:18:1e:26:f7 + + MTU:1500 HL:64 RTR RTR_ADV Source address length: 6 Link type: wired inet6 addr: ff02::1/128 scope: local [multicast] - inet6 addr: fe80::f8bf:2bff:fe01:9ea3/64 scope: local - inet6 addr: ff02::1:ff01:9ea3/128 scope: local [multicast] + inet6 addr: fe80::e42a:1aff:feca:10ec/64 scope: local + inet6 addr: ff02::1:ffca:10ec/128 scope: local [multicast] inet6 addr: ff02::2/128 scope: local [multicast] + inet6 addr: 2001:db8:1:0:e42a:1aff:feca:10ec/64 scope: global Waiting for incoming UDP packet... ``` @@ -80,22 +83,28 @@ getting it to work with RIOT requires a little setup. Make sure you've installed - The [Firefox Copper plugin](https://addons.mozilla.org/en-US/firefox/addon/copper-270430/) -- The Router Advertisement Daemon (radvd) +- The Router Advertisement Daemon (radvd) + +And build the application again using `make`. Enter the following into your `/etc/radvd.conf` (if it doesn't exist yet, create one): ``` interface tap0 { - AdvSendAdvert on; - MinRtrAdvInterval 3; - MaxRtrAdvInterval 10; - prefix fc00::/64 - { - AdvOnLink on; - AdvAutonomous on; - AdvRouterAddr off; - }; + AdvSendAdvert on; + + MinRtrAdvInterval 3; + MaxRtrAdvInterval 10; + + AdvDefaultPreference low; + + prefix 2001:db8:1:0::/64 + { + AdvOnLink on; + AdvAutonomous on; + AdvRouterAddr off; + }; }; ``` @@ -104,13 +113,31 @@ interface tap0 and run ``` -/bin/systemctl start radvd.service +sudo radvd ``` -Now you can enter +Then, run the RIOT binary as usual: ``` -coap://[fc00::1]/riot/board +make term ``` -into your Firefox address bar. +Note that the output listing all configured interfaces contains a globally scoped +address, which you can now use to reach the RIOT instance via Copper. To do so, enter this: + +``` +coap://[2001:db8:1:0:e42a:1aff:feca:10ec]/riot/board +``` + +into your Firefox address bar, where you should replace `2001:db8:1:0:e42a:1aff:feca:10ec` +with your RIOT instance's address marked as "scope: **global**". +If you click the big green `GET` button, the word `native` should appear in the +**Payload** text box at the center of the GUI. + +**If this doesn't work,** try manually adding a Global address to the tap0 interface: + +``` +sudo service radvd start +sudo ip address add 2001:db8:1::a/64 dev tap0 +make term +``` \ No newline at end of file diff --git a/examples/microcoap_server/main.c b/examples/microcoap_server/main.c index c790da2a2a..0ee00f4c70 100644 --- a/examples/microcoap_server/main.c +++ b/examples/microcoap_server/main.c @@ -19,6 +19,7 @@ #include #include "msg.h" +#include "xtimer.h" #define MAIN_QUEUE_SIZE (8) static msg_t _main_msg_queue[MAIN_QUEUE_SIZE]; @@ -35,6 +36,9 @@ int main(void) /* microcoap_server uses conn which uses gnrc which needs a msg queue */ msg_init_queue(_main_msg_queue, MAIN_QUEUE_SIZE); + puts("Waiting for address autoconfiguration..."); + xtimer_sleep(3); + /* print network addresses */ puts("Configured network interfaces:"); _netif_config(0, NULL);