How to set up OpenThread Border Router on Ubuntu

The OpenThread Border Router (OTBR) is an open source Thread Border Router implementation.

A Thread Border Router acts as a gateway between Thread and other IP networks (e.g. WiFi, Ethernet).

In this how to, we will go through the steps to quickly setup OTBR on Ubuntu.

Note

In order to setup OTBR, we need a Radio Co-Processor (RCP) and another IP networking interface such as WiFi or Ethernet.

Moving forward, the assumption is to have the RCP available as a device at /dev/ttyACM0.

We use the (unofficial) OTBR Snap because it makes the setup, configuration, and maintenance significantly simpler. Let’s get started:

Install the OTBR snap

Install the latest version from the Snap Store:

sudo snap install openthread-border-router

Tip

Pre-release versions of OpenThread Border Router are available in different channels.

Grant access to resources

Install the dependencies:

sudo apt update
sudo apt install bluez avahi-daemon

Connect the following interfaces:

# Allow setting up the firewall
sudo snap connect openthread-border-router:firewall-control
# Allow access to USB Thread Radio Co-Processor (RCP)
sudo snap connect openthread-border-router:raw-usb
# Allow setting up the networking
sudo snap connect openthread-border-router:network-control
# Allow controlling the Bluetooth devices
sudo snap connect openthread-border-router:bluetooth-control

# Allow device discovery over Bluetooth Low Energy
sudo snap connect openthread-border-router:bluez
# Allow DNS-SD registration and discovery
sudo snap connect openthread-border-router:avahi-control

Configure the OTBR snap

The configurations are set via Snap Configuration Options and passed on the services.

First, check the default configurations:

$ sudo snap get openthread-border-router
Key        Value
autostart  false
infra-if   wlan0
radio-url  spinel+hdlc+uart:///dev/ttyACM0
thread-if  wpan0

Then, override them based on the local setup.

For example, if the networking interface is eth0, change it as follows:

snap set openthread-border-router infra-if="eth0"

Start OTBR

By default the services are disabled and not started. After everything is configured, we can start and enable the services:

sudo snap start --enable openthread-border-router

Use the following command to query and follow the logs:

snap logs -n 100 -f openthread-border-router

Note

To start and enable via a Gadget snap, set autostart snap configuration to true.

Form a Thread network

Use the CTL tool to initialize the Thread network:

sudo openthread-border-router.ot-ctl dataset init new
sudo openthread-border-router.ot-ctl dataset commit active
sudo openthread-border-router.ot-ctl ifconfig up
sudo openthread-border-router.ot-ctl thread start

Alternatively, these steps could be performed with the GUI at http://localhost:80. Please refer to the instructions here to configure and form, join, or check the status of a Thread network using the GUI.

Controlling a Thread device

To commission and control a Matter Thread device, you can use Chip Tool; refer to How to commission and control Matter devices with Chip Tool.