[![](https://openthread.io/static/images/icon-github.svg)View source on GitHub](https://github.com/openthread/ot-docs/tree/main/site/en/guides/thread-primer/ipv6-addressing.md)

Let's take a look at how Thread identifies each device in the network, and what
types of addresses they use to communicate with each other.

> [!IMPORTANT]
> **Key Term:** In this primer, the term "interface" is used to identify an endpoint of a Thread device within a network. Typically, a single Thread device has a single Thread interface.

## Scopes

[![OT Scopes](https://openthread.io/guides/images/ot-primer-scopes.png)](https://openthread.io/guides/images/ot-primer-scopes.png)

There are three scopes in a Thread network for unicast addressing:

- Link-Local --- all interfaces reachable by a single radio transmission
- Mesh-Local --- all interfaces reachable within the same Thread network
- Global --- all interfaces reachable from outside a Thread network

The first two scopes correspond to prefixes designated by a Thread network.
Link-Local have prefixes of `fe80::/16`, while Mesh-Local have prefixes of
`fd00::/8`.

## Unicast

There are multiple IPv6 unicast addresses that identify a single Thread device.
Each has a different function based on the scope and use case.

Before we detail each type, let's learn more about a common one, called the
Routing Locator (RLOC). The RLOC identifies a Thread interface, based on its
location in the network topology.

### How a Routing Locator is generated

All devices are assigned a Router ID and a Child ID. Each Parent
maintains a table of all its Children, the combination of which
uniquely identifies a device within the topology. For example,
consider the highlighted nodes in the following topology, where the
number in a Mesh Extender (pentagon) is the Router ID, and the number
in an End Device (circle) is the Child ID:
[![OT RLOC Topology](https://openthread.io/guides/images/ot-primer-rloc-topology.png)](https://openthread.io/guides/images/ot-primer-rloc-topology.png)

Each Child's Router ID corresponds to its Parent (Mesh
Extender). Because a Mesh Extender is not a Child, the Child ID for a
Mesh Extender is always 0. Together, these values are unique for each
device in the Thread network, and are used to create the RLOC16, which
represents the last 16 bits of the RLOC.

For example, here's how the RLOC16 is calculated for the upper-left node (Router
ID = 1 and Child ID = 1):
[![OT RLOC16](https://openthread.io/guides/images/ot-primer-rloc16.png)](https://openthread.io/guides/images/ot-primer-rloc16.png)

The RLOC16 is part of the Interface Identifier (IID), which corresponds to the
last 64 bits of the IPv6 address. Some IIDs can be used to identify some types
of Thread interfaces. For example, the IID for RLOCs is always in this form:

```
0000:00ff:fe00:RLOC16
```

The IID, combined with a Mesh-Local Prefix, results in the RLOC. For example,
using a Mesh-Local Prefix of `fde5:8dba:82e1:1::/64`, the RLOC for a node where
RLOC16 = `0x401` is:
[![OT RLOC](https://openthread.io/guides/images/ot-primer-rloc.png)](https://openthread.io/guides/images/ot-primer-rloc.png)

This same logic can be used to determine the RLOC for all highlighted nodes in the sample topology above:
[![OT Topology w/ Address](https://openthread.io/guides/images/ot-primer-rloc-topology-address.png)](https://openthread.io/guides/images/ot-primer-rloc-topology-address.png)

However, because the RLOC is based on the location of the node in the topology,
the RLOC of a node can change as the topology changes.

For example, perhaps node `0x400` is removed from the Thread
network. Nodes `0x401` and `0x402` establish new links to different
Mesh Extenders, and as a result they are each assigned a new RLOC16
and RLOC:
[![OT Topology after Change](https://openthread.io/guides/images/ot-primer-rloc-topology-change.png)](https://openthread.io/guides/images/ot-primer-rloc-topology-change.png)

## Unicast address types

The RLOC is just one of many IPv6 unicast addresses a Thread device can have.
Another category of addresses are called Endpoint Identifiers (EIDs), which
identify a unique Thread interface within a Thread network partition. EIDs are
independent of Thread network topology.

Common unicast types are detailed below.

| ### Link-Local Address (LLA) ||
|---|---|
| An EID that identifies a Thread interface reachable by a single radio transmission. ||
| **Example** | `fe80::54db:881c:3845:57f4` |
| **IID** | Based on 802.15.4 Extended Address |
| **Scope** | Link-Local |
| **Details** | - Used to discover neighbors, configure links, and exchange routing information - Not a routable address - Always has a prefix of `fe80::/16` |

| ### Mesh-Local EID (ML-EID) ||
|---|---|
| An EID that identifies a Thread interface, independent of network topology. Used to reach a Thread interface within the same Thread partition. Also called a Unique Local Address (ULA). ||
| **Example** | `fde5:8dba:82e1:1:416:993c:8399:35ab` |
| **IID** | Random, chosen after commissioning is complete |
| **Scope** | Mesh-Local |
| **Details** | - Does not change as the topology changes - Should be used by applications - Always has a prefix `fd00::/8` |

| ### Routing Locator (RLOC) ||
|---|---|
| Identifies a Thread interface, based on its location in the network topology. ||
| **Example** | `fde5:8dba:82e1:1::ff:fe00:1001` |
| **IID** | `0000:00ff:fe00:RLOC16` |
| **Scope** | Mesh-Local |
| **Details** | - Generated once a device attaches to a network - For delivering IPv6 datagrams within a Thread network - Changes as the topology changes - Generally not used by applications |

| ### Anycast Locator (ALOC) ||
|---|---|
| Identifies a Thread interface via RLOC lookup, when the RLOC of a destination is not known. ||
| **Example** | `fde5:8dba:82e1:1::ff:fe00:fc01` |
| **IID** | `0000:00ff:fe00:fcXX` |
| **Scope** | Mesh-Local |
| **Details** | - `fcXX` = [ALOC destination](https://openthread.io/guides/thread-primer/ipv6-addressing#anycast), which looks up the appropriate RLOC - Generally not used by applications |

| ### Global Unicast Address (GUA) ||
|---|---|
| An EID that identifies a Thread interface on a global scope, beyond a Thread network. ||
| **Example** | `2000::54db:881c:3845:57f4` |
| **IID** | - SLAAC --- Randomly assigned by the device itself - DHCP --- Assigned by a DHCPv6 server - Manual --- Assigned by the application layer |
| **Scope** | Global |
| **Details** | - A public IPv6 address - Always has a prefix of `2000::/3` |

## Multicast

Multicast is used to communicate information to multiple devices at once. In a
Thread network, specific addresses are reserved for multicast use with different
groups of devices, depending on the scope.

| IPv6 Address | Scope | Delivered to |
|---|---|---|
| `ff02::1` | Link-Local | All FTDs and MEDs |
| `ff02::2` | Link-Local | All FTDs |
| `ff03::1` | Mesh-Local | All FTDs and MEDs |
| `ff03::2` | Mesh-Local | All FTDs |

> [!IMPORTANT]
> **Key Point:** A major difference between FTDs and MTDs are that FTDs subscribe to the `ff03::2` multicast address. MTDs do not.

You might notice that Sleepy End Devices (SEDs) are not included as a
recipient in the multicast table above. Instead, Thread defines
link-local and realm-local scope unicast prefix-based IPv6 multicast
address used for All Thread Nodes, including SEDs. These multicast
addresses vary by Thread network, because it is built on the unicast
Mesh-Local prefix (see [RFC 3306](https://tools.ietf.org/html/rfc3306)
for more details on unicast-prefix-based IPv6 multicast addresses).

Arbitrary scopes beyond those already listed are also supported for Thread
devices.

## Anycast

Anycast is used to route traffic to a Thread interface when the RLOC of a
destination is not known. An Anycast Locator (ALOC) identifies the location of
multiple interfaces within a Thread partition. The last 16 bits of an ALOC,
called the ALOC16, is in the format of `0xfcXX`, which
represents the type of ALOC.

For example, an ALOC16 between `0xfc01` and `0xfc0f` is reserved for DHCPv6
Agents. If the specific DHCPv6 Agent RLOC is unknown (perhaps because the
network topology has changed), a message can be sent to a DHCPv6 Agent ALOC to
obtain the RLOC.

Thread defines the following ALOC16 values:

| ALOC16 | Type |
|---|---|
| `0xfc00` | Leader |
| `0xfc01` -- `0xfc0f` | DHCPv6 Agent |
| `0xfc10` -- `0xfc2f` | Service |
| `0xfc30` -- `0xfc37` | Commissioner |
| `0xfc40` -- `0xfc4e` | Neighbor Discovery Agent |
| `0xfc38` -- `0xfc3f` `0xfc4f` -- `0xfcff` | Reserved |

## Recap

What you've learned:

- A Thread network consists of three scopes: Link-Local, Mesh-Local, and Global
- A Thread device has multiple unicast IPv6 addresses
  - An RLOC represents a device's location in the Thread network
  - An ML-EID is unique to a Thread device within a partition and should be used by applications
- Thread uses multicast to forward data to groups of nodes
- Thread uses anycast when the RLOC of a destination is unknown

To learn more about Thread's IPv6 addressing, see sections 5.2 and 5.3 of the
[Thread Specification](http://threadgroup.org/ThreadSpec).

## Check your understanding

Which three scopes are used for unicast addressing in a Thread network? Private Incorrect. Interface-Local Incorrect. Link-Local Correct. Site-Local Incorrect. Mesh-Local Correct. Global Correct. What does it mean when a device has a Child ID of 0? The device is a Child. Incorrect. The device is an Extender-Capable Device. Close, but incorrect. The device is a Mesh Extender. Correct. A Mesh Extender always has a Child ID of 0. A camera, which is a node on a Thread network, receives a new RLOC16 and RLOC. Which of the following events might have caused this? Someone remotely downloaded images from the camera. Incorrect. This event would have no bearing on the Thread network. A Mesh Extender dropped off the network. Correct. When a Mesh Extender drops off a network, the network topology changes, which may result in the device promoting itself to a Mesh Extender and obtaining a new RLOC. The camera entered sleep mode, which changed the network topology. Incorrect. Entering sleep mode wouldn't necessarily cause a device to receive a new network address. A device on a Thread network subscribes to the `ff03::2` multicast address. What does this tell us about the device? It is a Minimal End Device (MED). Incorrect. It is a Full End Device (FED). Incorrect. (Hint: It might or might not be a FED.) It is a Minimal Thread Device (MTD). Incorrect. It is a Full Thread Device (FTD). Correct. Only Full Thread Devices subscribe to the `ff03::2` multicast address. They do so in the Mesh-Local scope. What type of addressing and routing does Thread use to forward data to groups of nodes? unicast Incorrect. anycast Incorrect. multicast Correct. broadcast Incorrect. What type of addressing and routing does a Thread device use when the RLOC of its intended message recipient is unknown? unicast Incorrect. anycast Correct. Anycast allows a device to reach a node whose RLOC is not known, by addressing the device's ALOC. multicast Incorrect. broadcast Incorrect.