1# OpenThread CLI - Operational Datasets 2 3## Overview 4 5Thread network configuration parameters are managed using Active and Pending Operational Dataset objects. 6 7### Active Operational Dataset 8 9The Active Operational Dataset includes parameters that are currently in use across an entire Thread network. The Active Operational Dataset contains: 10 11- Active Timestamp 12- Channel 13- Channel Mask 14- Extended PAN ID 15- Mesh-Local Prefix 16- Network Name 17- PAN ID 18- PSKc 19- Security Policy 20 21### Pending Operational Dataset 22 23The Pending Operational Dataset is used to communicate changes to the Active Operational Dataset before they take effect. The Pending Operational Dataset contains all the parameters from the Active Operational Dataset, with the addition of: 24 25- Delay Timer 26- Pending Timestamp 27 28## Quick Start 29 30### Form Network 31 321. Generate and view new network configuration. 33 34 ```bash 35 > dataset init new 36 Done 37 > dataset 38 Active Timestamp: 1 39 Channel: 13 40 Channel Mask: 0x07fff800 41 Ext PAN ID: d63e8e3e495ebbc3 42 Mesh Local Prefix: fd3d:b50b:f96d:722d::/64 43 Network Key: dfd34f0f05cad978ec4e32b0413038ff 44 Network Name: OpenThread-8f28 45 PAN ID: 0x8f28 46 PSKc: c23a76e98f1a6483639b1ac1271e2e27 47 Security Policy: 0, onrcb 48 Done 49 ``` 50 512. Commit new dataset to the Active Operational Dataset in non-volatile storage. 52 53 ```bash 54 dataset commit active 55 Done 56 ``` 57 583. Enable Thread interface 59 60 ```bash 61 > ifconfig up 62 Done 63 > thread start 64 Done 65 ``` 66 67### Attach to Existing Network 68 69Only the Network Key is required for a device to attach to a Thread network. 70 71While not required, specifying the channel avoids the need to search across multiple channels, improving both latency and efficiency of the attach process. 72 73After the device successfully attaches to a Thread network, the device will retrieve the complete Active Operational Dataset. 74 751. Create a partial Active Operational Dataset. 76 77 ```bash 78 > dataset networkkey dfd34f0f05cad978ec4e32b0413038ff 79 Done 80 > dataset commit active 81 Done 82 ``` 83 842. Enable Thread interface. 85 86 ```bash 87 > ifconfig up 88 Done 89 > thread start 90 Done 91 ``` 92 933. After attaching, validate that the device received the complete Active Operational Dataset. 94 95 ```bash 96 > dataset active 97 Active Timestamp: 1 98 Channel: 13 99 Channel Mask: 0x07fff800 100 Ext PAN ID: d63e8e3e495ebbc3 101 Mesh Local Prefix: fd3d:b50b:f96d:722d::/64 102 Network Key: dfd34f0f05cad978ec4e32b0413038ff 103 Network Name: OpenThread-8f28 104 PAN ID: 0x8f28 105 PSKc: c23a76e98f1a6483639b1ac1271e2e27 106 Security Policy: 0, onrcb 107 Done 108 ``` 109 110## Command List 111 112- [help](#help) 113- [active](#active) 114- [activetimestamp](#activetimestamp) 115- [channel](#channel) 116- [channelmask](#channelmask) 117- [clear](#clear) 118- [commit](#commit) 119- [delay](#delay) 120- [extpanid](#extpanid) 121- [init](#init) 122- [meshlocalprefix](#meshlocalprefix) 123- [mgmtgetcommand](#mgmtgetcommand) 124- [mgmtsetcommand](#mgmtsetcommand) 125- [networkkey](#networkkey) 126- [networkname](#networkname) 127- [panid](#panid) 128- [pending](#pending) 129- [pendingtimestamp](#pendingtimestamp) 130- [pskc](#pskc) 131- [securitypolicy](#securitypolicy) 132 133## Command Details 134 135### help 136 137Usage: `dataset help` 138 139Print dataset help menu. 140 141```bash 142> dataset help 143help 144active 145activetimestamp 146channel 147channelmask 148clear 149commit 150delay 151extpanid 152init 153meshlocalprefix 154mgmtgetcommand 155mgmtsetcommand 156networkkey 157networkname 158panid 159pending 160pendingtimestamp 161pskc 162securitypolicy 163Done 164``` 165 166### active 167 168Usage: `dataset active [-x]` 169 170Print Active Operational Dataset in human-readable form. 171 172```bash 173> dataset active 174Active Timestamp: 1 175Channel: 13 176Channel Mask: 0x07fff800 177Ext PAN ID: d63e8e3e495ebbc3 178Mesh Local Prefix: fd3d:b50b:f96d:722d::/64 179Network Key: dfd34f0f05cad978ec4e32b0413038ff 180Network Name: OpenThread-8f28 181PAN ID: 0x8f28 182PSKc: c23a76e98f1a6483639b1ac1271e2e27 183Security Policy: 0, onrcb 184Done 185``` 186 187Print Active Operational Dataset as hex-encoded TLVs. 188 189```bash 190> dataset active -x 1910e080000000000010000000300001035060004001fffe002084eb74ab03c56e6d00708fdc7fe165c83a67805108e2104f183e698da87e96efc1e45aa51030f4f70656e5468726561642d383631310102861104108d6273023d82c841eff0e68db86f35740c030000ff 192Done 193``` 194 195### activetimestamp 196 197Usage: `dataset activetimestamp [timestamp]` 198 199Get active timestamp. 200 201```bash 202> dataset activetimestamp 203123456789 204Done 205``` 206 207Set active timestamp. 208 209```bash 210> dataset activetimestamp 123456789 211Done 212``` 213 214### channel 215 216Usage: `channel [channel]` 217 218Get channel. 219 220```bash 221> dataset channel 22212 223Done 224``` 225 226Set channel. 227 228```bash 229> dataset channel 12 230Done 231``` 232 233### channelmask 234 235Usage: `dataset channelmask [channelmask]` 236 237Get channel mask. 238 239```bash 240> dataset channelmask 2410x07fff800 242Done 243``` 244 245Set channel mask. 246 247```bash 248> dataset channelmask 0x07fff800 249Done 250``` 251 252### clear 253 254Usage: `dataset clear` 255 256Reset operational dataset buffer. 257 258```bash 259> dataset clear 260Done 261``` 262 263### commit 264 265Usage: `dataset commit <active|pending>` 266 267Commit operational dataset buffer to active/pending operational dataset. 268 269```bash 270> dataset commit active 271Done 272``` 273 274### delay 275 276Usage: `dataset delay [delay]` 277 278Get delay timer value. 279 280```bash 281> dataset delay 2821000 283Done 284``` 285 286Set delay timer value. 287 288```bash 289> dataset delay 1000 290Done 291``` 292 293### extpanid 294 295Usage: `dataset extpanid [extpanid]` 296 297Get extended panid. 298 299```bash 300> dataset extpanid 301000db80123456789 302Done 303``` 304 305Set extended panid. 306 307**NOTE** The commissioning credential in the dataset buffer becomes stale after changing this value. Use [pskc](#pskc) to reset. 308 309```bash 310> dataset extpanid 000db80123456789 311Done 312``` 313 314### init 315 316Usage: `dataset init <active|new|pending|tlvs <hex-encoded TLVs>>` 317 318Initialize operational dataset buffer. 319 320```bash 321> dataset init new 322Done 323``` 324 325### meshlocalprefix 326 327Usage: `dataset meshlocalprefix [prefix]` 328 329Get mesh local prefix. 330 331```bash 332> dataset meshlocalprefix 333fd00:db8:0:0::/64 334Done 335``` 336 337Set mesh local prefix. 338 339```bash 340> dataset meshlocalprefix fd00:db8:: 341Done 342``` 343 344### mgmtgetcommand 345 346Usage: `dataset mgmtgetcommand <active|pending> [address <destination>] [TLV list] [-x]` 347 348Send MGMT_ACTIVE_GET or MGMT_PENDING_GET. 349 350```bash 351> dataset mgmtgetcommand active address fdde:ad00:beef:0:558:f56b:d688:799 activetimestamp securitypolicy 352Done 353``` 354 355### mgmtsetcommand 356 357Usage: `dataset mgmtsetcommand <active|pending> [TLV Type list] [-x]` 358 359Send MGMT_ACTIVE_SET or MGMT_PENDING_SET. 360 361```bash 362> dataset mgmtsetcommand active activetimestamp 123 securitypolicy 1 onrcb 363Done 364``` 365 366### networkkey 367 368Usage: `dataset networkkey [key]` 369 370Get network key 371 372```bash 373> dataset networkkey 37400112233445566778899aabbccddeeff 375Done 376``` 377 378Set network key. 379 380```bash 381> dataset networkkey 00112233445566778899aabbccddeeff 382Done 383``` 384 385### networkname 386 387Usage: `dataset networkname [name]` 388 389Get network name. 390 391```bash 392> datset networkname 393OpenThread 394Done 395``` 396 397Set network name. 398 399**NOTE** The commissioning credential in the dataset buffer becomes stale after changing this value. Use [pskc](#pskc) to reset. 400 401```bash 402> dataset networkname OpenThread 403Done 404``` 405 406### panid 407 408Usage: `dataset panid [panid]` 409 410Get panid. 411 412```bash 413> dataset panid 4140x1234 415Done 416``` 417 418Set panid. 419 420```bash 421> dataset panid 0x1234 422Done 423``` 424 425### pending 426 427Usage: `dataset pending [-x]` 428 429Print Pending Operational Dataset in human-readable form. 430 431```bash 432> dataset pending 433Pending Timestamp: 2 434Active Timestamp: 15 435Channel: 16 436Channel Mask: 0x07fff800 437Delay: 58706 438Ext PAN ID: d63e8e3e495ebbc3 439Mesh Local Prefix: fd3d:b50b:f96d:722d::/64 440Network Key: dfd34f0f05cad978ec4e32b0413038ff 441Network Name: OpenThread-8f28 442PAN ID: 0x8f28 443PSKc: c23a76e98f1a6483639b1ac1271e2e27 444Security Policy: 0, onrcb 445Done 446``` 447 448Print Pending Operational Dataset as hex-encoded TLVs. 449 450```bash 451> dataset pending -x 4520e080000000000010000000300001035060004001fffe002084eb74ab03c56e6d00708fdc7fe165c83a67805108e2104f183e698da87e96efc1e45aa51030f4f70656e5468726561642d383631310102861104108d6273023d82c841eff0e68db86f35740c030000ff 453Done 454``` 455 456### pendingtimestamp 457 458Usage: `dataset pendingtimestamp [timestamp]` 459 460Get pending timestamp. 461 462```bash 463> dataset pendingtimestamp 464123456789 465Done 466``` 467 468Set pending timestamp. 469 470```bash 471> dataset pendingtimestamp 123456789 472Done 473``` 474 475### pskc 476 477Usage: `pskc [-p] [<key>|<passphrase>]` 478 479Get pskc. 480 481```bash 482> dataset pskc 48367c0c203aa0b042bfb5381c47aef4d9e 484Done 485``` 486 487Set pskc. 488 489With `-p`(**only for FTD**) generate pskc from \<passphrase\> (UTF-8 encoded) together with network name and extended PAN ID in the dataset buffer if set or values in the current stack if not, otherwise set pskc as \<key\> (hex format). 490 491```bash 492> dataset pskc 67c0c203aa0b042bfb5381c47aef4d9e 493Done 494> dataset pskc -p 123456 495Done 496``` 497 498### securitypolicy 499 500Usage: `dataset securitypolicy [<rotationtime> [onrcbCepR]]` 501 502Get security policy. 503 504```bash 505> dataset securitypolicy 506672 onrcb 507Done 508``` 509 510Set security policy. 511 512- o: Obtaining the Network Key for out-of-band commissioning is enabled. 513- n: Native Commissioning using PSKc is allowed. 514- r: Thread 1.x Routers are enabled. 515- c: External Commissioner authentication is allowed using PSKc. 516- b: Thread 1.x Beacons are enabled. 517- C: Thread 1.2 Commercial Commissioning is enabled. 518- e: Thread 1.2 Autonomous Enrollment is enabled. 519- p: Thread 1.2 Network Key Provisioning is enabled. 520- R: Non-CCM routers are allowed in Thread 1.2 CCM networks. 521 522```bash 523> dataset securitypolicy 672 onrcb 524Done 525``` 526 527### set 528 529Usage: `dataset set <active|pending> <dataset>` 530 531Set the Active Operational Dataset using hex-encoded TLVs. 532 533```bash 534dataset set active 0e080000000000010000000300001035060004001fffe002084eb74ab03c56e6d00708fdc7fe165c83a67805108e2104f183e698da87e96efc1e45aa51030f4f70656e5468726561642d383631310102861104108d6273023d82c841eff0e68db86f35740c030000ff 535Done 536``` 537 538Set the Pending Operational Dataset using hex-encoded TLVs. 539 540```bash 541dataset set pending 0e080000000000010000000300001035060004001fffe002084eb74ab03c56e6d00708fdc7fe165c83a67805108e2104f183e698da87e96efc1e45aa51030f4f70656e5468726561642d383631310102861104108d6273023d82c841eff0e68db86f35740c030000ff 542Done 543``` 544