A network layer for small devices
OpenThread, the open-source Thread implementation, describes Thread as an IPv6-based networking protocol designed for low-power Internet of Things devices in an IEEE 802.15.4 wireless mesh network. The Thread Group, which maintains the specification, explains that Thread is built on the IEEE 802.15.4 MAC and PHY, which were designed for low-power, low-bandwidth control applications.
Thread carries packets. It does not say what a light switch or a door lock means by them. That is left to an application layer, and the Thread Group describes a Thread network running several at once, such as OCF, Matter, KNX and DALI. What is Matter? covers one of them.
Thread also does not depend on the internet. The Thread Group says it does not rely on a home internet connection or Wi-Fi, and instead provides a dedicated network for the devices in the home.
The layers
OpenThread lists the layers a Thread stack implements: IPv6, 6LoWPAN, IEEE 802.15.4 with MAC security, Mesh Link Establishment and mesh routing. On top, applications get ordinary IP services such as UDP sockets and CoAP.
6LoWPAN is the piece that makes IPv6 fit. The IETF defined it in RFC 4944, which describes how to carry IPv6 packets over IEEE 802.15.4 networks, form addresses for them and compress their headers. The RFC explains why this is needed: IPv6 over 802.15.4 uses a 1,280-octet MTU, but the 802.15.4 physical layer packet is at most 127 octets, so a full IPv6 packet does not fit in one frame and has to be compressed and fragmented. Because Thread devices have IPv6 addresses, the Thread Group describes direct device-to-device, device-to-mobile and device-to-cloud communication, with a border router linking the Thread network to the others.
Roles in a Thread network
OpenThread’s primer splits devices by what they forward:
- Mesh Extenders forward packets for other devices, help new devices join, and keep their radio on all the time.
- End Devices talk to a single Mesh Extender, their parent, and do not forward anything. They can switch their radio off to save power. A Sleepy End Device wakes now and then to poll its parent for messages.
Devices that can take either role switch automatically. A standby device promotes itself when it is the only one in reach of a new device, and a Mesh Extender with no children can step back down. One Mesh Extender is self-elected as the Leader, which manages the set of Mesh Extenders and distributes network-wide configuration. A Border Router forwards traffic between the Thread network and other networks such as Wi-Fi, and a network can have several.
The primer gives the limits: one Leader, 32 Mesh Extenders, and 511 End Devices per Mesh Extender. Thread tries to keep the number of Mesh Extenders between 16 and 23.
Joining and staying connected
A device first needs the network’s credentials, which it gets through Thread commissioning. To find a network, it sends an 802.15.4 beacon request on each channel, and nearby devices that can act as Mesh Extenders answer with the network’s identifiers and name.
From there, Thread uses Mesh Link Establishment (MLE) to set up links. Every device attaches first as a child: it multicasts a Parent Request, nearby Mesh Extenders send Parent Responses describing themselves and their link quality, and the device picks a parent and completes the exchange. Routes between Mesh Extenders spread in a way OpenThread compares to RIP, a distance-vector routing protocol.
OpenThread describes the result as self-healing mesh networking with no single point of failure. The Leader is self-elected, for fault tolerance, rather than fixed in advance. If groups of devices lose radio contact with each other, each group carries on as its own partition with its own Leader, and partitions merge again automatically when they come back into range.
Security and border routers
According to OpenThread, all devices in a Thread network are authenticated and all communications are encrypted. The security credentials define the network itself: devices that share them belong to the same Thread network, even when radio gaps split it into partitions.
The border router is how a Thread network meets everything else. OpenThread lists the minimum it must do: route IP traffic in both directions between Thread and Wi-Fi or Ethernet, bridge DNS-based service discovery between mDNS on the home network and SRP on the Thread side, merge Thread partitions over IP links, and let an external commissioner, such as a phone, add new devices. The Thread Group stresses that a border router is a function, not a particular box, and some Wi-Fi access points include one.
Thread 1.4 adds features aimed at homes with several border routers from different makers, including credential sharing, Thread over infrastructure and network diagnostics. The group says it remains backward compatible with earlier Thread devices.