Network Discovery and Formation

View source on GitHub

Thread networks

Thread networks are identified by three unique identifiers:

  • 2-byte Personal Area Network ID (PAN ID)
  • 8-byte Extended Personal Area Network ID (XPAN ID)
  • A human-readable Network Name

For example, a Thread network may have the following identifiers:

Identifier Value
PAN ID 0xBEEF
XPAN ID 0xBEEF1111CAFE2222
Network Name yourThreadCafe
OT Active Scan

When creating a new Thread network, or searching for an existing one to join, a Thread device performs an active scan for 802.15.4 networks within radio range:

  1. The device broadcasts an 802.15.4 Beacon Request on a specific Channel.
  2. In return, any Routers or Router Eligible End Devices (REEDs) in range broadcast a Beacon that contains their Thread network PAN ID, XPAN ID, and Network Name.
  3. The device repeats the previous two steps for each Channel.

Once a Thread device has discovered all networks in range, it can either attach to an existing network, or create a new one if no networks are discovered.

Thread uses the Mesh Link Establishment (MLE) protocol to configure links and disseminate information about the network to Thread devices.

In link configuration, MLE is used to:

  • Discover links to neighboring devices
  • Determine the quality of links to neighboring devices
  • Establish links to neighboring devices
  • Negotiate link parameters (device type, frame counters, timeout) with peers

MLE disseminates the following types of information to devices wishing to establish links:

  • Leader data (Leader RLOC, Partition ID, Partition weight)
  • Network data (on-mesh prefixes, address autoconfiguration, more-specific routes)
  • Route propagation

Route propagation in Thread works similar to the Routing Information Protocol (RIP), a distance-vector routing protocol.

Create a new network

If the device elects to create a new network, it selects the least busy Channel and a PAN ID not in use by other networks, then becomes a Router and elects itself the Leader. This device sends MLE Advertisement messages to other 802.15.4 devices to inform them of its link state, and responds to Beacon Requests by other Thread devices performing an active scan.

Join an existing network

If the device elects to join an existing network, it configures its Channel, PAN ID, XPAN ID, and Network Name to match that of the target network via Thread Commissioning, then goes through the MLE Attach process to attach as a Child (End Device). This process is used for Child-Parent links.

  1. The Child sends a multicast Parent Request to all neighboring Routers and REEDs in the target network.
  2. All neighboring Routers and REEDs (if the Parent Request Scan Mask includes REEDs) send Parent Responses with information about themselves.
  3. The Child chooses a Parent device and sends a Child ID Request to it.
  4. The Parent sends a Child ID Response to confirm link establishment.

1. Parent Request

A Parent Request is a multicast request from the attaching device that is used to discover neighboring Routers and Router Eligible End Devices (REEDs) in the target network.

OT MLE Attach Parent Request
Parent Request Message Contents
Mode Describes the attaching device
Challenge Tests the timeliness of the Parent Response to prevent replay attacks
Scan Mask Limits the request to only Routers or to both Routers and REEDs

2. Parent Response

A Parent Response is a unicast response to a Parent Request that provides information about a Router or REED to the attaching device.

OT MLE Attach Parent Response
Parent Response Message Contents
Version Thread protocol version
Response Copy of the Parent Request Challenge
Link Frame Counter 802.15.4 Frame Counter on the Router/REED
MLE Frame Counter MLE Frame Counter on the Router/REED
Source Address RLOC16 of the Router/REED
Link Margin Receive signal quality of the Router/REED
Connectivity Describes the Router/REED’s level of connectivity
Leader Data Information about the Router/REED’s Leader
Challenge Tests the timeliness of the Child ID Request to prevent replay attacks

3. Child ID Request

A Child ID Request is a unicast request from the attaching device (Child) that is sent to the Router or REED (Parent) for the purpose of establishing a Child-Parent link. If the request is sent to a REED, it upgrades itself to a Router before accepting the request.

OT MLE Attach Child ID Request
Child ID Request Message Contents
Version Thread protocol version
Response Copy of the Parent Response Challenge
Link Frame Counter 802.15.4 Frame Counter on the Child
MLE Frame CounterMLE Frame Counter on the Child
Mode Describes the Child
Timeout Inactivity duration before the Parent removes the Child
Address Registration (MEDs and SEDs only) Register IPv6 addresses

4. Child ID Response

A Child ID Response is a unicast response from the Parent that is sent to the Child to confirm that a Child-Parent link has been established.

OT MLE Attach Child ID Response
Child ID Response Message Contents
Source Address Parent's RLOC16
Address16 Child's RLOC16
Leader Data Information about the Parent’s Leader (RLOC, Partition ID, Partition weight)
Network Data Information about the Thread network (on-mesh prefixes, address autoconfiguration, more-specific routes)
Route (REED only) Route propagation
Timeout Inactivity duration before the Parent removes the Child
Address Registration (MEDs and SEDs only) Confirm registered addresses

Recap

What you've learned:

  • A Thread device performs an active scan for existing networks
  • Thread uses Mesh Link Establishment to configure links and disseminate information about network devices
  • MLE Advertisement messages inform other Thread devices about a device's network and link state
  • The MLE Attach process establishes Child-Parent links

Check your understanding

Which identifier is not used to identify a Thread network?
A 2-byte Personal Area Network ID (PAN ID).
Incorrect. A thread network is identified, in part, by a PAN ID.
An 8-byte Extended Personal Area Network ID (XPAN ID).
Incorrect. A thread network is identified, in part, by an XPAN ID.
A human-readable Network Name.
Incorrect. A thread network is identified, in part, by a human-readable Network Name.
A 32-character SSID.
Correct. Unlike an 802.11 WiFi network, Thread network identifiers do not use an SSID.
What is a Parent Request used for?
To discover neighboring Routers and Router Eligible End Devices (REEDs) in the target network.
Correct. A Parent Request is issued by a device seeking to attach to a network.
To announce that a Router is becoming a parent.
Incorrect. A Router does not initiate a Parent-Child relationship with another network device. Instead, a network device selects a Router to become its Child.
To request that a Router Eligible End Device be promoted to a Router.
Incorrect.
A Parent Request uses what type of address?
unicast
Incorrect.
anycast
Incorrect.
multicast
Correct.
broadcast
Incorrect.
When a device initially attaches to a Thread network, what is its device classification?
Child (End Device)
Correct. A device joining a Thread network always starts out as an End Device on that network.
FTD (Full Thread Device)
Incorrect.
REED (Router-Eligible End Device)
Incorrect.