1# OpenThread CLI - Network Data 2 3## Overview 4 5Thread Network Data contains information about Border Routers and other servers available in the Thread network. Border Routers and devices offering services register their information with the Leader. The Leader collects and structures this information within the Thread Network Data and distributes the information to all devices in the Thread Network. 6 7Border Routers may register prefixes assigned to the Thread Network and prefixes that they offer routes for. Services may register any information relevant to the service itself. 8 9Border Router and service information may be stable or temporary. Stable Thread Network Data is distributed to all devices, including Sleepy End Devices (SEDs). Temporary Network Data is distributed to all nodes except SEDs. 10 11## Quick Start 12 13### Form Network and Configure Prefix 14 151. Generate and view new network configuration. 16 17 ```bash 18 > dataset init new 19 Done 20 > dataset 21 Active Timestamp: 1 22 Channel: 13 23 Channel Mask: 0x07fff800 24 Ext PAN ID: d63e8e3e495ebbc3 25 Mesh Local Prefix: fd3d:b50b:f96d:722d::/64 26 Network Key: dfd34f0f05cad978ec4e32b0413038ff 27 Network Name: OpenThread-8f28 28 PAN ID: 0x8f28 29 PSKc: c23a76e98f1a6483639b1ac1271e2e27 30 Security Policy: 0, onrcb 31 Done 32 ``` 33 342. Commit new dataset to the Active Operational Dataset in non-volatile storage. 35 36 ```bash 37 dataset commit active 38 Done 39 ``` 40 413. Enable Thread interface 42 43 ```bash 44 > ifconfig up 45 Done 46 > thread start 47 Done 48 ``` 49 504. Observe IPv6 addresses assigned to the Thread inteface. 51 52 ```bash 53 > ipaddr 54 fd3d:b50b:f96d:722d:0:ff:fe00:fc00 55 fd3d:b50b:f96d:722d:0:ff:fe00:dc00 56 fd3d:b50b:f96d:722d:393c:462d:e8d2:db32 57 fe80:0:0:0:a40b:197f:593d:ca61 58 Done 59 ``` 60 615. Register an IPv6 prefix assigned to the Thread network. 62 63 ```bash 64 > prefix add fd00:dead:beef:cafe::/64 paros 65 Done 66 > netdata register 67 Done 68 ``` 69 706. Observe Thread Network Data. 71 72 ```bash 73 > netdata show 74 Prefixes: 75 fd00:dead:beef:cafe::/64 paros med dc00 76 Routes: 77 Services: 78 Done 79 ``` 80 817. Observe IPv6 addresses assigned to the Thread interface. 82 83 ```bash 84 > ipaddr 85 fd00:dead:beef:cafe:4da8:5234:4aa2:4cfa 86 fd3d:b50b:f96d:722d:0:ff:fe00:fc00 87 fd3d:b50b:f96d:722d:0:ff:fe00:dc00 88 fd3d:b50b:f96d:722d:393c:462d:e8d2:db32 89 fe80:0:0:0:a40b:197f:593d:ca61 90 Done 91 ``` 92 93### Attach to Existing Network 94 95Only the Network Key is required for a device to attach to a Thread network. 96 97While not required, specifying the channel avoids the need to search across multiple channels, improving both latency and efficiency of the attach process. 98 99After the device successfully attaches to a Thread network, the device will retrieve the complete Active Operational Dataset. 100 1011. Create a partial Active Operational Dataset. 102 103 ```bash 104 > dataset networkkey dfd34f0f05cad978ec4e32b0413038ff 105 Done 106 > dataset commit active 107 Done 108 ``` 109 1102. Enable Thread interface. 111 112 ```bash 113 > ifconfig up 114 Done 115 > thread start 116 Done 117 ``` 118 1193. After attaching, observe Thread Network Data. 120 121 ```bash 122 > netdata show 123 Prefixes: 124 fd00:dead:beef:cafe::/64 paros med dc00 125 Routes: 126 Services: 127 Done 128 ``` 129 1304. Observe IPv6 addresses assigned to the Thread interface. 131 132 ```bash 133 > ipaddr 134 fd00:dead:beef:cafe:4da8:5234:4aa2:4cfa 135 fd3d:b50b:f96d:722d:0:ff:fe00:fc00 136 fd3d:b50b:f96d:722d:0:ff:fe00:dc00 137 fd3d:b50b:f96d:722d:393c:462d:e8d2:db32 138 fe80:0:0:0:a40b:197f:593d:ca61 139 Done 140 ``` 141 142## Command List 143 144- [help](#help) 145- [publish](#publish) 146- [register](#register) 147- [show](#show) 148- [steeringdata](#steeringdata-check-eui64discerner) 149- [unpublish](#unpublish) 150 151## Command Details 152 153### help 154 155Usage: `netdata help` 156 157Print netdata help menu. 158 159```bash 160> netdata help 161help 162publish 163register 164show 165steeringdata 166unpublish 167Done 168``` 169 170### publish 171 172The Network Data Publisher provides mechanisms to limit the number of similar Service and/or Prefix (on-mesh prefix or external route) entries in the Thread Network Data by monitoring the Network Data and managing if or when to add or remove entries. 173 174The Publisher requires `OPENTHREAD_CONFIG_NETDATA_PUBLISHER_ENABLE`. 175 176### publish dnssrp 177 178Publish DNS/SRP service entry. 179 180This command requires `OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE`. 181 182The following formats are available: : 183 184- `netdata publish dnssrp anycast <seq-num>` to publish "DNS/SRP Service Anycast Address" with a given sequence number. 185- `netdata publish dnssrp unicast <address> <port>` to publish "DNS/SRP Service Unicast Address" with given address and port number info. The address/port info is included in Service TLV data. 186- `netdata publish dnssrp unicast <port>` to publish "DNS/SRP Service Unicast Address" with given port number and the device's mesh-local EID for the address. The address and port info is included in Server TLV data. 187 188A new call to `netdata publish dnssrp [anycast|unicast] [...]` command will remove and replace any previous "DNS/SRP Service" entry that was being published (from earlier `netdata publish dnssrp [...]` commands). 189 190```bash 191> netdata publish dnssrp anycast 1 192Done 193 194> netdata publish dnssrp unicast fd00::1234 51525 195Done 196 197> netdata publish dnssrp unicast 50152 198Done 199``` 200 201### publish prefix \<prefix\> [padcrosnD][prf] 202 203Publish an on-mesh prefix entry. 204 205- p: Preferred flag 206- a: Stateless IPv6 Address Autoconfiguration flag 207- d: DHCPv6 IPv6 Address Configuration flag 208- c: DHCPv6 Other Configuration flag 209- r: Default Route flag 210- o: On Mesh flag 211- s: Stable flag 212- n: Nd Dns flag 213- D: Domain Prefix flag (only available for Thread 1.2). 214- prf: Preference, which may be 'high', 'med', or 'low'. 215 216```bash 217> netdata publish prefix fd00:1234:5678::/64 paos med 218Done 219``` 220 221### publish route \<prefix\> [sn][prf] 222 223Publish an external route entry. 224 225- s: Stable flag 226- n: NAT64 flag 227- prf: Preference, which may be: 'high', 'med', or 'low'. 228 229```bash 230> netdata publish route fd00:1234:5678::/64 s high 231Done 232``` 233 234### register 235 236Usage: `netdata register` 237 238Register configured prefixes, routes, and services with the Leader. 239 240```bash 241> netdata register 242Done 243``` 244 245### show 246 247Usage: `netdata show [-x]` 248 249Print Network Data received from the Leader. 250 251```bash 252> netdata show 253Prefixes: 254fd00:dead:beef:cafe::/64 paros med dc00 255Routes: 256Services: 257Done 258``` 259 260Print Network Data as hex-encoded TLVs. 261 262```bash 263> netdata show -x 26408040b02174703140040fd00deadbeefcafe0504dc00330007021140 265Done 266``` 267 268### netdata steeringdata check \<eui64\>|\<discerner\> 269 270Check whether the steering data includes a joiner. 271 272- eui64: The IEEE EUI-64 of the Joiner. 273- discerner: The Joiner discerner in format `number/length`. 274 275```bash 276> netdata steeringdata check d45e64fa83f81cf7 277Done 278> netdata steeringdata check 0xabc/12 279Done 280> netdata steeringdata check 0xdef/12 281Error 23: NotFound 282``` 283 284### unpublish 285 286This command unpublishes a previously published Network Data entry. 287 288This command requires `OPENTHREAD_CONFIG_NETDATA_PUBLISHER_ENABLE`. 289 290### unpublish dnssrp 291 292Unpublishes DNS/SRP Service entry (available when `OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE` is enabled): 293 294- `netdata unpublish dnssrp` to unpublish "DNS/SRP Service" entry (anycast or unciast). 295 296```bash 297> netdata unpublish dnssrp 298Done 299``` 300 301### unpublish \<prefix\> 302 303Unpublishes a previously published on-mesh prefix or external route entry. 304 305```bash 306> netdata unpublish fd00:1234:5678::/64 307Done 308``` 309