This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Making IPv6 device available on the internet

Hei

I've gotten the ipv6_coap_server example to run on the nRF51-dongle. I got the bt0 interface after connecting to the device and I am able to ping the device.

My LAN has native IPv6 delivered from my ISP. The gateway router (broadband router) is getting its IPv6 with DHCP-PD and is allocated a /60 range, but is using stateless address configuration on the LAN. My desktop is getting a globally routable IPv6 address and can I can connect to and from the desktop from remote machines.

If I run radvd on my desktop I can give the device a global address, but as far as I know it shouldn't be necessary as my LAN already has a router.

I have tried to bridge the two interfaces with brctl but that fails when adding the bt0 interface.

My setup looks like this:

(nrf51)  <-- BT --> (BT dongle) <- USB -> Linux Host <- ethernet -> DSL router

What do I need to do to get the device to be available on the internet too?

Parents
  • To safe others time, here is the answer if your provides does NOT support ipv6 on your local box (which seems to be the unstated assumption for all answers and the IOT SDK documentation).

    First, run

    http://test-ipv6.com/

    To determine if you have full ipv6 support. If not, keep reading. If you're in a NAT'ed environment (192.X, 10.X etc.) give up. But if your bridge (pi3 in my case) has a DNS-resolvable IP, then follow the description above except for the ip6table commands and then:

    Create a 6to4 connection from the pi3 (w/ eth0 IP A.B.C.D, make sure to use the corresponding hex values in the 3rd cmd below):

    ip tunnel add 6to4 mode sit remote any local A.B.C.D

    ip link set 6to4 up

    ip addr add 2001:xAB:xCD::1/16 dev 6to4

    ip -6 route add default via ::192.88.99.1 dev 6to4

    (This assumes the commands above. If you followed the SDK documentation, which uses 2001:db8::1 for bt0, you'd have to use 2002:... in the ip addr cmd above instead. They need to be 2 different prefixes.)

    Then create an ipv6 NAT:

    /sbin/ip6tables -t nat -A POSTROUTING -o 6to4 -j MASQUERADE

    /sbin/ip6tables -A FORWARD -i 6to4 -o bt0 -m state --state RELATED,ESTABLISHED -j ACCEPT

    /sbin/ip6tables -A FORWARD -i bt0 -o 6to4 -j ACCEPT

    and viola! I strongly suggest to add this to the SDK documentation to save others days of tinkering w/ broken kernels (6lowpan is briddle), misleading answers on posts etc.

    On a related note, why even go ipv6 at all? Most IOT devices will be behind a NAT, using ipv4 would have been much easier (since ipv6 may never see full support by ISPs)? But that's more of a philosophical RFC question.

Reply
  • To safe others time, here is the answer if your provides does NOT support ipv6 on your local box (which seems to be the unstated assumption for all answers and the IOT SDK documentation).

    First, run

    http://test-ipv6.com/

    To determine if you have full ipv6 support. If not, keep reading. If you're in a NAT'ed environment (192.X, 10.X etc.) give up. But if your bridge (pi3 in my case) has a DNS-resolvable IP, then follow the description above except for the ip6table commands and then:

    Create a 6to4 connection from the pi3 (w/ eth0 IP A.B.C.D, make sure to use the corresponding hex values in the 3rd cmd below):

    ip tunnel add 6to4 mode sit remote any local A.B.C.D

    ip link set 6to4 up

    ip addr add 2001:xAB:xCD::1/16 dev 6to4

    ip -6 route add default via ::192.88.99.1 dev 6to4

    (This assumes the commands above. If you followed the SDK documentation, which uses 2001:db8::1 for bt0, you'd have to use 2002:... in the ip addr cmd above instead. They need to be 2 different prefixes.)

    Then create an ipv6 NAT:

    /sbin/ip6tables -t nat -A POSTROUTING -o 6to4 -j MASQUERADE

    /sbin/ip6tables -A FORWARD -i 6to4 -o bt0 -m state --state RELATED,ESTABLISHED -j ACCEPT

    /sbin/ip6tables -A FORWARD -i bt0 -o 6to4 -j ACCEPT

    and viola! I strongly suggest to add this to the SDK documentation to save others days of tinkering w/ broken kernels (6lowpan is briddle), misleading answers on posts etc.

    On a related note, why even go ipv6 at all? Most IOT devices will be behind a NAT, using ipv4 would have been much easier (since ipv6 may never see full support by ISPs)? But that's more of a philosophical RFC question.

Children
Related