Form Thread Network

View source on GitHub

Form a Thread network and test its connectivity to the internet.

Start an `ot-ctl` session

ot-ctl exposes the OpenThread CLI commands, see OpenThread CLI Guide for more details.

If using Docker, start an ot-ctl session as follows:

docker exec -it otbr ot-ctl

If using native host, start an ot-ctl session as follows:

sudo ot-ctl

Form a Thread Network

  1. Generate a new network configuration.

    dataset init new
    Done
    
  2. View the new network configuration.

    dataset
    Active Timestamp: 1
    Channel: 15
    Wake-up Channel: 16
    Channel Mask: 0x07fff800
    Ext PAN ID: 39758ec8144b07fb
    Mesh Local Prefix: fdf1:f1ad:d079:7dc0::/64
    Network Key: f366cec7a446bab978d90d27abe38f23
    Network Name: OpenThread-5938
    PAN ID: 0x5938
    PSKc: 3ca67c969efb0d0c74a4d8ee923b576c
    Security Policy: 672 onrc 0
    Done
    
  3. Commit new dataset to the Active Operational Dataset in non-volatile storage.

    dataset commit active
    Done
    
  4. Enable Thread interface.

    ifconfig up
    Done
    thread start
    Done
    
  5. In the Linux host console (not within an ot-ctl session), use ifconfig to view the new Thread network interface:

    ifconfig wpan0
    wpan0: flags=4305  mtu 1280
            inet6 fe80::3c98:89e8:ddec:bda7  prefixlen 64  scopeid 0x20
            inet6 fd4d:b3e5:9738:3193:0:ff:fe00:fc00  prefixlen 64  scopeid 0x0
            inet6 fd4d:b3e5:9738:3193:0:ff:fe00:f800  prefixlen 64  scopeid 0x0
            inet6 fd4d:b3e5:9738:3193:39c4:ee02:ca9e:2b1d  prefixlen 64  scopeid 0x0
            unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 500  (UNSPEC)
            RX packets 16  bytes 1947 (1.9 KiB)
            RX errors 0  dropped 3  overruns 0  frame 0
            TX packets 7  bytes 1152 (1.1 KiB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    

Bring up a second Thread node

With OTBR up and running, add a standalone Thread node to the Thread network and test that it has connectivity to the internet.

See the Build a Thread network with nRF52840 boards and OpenThread Codelab for detailed instructions on building and flashing the Nordic nRF52840 platform.

  1. After building and flashing, use screen in a new terminal window to access the CLI. For example, if the device is mounted on port /dev/ttyACM1:

    screen /dev/ttyACM1 115200
    

  2. Press the Enter key to bring up the > OpenThread CLI prompt.

Join the second node to the Thread network

Using the OpenThread CLI for your second Thread node, join the node to the Thread network created by OTBR.

  1. Update the Thread network credentials for the node, using the minimum required values from OTBR:

    dataset networkkey f366cec7a446bab978d90d27abe38f23
    Done
    dataset commit active
    Done
    

  2. Bring up the Thread interface and start Thread:

    ifconfig up
    Done
    thread start
    Done
    

  3. The node should join the OTBR Thread network automatically. Within two minutes its state should be router:

    state
    router
    

Ping a public address

You should be able to a ping a public IPv4 address from the standalone Thread node at this point. Since Thread only uses IPv6, the public IPv4 address will be automatically translated to IPv6 by combining with the NAT64 prefix in the Thread network.

  1. To view the NAT64 prefix in the Thread network:

    netdata show
    Prefixes:
    fd3e:d39b:d91:1::/64 paros low 1800
    Routes:
    ::/0 s med 1800
    fd3e:d39b:d91:2:0:0::/96 sn low 1800
    Services:
    Contexts:
    fd3e:d39b:d91:1::/64 1 c
    Commissioning:
    12156 - - -
    
    Here fd3e:d39b:d91:2:0:0::/96 is the NAT64 prefix in the Thread network.

  2. Ping an IPv4 address from the CLI of the standalone Thread node to test its internet connectivity:

    ping 8.8.8.8
    Pinging synthesized IPv6 address: fd3e:d39b:d91:2:0:0:808:808
    16 bytes from fd3e:d39b:d91:2:0:0:808:808: icmp_seq=1 hlim=113 time=73ms
    1 packets transmitted, 1 packets received. Packet loss = 0.0%. Round-trip min/avg/max = 73/73.0/73 ms.
    Done
    

Success! The second Thread node can now communicate with the internet, through OTBR.