How to get global scope IPv6?

I have problems getting a global unicast IPv6 address for given RIOT examples on gcoap and nanocoap_server. The output looks slightly different to the given examples and there is no scope global address given:

main(): This is RIOT! (Version: 2020.10-devel-326-gd187e8-HEAD)
RIOT nanocoap example application
Waiting for address autoconfiguration...
Configured network interfaces:
Iface  5  HWaddr: 56:96:42:41:9E:A3 
          L2-PDU:1500 MTU:1500  HL:64  Source address length: 6
          Link type: wired
          inet6 addr: fe80::5496:42ff:fe41:9ea3  scope: link  VAL
          inet6 group: ff02::1
          inet6 group: ff02::1:ff41:9ea3

It seems that there is no IPv6 connection to the router.

By using an Arduino MKR1000 it properly connects to the WiFi

[atwinc15x0] WiFi connected

but there is no network layer connection, just the hardware address seems to be exchanged.

Would be very nice if someone could help me :slight_smile:

What board are you using? Nvm, I didn’t read your post properly the first time. So you’re using the Arduino MKR1000 to connect to your router over Wifi, is that correct?

I think you’ll need to configure the global address manually using ifconfig from the RIOT shell. With the gcoap example, ifconfig 6 add 2001:db8::1 should add global address 2001:db8::1 to interface 6 of the RIOT node/board. Other than that, your router must have ipv6 enabled too.

That is correct, but I have the same problem on board native.

I’m able to add a global address on native

Iface  6  HWaddr: 32:D4:1E:E4:3B:81 
      L2-PDU:1500 MTU:1500  HL:64  Source address length: 6
      Link type: wired
      inet6 addr: fe80::30d4:1eff:fee4:3b81  scope: link  VAL
      inet6 addr: 2003:d1:8f2c:6001::3  scope: global  VAL
      inet6 group: ff02::1
      inet6 group: ff02::1:ffe4:3b81
      inet6 group: ff02::1:ff00:3

A request via the scope link address is successful

coap-client -N -m get -p 5683 coap://[fe80::30d4:1eff:fee4:3b81%tap0]/riot/board

But a request via the new scope global address gives the error

4.04 Not Found

or if I did not add this address to the tap0 interface then I do not receive any answer.

How do you create tap0? Does tap0 has a global address defined to it?

When using the tapsetup script ( RIOT/dist/tools/tapsetup/tapsetup), I managed to send a request using tapbr0 with the scope link address. For the scope global address I need to add a global ipv6 address to the tapbr0 interface first.

This is how I tested locally:

# RIOT shell
> ifconfig 6 add 2001:db8::1
> ifconfig
ifconfig
Iface  6  HWaddr: C6:60:20:A2:15:7F 
          L2-PDU:1500  MTU:1500  HL:64  Source address length: 6
          Link type: wired
          inet6 addr: fe80::c460:20ff:fea2:157f  scope: link  VAL
          inet6 addr: 2001:db8::1  scope: global  VAL
          inet6 group: ff02::1
          inet6 group: ff02::1:ffa2:157f
          inet6 group: ff02::1:ff00:1

# Local machine

## using scope link
$  coap-client -v6 -N -m get -p 5683 coap://[fe80::c460:20ff:fea2:157f%tapbr0]/riot/board
v:1 t:NON c:GET i:f01b {} [ Uri-Host:fe80::c460:20ff:fea2:157f%tapbr0, Uri-Path:riot, Uri-Path:board ]
v:1 t:NON c:2.05 i:f01b {} [ Content-Format:text/plain ] :: 'native'
native

## add global ipv6 to tapbr0
$ sudo ip -6 a add 2001:db8::2/64 dev tapbr0

## using scope global
$ coap-client -v6 -N -m get -p 5683 coap://[2001:db8::1]/riot/board
v:1 t:NON c:GET i:fd2c {} [ Uri-Path:riot, Uri-Path:board ]
v:1 t:NON c:2.05 i:fd2c {} [ Content-Format:text/plain ] :: 'native'
native

Additionally to what @pokgak wrote:

If you are on native, it is quite useful to configure your host as router. Otherwise it will not forward the packets coming from your router.

in /etc/sysctl.conf:

net.ipv6.conf.all.accept_ra=2
net.ipv6.conf.all.forwarding=1
net.ipv6.conf.all.accept_ra_defrtr=1
net.ipv6.conf.all.router_solicitations=1

Additionally to that I would also configure radvd. If you configured everything, you are able to send it from anywhere in your network. Not only the host system where the process is running.

Are you sure all those options need to be set for all interfaces? See also #14689.

No, you don’t need to. Maybe I should elaborate, that you can replace all with the interfaces you want to route. Thanks for pointing this out.

1 Like

For more info one should also refer to Linux’ doc on those configuration variables :slight_smile: (just was looking them up for a project of mine ^^).

1 Like

Thanks for all the helpful answers :smiley:

Unfortunately I can’t test it at the moment. I’ll give you feedback as soon as possible.