|
Name |
|
Date |
Size |
#Lines |
LOC |
| .. | | - | - |
| BUILD.gn | D | 18-Mar-2025 | 2.9 KiB | 94 | 88 |
| CMakeLists.txt | D | 18-Mar-2025 | 2.7 KiB | 81 | 73 |
| README.md | D | 18-Mar-2025 | 96.4 KiB | 4,511 | 3,294 |
| README_BR.md | D | 18-Mar-2025 | 9.3 KiB | 409 | 287 |
| README_COAP.md | D | 18-Mar-2025 | 5.8 KiB | 243 | 180 |
| README_COAPS.md | D | 18-Mar-2025 | 6.2 KiB | 304 | 222 |
| README_COMMISSIONER.md | D | 18-Mar-2025 | 5.6 KiB | 269 | 186 |
| README_COMMISSIONING.md | D | 18-Mar-2025 | 2.3 KiB | 122 | 91 |
| README_DATASET.md | D | 18-Mar-2025 | 19.3 KiB | 856 | 636 |
| README_HISTORY.md | D | 18-Mar-2025 | 34.4 KiB | 653 | 549 |
| README_JOINER.md | D | 18-Mar-2025 | 1.3 KiB | 109 | 75 |
| README_NETDATA.md | D | 18-Mar-2025 | 12.4 KiB | 493 | 362 |
| README_SRP.md | D | 18-Mar-2025 | 3.8 KiB | 188 | 151 |
| README_SRP_CLIENT.md | D | 18-Mar-2025 | 8.7 KiB | 457 | 320 |
| README_SRP_SERVER.md | D | 18-Mar-2025 | 4 KiB | 240 | 174 |
| README_TCAT.md | D | 18-Mar-2025 | 1.2 KiB | 125 | 86 |
| README_TCP.md | D | 18-Mar-2025 | 5.8 KiB | 234 | 161 |
| README_UDP.md | D | 18-Mar-2025 | 4.3 KiB | 232 | 160 |
| cli.cpp | D | 18-Mar-2025 | 242.6 KiB | 8,412 | 4,292 |
| cli.hpp | D | 18-Mar-2025 | 14.3 KiB | 425 | 277 |
| cli_bbr.cpp | D | 18-Mar-2025 | 13.8 KiB | 499 | 208 |
| cli_bbr.hpp | D | 18-Mar-2025 | 3.2 KiB | 94 | 27 |
| cli_br.cpp | D | 18-Mar-2025 | 25.9 KiB | 925 | 416 |
| cli_br.hpp | D | 18-Mar-2025 | 3.5 KiB | 107 | 38 |
| cli_coap.cpp | D | 18-Mar-2025 | 39.1 KiB | 1,182 | 759 |
| cli_coap.hpp | D | 18-Mar-2025 | 6.9 KiB | 185 | 104 |
| cli_coap_secure.cpp | D | 18-Mar-2025 | 32.6 KiB | 1,060 | 631 |
| cli_coap_secure.hpp | D | 18-Mar-2025 | 6.2 KiB | 165 | 84 |
| cli_commissioner.cpp | D | 18-Mar-2025 | 23.6 KiB | 738 | 381 |
| cli_commissioner.hpp | D | 18-Mar-2025 | 4.5 KiB | 114 | 42 |
| cli_config.h | D | 18-Mar-2025 | 6.5 KiB | 196 | 56 |
| cli_dataset.cpp | D | 18-Mar-2025 | 35.9 KiB | 1,345 | 680 |
| cli_dataset.hpp | D | 18-Mar-2025 | 5.9 KiB | 145 | 74 |
| cli_dns.cpp | D | 18-Mar-2025 | 25.4 KiB | 759 | 371 |
| cli_dns.hpp | D | 18-Mar-2025 | 5.2 KiB | 133 | 61 |
| cli_extension_example.c | D | 18-Mar-2025 | 2.3 KiB | 58 | 20 |
| cli_extension_example.cmake | D | 18-Mar-2025 | 2 KiB | 40 | 33 |
| cli_history.cpp | D | 18-Mar-2025 | 72.1 KiB | 1,478 | 569 |
| cli_history.hpp | D | 18-Mar-2025 | 4 KiB | 111 | 41 |
| cli_joiner.cpp | D | 18-Mar-2025 | 7.6 KiB | 284 | 115 |
| cli_joiner.hpp | D | 18-Mar-2025 | 3.2 KiB | 93 | 26 |
| cli_link_metrics.cpp | D | 18-Mar-2025 | 21 KiB | 606 | 364 |
| cli_link_metrics.hpp | D | 18-Mar-2025 | 5.6 KiB | 131 | 53 |
| cli_mac_filter.cpp | D | 18-Mar-2025 | 16.4 KiB | 510 | 217 |
| cli_mac_filter.hpp | D | 18-Mar-2025 | 3.5 KiB | 102 | 32 |
| cli_mdns.cpp | D | 18-Mar-2025 | 29.9 KiB | 1,157 | 849 |
| cli_mdns.hpp | D | 18-Mar-2025 | 5.5 KiB | 142 | 69 |
| cli_mesh_diag.cpp | D | 18-Mar-2025 | 18.8 KiB | 540 | 285 |
| cli_mesh_diag.hpp | D | 18-Mar-2025 | 4.8 KiB | 117 | 41 |
| cli_network_data.cpp | D | 18-Mar-2025 | 27.5 KiB | 1,002 | 505 |
| cli_network_data.hpp | D | 18-Mar-2025 | 5.3 KiB | 147 | 37 |
| cli_ping.cpp | D | 18-Mar-2025 | 7.6 KiB | 258 | 164 |
| cli_ping.hpp | D | 18-Mar-2025 | 3.4 KiB | 95 | 26 |
| cli_srp_client.cpp | D | 18-Mar-2025 | 30.8 KiB | 1,014 | 455 |
| cli_srp_client.hpp | D | 18-Mar-2025 | 4.2 KiB | 110 | 39 |
| cli_srp_server.cpp | D | 18-Mar-2025 | 16.7 KiB | 579 | 280 |
| cli_srp_server.hpp | D | 18-Mar-2025 | 3.2 KiB | 94 | 26 |
| cli_tcat.cpp | D | 18-Mar-2025 | 13.3 KiB | 380 | 242 |
| cli_tcat.hpp | D | 18-Mar-2025 | 3.1 KiB | 89 | 25 |
| cli_tcp.cpp | D | 18-Mar-2025 | 38.9 KiB | 1,230 | 812 |
| cli_tcp.hpp | D | 18-Mar-2025 | 11.9 KiB | 226 | 143 |
| cli_udp.cpp | D | 18-Mar-2025 | 13.4 KiB | 478 | 216 |
| cli_udp.hpp | D | 18-Mar-2025 | 3.4 KiB | 92 | 25 |
| cli_utils.cpp | D | 18-Mar-2025 | 19.8 KiB | 787 | 560 |
| cli_utils.hpp | D | 18-Mar-2025 | 28.6 KiB | 771 | 257 |
| ftd.cmake | D | 18-Mar-2025 | 2.2 KiB | 58 | 50 |
| mtd.cmake | D | 18-Mar-2025 | 2.2 KiB | 58 | 50 |
| radio.cmake | D | 18-Mar-2025 | 2.4 KiB | 67 | 58 |
| x509_cert_key.hpp | D | 18-Mar-2025 | 5.3 KiB | 117 | 47 |
README.md
1# OpenThread CLI Reference
2
3The OpenThread CLI exposes configuration and management APIs via a command line interface. Use the CLI to play with OpenThread, which can also be used with additional application code. The OpenThread test scripts use the CLI to execute test cases.
4
5## Separator and escaping characters
6
7The whitespace character (`' '`) is used to delimit the command name and the different arguments, together with tab (`'\t'`) and new line characters (`'\r'`, `'\n'`).
8
9Some arguments might require to accept whitespaces on them. For those cases the backslash character (`'\'`) can be used to escape separators or the backslash itself.
10
11Example:
12
13```bash
14> networkname Test\ Network
15Done
16> networkname
17Test Network
18Done
19>
20```
21
22## OpenThread Command List
23
24- [attachtime](#attachtime)
25- [ba](#ba)
26- [bbr](#bbr)
27- [br](README_BR.md)
28- [bufferinfo](#bufferinfo)
29- [ccathreshold](#ccathreshold)
30- [channel](#channel)
31- [child](#child-list)
32- [childip](#childip)
33- [childmax](#childmax)
34- [childsupervision](#childsupervision-interval)
35- [childtimeout](#childtimeout)
36- [coap](README_COAP.md)
37- [coaps](README_COAPS.md)
38- [coex](#coex)
39- [commissioner](README_COMMISSIONER.md)
40- [contextreusedelay](#contextreusedelay)
41- [counters](#counters)
42- [csl](#csl)
43- [dataset](README_DATASET.md)
44- [debug](#debug)
45- [delaytimermin](#delaytimermin)
46- [detach](#detach)
47- [deviceprops](#deviceprops)
48- [diag](#diag)
49- [discover](#discover-channel)
50- [dns](#dns-config)
51- [domainname](#domainname)
52- [dua](#dua-iid)
53- [eidcache](#eidcache)
54- [eui64](#eui64)
55- [extaddr](#extaddr)
56- [extpanid](#extpanid)
57- [factoryreset](#factoryreset)
58- [fake](#fake)
59- [fem](#fem)
60- [history](README_HISTORY.md)
61- [ifconfig](#ifconfig)
62- [instanceid](#instanceid)
63- [ipaddr](#ipaddr)
64- [ipmaddr](#ipmaddr)
65- [joiner](README_JOINER.md)
66- [joinerport](#joinerport-port)
67- [keysequence](#keysequence-counter)
68- [leaderdata](#leaderdata)
69- [leaderweight](#leaderweight)
70- [linkmetrics](#linkmetrics-config-async-ipaddr-enhanced-ack-clear)
71- [linkmetricsmgr](#linkmetricsmgr-disable)
72- [locate](#locate)
73- [log](#log-filename-filename)
74- [mac](#mac-altshortaddr)
75- [macfilter](#macfilter)
76- [meshdiag](#meshdiag-topology-ip6-addrs-children)
77- [mliid](#mliid-iid)
78- [mlr](#mlr-reg-ipaddr--timeout)
79- [mode](#mode)
80- [multiradio](#multiradio)
81- [nat64](#nat64-cidr)
82- [neighbor](#neighbor-list)
83- [netdata](README_NETDATA.md)
84- [netstat](#netstat)
85- [networkdiagnostic](#networkdiagnostic-get-addr-type-)
86- [networkidtimeout](#networkidtimeout)
87- [networkkey](#networkkey)
88- [networkname](#networkname)
89- [networktime](#networktime)
90- [nexthop](#nexthop)
91- [panid](#panid)
92- [parent](#parent)
93- [parentpriority](#parentpriority)
94- [partitionid](#partitionid)
95- [ping](#ping-async--i-source--m-ipaddr-size-count-interval-hoplimit-timeout)
96- [platform](#platform)
97- [pollperiod](#pollperiod-pollperiod)
98- [preferrouterid](#preferrouterid-routerid)
99- [prefix](#prefix)
100- [promiscuous](#promiscuous)
101- [pskc](#pskc)
102- [pskcref](#pskcref)
103- [radio](#radio-enable)
104- [radiofilter](#radiofilter)
105- [rcp](#rcp)
106- [region](#region)
107- [releaserouterid](#releaserouterid-routerid)
108- [reset](#reset)
109- [rloc16](#rloc16)
110- [route](#route)
111- [router](#router-list)
112- [routerdowngradethreshold](#routerdowngradethreshold)
113- [routereligible](#routereligible)
114- [routerselectionjitter](#routerselectionjitter)
115- [routerupgradethreshold](#routerupgradethreshold)
116- [childrouterlinks](#childrouterlinks)
117- [scan](#scan-channel)
118- [service](#service)
119- [singleton](#singleton)
120- [sntp](#sntp-query-sntp-server-ip-sntp-server-port)
121- [state](#state)
122- [srp](README_SRP.md)
123- [tcat](README_TCAT.md)
124- [tcp](README_TCP.md)
125- [test](#test-tmforiginfilter-enabledisable)
126- [thread](#thread-start)
127- [timeinqueue](#timeinqueue)
128- [trel](#trel)
129- [tvcheck](#tvcheck-enable)
130- [txpower](#txpower)
131- [udp](README_UDP.md)
132- [unsecureport](#unsecureport-add-port)
133- [uptime](#uptime)
134- [vendor](#vendor-name)
135- [verhoeff](#verhoeff-calculate)
136- [version](#version)
137- [wakeup](#wakeup-channel)
138
139## OpenThread Command Details
140
141### attachtime
142
143Prints the attach time (duration since device was last attached).
144
145Requires `OPENTHREAD_CONFIG_UPTIME_ENABLE`.
146
147Duration is formatted as `{hh}:{mm}:{ss}` for hours, minutes, and seconds if it is less than one day. If the duration is longer than one day, the format is `{dd}d.{hh}:{mm}:{ss}`.
148
149```bash
150> attachtime
15101:38:25
152Done
153```
154
155### bbr
156
157Show current Primary Backbone Router information for Thread 1.2 device.
158
159```bash
160> bbr
161BBR Primary:
162server16: 0xE400
163seqno: 10
164delay: 120 secs
165timeout: 300 secs
166Done
167```
168
169```bash
170> bbr
171BBR Primary: None
172Done
173```
174
175### bbr mgmt dua \<status\|coap-code\> [meshLocalIid]
176
177Configure the response status for DUA.req with meshLocalIid in payload. Without meshLocalIid, simply respond any coming DUA.req next with the specified status or COAP code.
178
179Only for testing/reference device.
180
181known status value:
182
183- 0: ST_DUA_SUCCESS
184- 1: ST_DUA_REREGISTER
185- 2: ST_DUA_INVALID
186- 3: ST_DUA_DUPLICATE
187- 4: ST_DUA_NO_RESOURCES
188- 5: ST_DUA_BBR_NOT_PRIMARY
189- 6: ST_DUA_GENERAL_FAILURE
190- 160: COAP code 5.00
191
192```bash
193> bbr mgmt dua 1 2f7c235e5025a2fd
194Done
195> bbr mgmt dua 160
196Done
197```
198
199### bbr mgmt mlr listener
200
201Show the Multicast Listeners.
202
203Only for testing/reference Backbone Router device.
204
205```bash
206> bbr mgmt mlr listener
207ff04:0:0:0:0:0:0:abcd 3534000
208ff04:0:0:0:0:0:0:eeee 3537610
209Done
210```
211
212### bbr mgmt mlr listener add \<ipaddr\> \[\<timeout\>\]
213
214Add a Multicast Listener with a given IPv6 multicast address and timeout (in seconds).
215
216Only for testing/reference Backbone Router device.
217
218```bash
219> bbr mgmt mlr listener add ff04::1
220Done
221> bbr mgmt mlr listener add ff04::2 300
222Done
223> bbr mgmt mlr listener
224ff04:0:0:0:0:0:0:2 261
225ff04:0:0:0:0:0:0:1 3522
226Done
227```
228
229### bbr mgmt mlr listener clear
230
231Removes all the Multicast Listeners.
232
233Only for testing/reference Backbone Router device.
234
235```bash
236> bbr mgmt mlr listener clear
237Done
238> bbr mgmt mlr listener
239Done
240```
241
242### bbr mgmt mlr response \<status\>
243
244Configure the response status for the next MLR.req.
245
246Only for testing/reference device.
247
248Known status values:
249
250- 0: ST_MLR_SUCCESS
251- 2: ST_MLR_INVALID
252- 3: ST_MLR_NO_PERSISTENT
253- 4: ST_MLR_NO_RESOURCES
254- 5: ST_MLR_BBR_NOT_PRIMARY
255- 6: ST_MLR_GENERAL_FAILURE
256
257```bash
258> bbr mgmt mlr response 2
259Done
260```
261
262### bbr state
263
264Show local Backbone state ([`Disabled`,`Primary`, `Secondary`]) for Thread 1.2 FTD.
265
266`OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is required.
267
268```bash
269> bbr state
270Disabled
271Done
272
273> bbr state
274Primary
275Done
276
277> bbr state
278Secondary
279Done
280```
281
282### bbr enable
283
284Enable Backbone Router Service for Thread 1.2 FTD. `SRV_DATA.ntf` would be triggered for attached device if there is no Backbone Router Service in Thread Network Data.
285
286`OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is required.
287
288```bash
289> bbr enable
290Done
291```
292
293### bbr disable
294
295Disable Backbone Router Service for Thread 1.2 FTD. `SRV_DATA.ntf` would be triggered if Backbone Router is Primary state. o `OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is required.
296
297```bash
298> bbr disable
299Done
300```
301
302### bbr register
303
304Register Backbone Router Service for Thread 1.2 FTD. `SRV_DATA.ntf` would be triggered for attached device.
305
306`OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is required.
307
308```bash
309> bbr register
310Done
311```
312
313### bbr config
314
315Show local Backbone Router configuration for Thread 1.2 FTD.
316
317`OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is required.
318
319```bash
320> bbr config
321seqno: 10
322delay: 120 secs
323timeout: 300 secs
324Done
325```
326
327### bbr config \[seqno \<seqno\>\] \[delay \<delay\>\] \[timeout \<timeout\>\]
328
329Configure local Backbone Router configuration for Thread 1.2 FTD. `bbr register` should be issued explicitly to register Backbone Router service to Leader for Secondary Backbone Router. `SRV_DATA.ntf` would be initiated automatically if BBR Dataset changes for Primary Backbone Router.
330
331`OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is required.
332
333```bash
334> bbr config seqno 20 delay 30
335Done
336```
337
338### bbr jitter
339
340Show jitter (in seconds) for Backbone Router registration for Thread 1.2 FTD.
341
342`OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is required.
343
344```bash
345> bbr jitter
34620
347Done
348```
349
350### bbr jitter \<jitter\>
351
352Set jitter (in seconds) for Backbone Router registration for Thread 1.2 FTD.
353
354`OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is required.
355
356```bash
357> bbr jitter 10
358Done
359```
360
361### ba
362
363Show current Border Agent information.
364
365### ba port
366
367Print border agent service port.
368
369```bash
370> ba port
37149152
372Done
373```
374
375### ba state
376
377Print border agent state.
378
379Possible states are
380
381- `Stopped` : Border Agent is stopped.
382- `Started` : Border Agent is running with no active connection with external commissioner.
383- `Active` : Border Agent is running and is connected with an external commissioner.
384
385```bash
386> ba state
387Started
388Done
389```
390
391### ba disconnect
392
393Disconnects border agent from any active secure sessions.
394
395```bash
396> ba disconnect
397Done
398```
399
400### ba ephemeralkey
401
402Indicates if an ephemeral key is active.
403
404Requires `OPENTHREAD_CONFIG_BORDER_AGENT_EPHEMERAL_KEY_ENABLE`.
405
406```bash
407> ba ephemeralkey
408inactive
409Done
410
411> ba ephemeralkey set Z10X20g3J15w1000P60m16 1000
412Done
413
414> ba ephemeralkey
415active
416Done
417```
418
419### ba ephemeralkey set \<keystring\> \[timeout\] \[port\]
420
421Sets the ephemeral key for a given timeout duration.
422
423Requires `OPENTHREAD_CONFIG_BORDER_AGENT_EPHEMERAL_KEY_ENABLE`.
424
425The ephemeral key can be set when Border Agent is already running and is not currently connected to any external commissioner (i.e., `ba state` gives `Started`).
426
427The `keystring` string is directly used as the ephemeral PSK (excluding the trailing null `\0` character). Its length MUST be between 6 and 32, inclusive.
428
429The `timeout` is in milliseconds. If not provided or set to zero, the default value of 2 minutes will be used. If the timeout value is larger than 10 minutes, the 10 minutes timeout value will be used instead.
430
431The `port` specifies the UDP port to use with the ephemeral key. If UDP port is zero or is not provided, an ephemeral port will be used. `ba port` will give the current UDP port in use by the Border Agent.
432
433Setting the ephemeral key again before a previously set one is timed out, will replace the previous one.
434
435During the timeout interval, the ephemeral key can be used only once by an external commissioner to establish a connection. After the commissioner disconnects, the ephemeral key is cleared, and the Border Agent reverts to using PSKc. If the timeout expires while a commissioner is still connected, the session will be terminated, and the Border Agent will cease using the ephemeral key and revert to PSKc.
436
437```bash
438> ba ephemeralkey set Z10X20g3J15w1000P60m16 5000 1234
439Done
440```
441
442### ba ephemeralkey clear
443
444Cancels the ephemeral key in use if any.
445
446Requires `OPENTHREAD_CONFIG_BORDER_AGENT_EPHEMERAL_KEY_ENABLE`.
447
448Can be used to cancel a previously set ephemeral key before it is used or times out. If the Border Agent is not running or there is no ephemeral key in use, calling this function has no effect.
449
450If a commissioner is connected using the ephemeral key and is currently active, calling this method does not change its state. In this case the `ba ephemeralkey` will continue to return `active` until the commissioner disconnects.
451
452```bash
453> ba ephemeralkey clear
454Done
455```
456
457### ba ephemeralkey callback enable
458
459Enables callback from Border Agent for ephemeral key state changes.
460
461```bash
462> ba ephemeralkey callback enable
463Done
464
465> ba ephemeralkey set W10X12 5000 49155
466Done
467
468BorderAgent callback: Ephemeral key active, port:49155
469BorderAgent callback: Ephemeral key inactive
470```
471
472### ba ephemeralkey callback disable
473
474Disables callback from Border Agent for ephemeral key state changes.
475
476```bash
477> ba ephemeralkey callback disable
478Done
479```
480
481### ba counters
482
483Get the border agent counter values.
484
485Note that it requires `OPENTHREAD_CONFIG_BORDER_AGENT_EPHEMERAL_KEY_ENABLE` to output the ePSKc counters.
486
487```bash
488> ba counters
489epskcActivation: 2
490epskcApiDeactivation: 1
491epskcTimeoutDeactivation: 1
492epskcMaxAttemptDeactivation: 0
493epskcDisconnectDeactivation: 0
494epskcInvalidBaStateError: 1
495epskcInvalidArgsError: 1
496epskcStartSecureSessionError: 0
497epskcSecureSessionSuccess: 0
498epskcSecureSessionFailure: 0
499epskcCommissionerPetition: 0
500pskcSecureSessionSuccess: 0
501pskcSecureSessionFailure: 0
502pskcCommissionerPetition: 0
503mgmtActiveGet: 0
504mgmtPendingGet: 0
505Done
506```
507
508### bufferinfo
509
510Show the current message buffer information.
511
512- The `total` shows total number of message buffers in pool.
513- The `free` shows the number of free message buffers.
514- The `max-used` shows the maximum number of used buffers at the same time since OT stack initialization or last `bufferinfo reset`.
515- This is then followed by info about different queues used by OpenThread stack, each line representing info about a queue.
516 - The first number shows number messages in the queue.
517 - The second number shows number of buffers used by all messages in the queue.
518 - The third number shows total number of bytes of all messages in the queue.
519
520```bash
521> bufferinfo
522total: 40
523free: 40
524max-used: 5
5256lo send: 0 0 0
5266lo reas: 0 0 0
527ip6: 0 0 0
528mpl: 0 0 0
529mle: 0 0 0
530coap: 0 0 0
531coap secure: 0 0 0
532application coap: 0 0 0
533Done
534```
535
536### bufferinfo reset
537
538Reset the message buffer counter tracking maximum number buffers in use at the same time.
539
540```bash
541> bufferinfo reset
542Done
543```
544
545### ccathreshold
546
547Get the CCA threshold in dBm measured at antenna connector per IEEE 802.15.4 - 2015 section 10.1.4.
548
549```bash
550> ccathreshold
551-75 dBm
552Done
553```
554
555### ccathreshold \<ccathreshold\>
556
557Set the CCA threshold measured at antenna connector per IEEE 802.15.4 - 2015 section 10.1.4.
558
559```bash
560> ccathreshold -62
561Done
562```
563
564### channel
565
566Get the IEEE 802.15.4 Channel value.
567
568```bash
569> channel
57011
571Done
572```
573
574### channel \<channel\>
575
576Set the IEEE 802.15.4 Channel value.
577
578```bash
579> channel 11
580Done
581```
582
583### channel manager
584
585Get channel manager state.
586
587`OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` is required.
588
589```bash
590channel: 11
591auto: 1
592delay: 120
593interval: 10800
594supported: { 11-26}
595favored: { 11-26}
596Done
597```
598
599### channel manager change \<channel\>
600
601Initiate a channel change with the channel manager.
602
603`OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` is required.
604
605```bash
606> channel manager change 11
607channel manager change 11
608Done
609```
610
611### channel manager select \<skip quality check (boolean)\>
612
613Request a channel selection with the channel manager.
614
615`OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` and `OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE` are required.
616
617```bash
618> channel manager select 1
619channel manager select 1
620Done
621```
622
623### channel manager auto \<enable (boolean)\>
624
625Enable/disable the auto-channel-selection functionality.
626
627`OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` and `OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE` are required.
628
629```bash
630> channel manager auto 1
631channel manager auto 1
632Done
633```
634
635### channel manager delay \<delay\>
636
637Set the channel change delay (in seconds).
638
639`OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` and `OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE` are required.
640
641```bash
642> channel manager delay 120
643channel manager delay 120
644Done
645```
646
647### channel manager interval \<interval\>
648
649Set the auto-channel-selection interval (in seconds).
650
651`OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` and `OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE` are required.
652
653```bash
654> channel manager interval 10800
655channel manager interval 10800
656Done
657```
658
659### channel manager supported \<mask\>
660
661Set the supported channel mask for the auto-channel-selection.
662
663`OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` and `OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE` are required.
664
665```bash
666> channel manager supported 0x7fffc00
667channel manager supported 0x7fffc00
668Done
669```
670
671### channel manager favored \<mask\>
672
673Set the favored channel mask for the auto-channel-selection.
674
675`OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` and `OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE` are required.
676
677```bash
678> channel manager favored 0x7fffc00
679channel manager favored 0x7fffc00
680Done
681```
682
683### channel monitor
684
685Get current channel monitor state and channel occupancy.
686
687`OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE` is required.
688
689```bash
690> channel monitor
691channel monitor
692enabled: 1
693interval: 41000
694threshold: -75
695window: 960
696count: 10552
697occupancies:
698ch 11 (0x0cb7) 4.96% busy
699ch 12 (0x2e2b) 18.03% busy
700ch 13 (0x2f54) 18.48% busy
701ch 14 (0x0fef) 6.22% busy
702ch 15 (0x1536) 8.28% busy
703ch 16 (0x1746) 9.09% busy
704ch 17 (0x0b8b) 4.50% busy
705ch 18 (0x60a7) 37.75% busy
706ch 19 (0x0810) 3.14% busy
707ch 20 (0x0c2a) 4.75% busy
708ch 21 (0x08dc) 3.46% busy
709ch 22 (0x101d) 6.29% busy
710ch 23 (0x0092) 0.22% busy
711ch 24 (0x0028) 0.06% busy
712ch 25 (0x0063) 0.15% busy
713ch 26 (0x058c) 2.16% busy
714
715Done
716```
717
718### channel monitor start
719
720Start the channel monitor.
721
722`OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE` is required.
723
724```bash
725> channel monitor start
726channel monitor start
727Done
728```
729
730### channel monitor stop
731
732Stop the channel monitor.
733
734`OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE` is required.
735
736```bash
737> channel monitor stop
738channel monitor stop
739Done
740```
741
742### channel preferred
743
744Get preferred channel mask.
745
746```bash
747> channel preferred
7480x7fff800
749Done
750```
751
752### channel supported
753
754Get supported channel mask.
755
756```bash
757> channel supported
7580x7fff800
759Done
760```
761
762### child list
763
764List attached Child IDs.
765
766```bash
767> child list
7681 2 3 6 7 8
769Done
770```
771
772### child table
773
774Print table of attached children.
775
776```bash
777> child table
778| ID | RLOC16 | Timeout | Age | LQ In | C_VN |R|D|N|Ver|CSL|QMsgCnt|Suprvsn| Extended MAC |
779+-----+--------+------------+------------+-------+------+-+-+-+---+---+-------+-------+------------------+
780| 1 | 0xc801 | 240 | 24 | 3 | 131 |1|0|0| 3| 0 | 0 | 129 | 4ecede68435358ac |
781| 2 | 0xc802 | 240 | 2 | 3 | 131 |0|0|0| 3| 1 | 0 | 0 | a672a601d2ce37d8 |
782Done
783```
784
785### child \<id\>
786
787Print diagnostic information for an attached Thread Child. The `id` may be a Child ID or an RLOC16.
788
789```bash
790> child 1
791Child ID: 1
792Rloc: 9c01
793Ext Addr: e2b3540590b0fd87
794Mode: rn
795CSL Synchronized: 1
796Net Data: 184
797Timeout: 100
798Age: 0
799Link Quality In: 3
800RSSI: -20
801Supervision Interval: 129
802Done
803```
804
805### childip
806
807Get the list of IP addresses stored for MTD children.
808
809```bash
810> childip
8113401: fdde:ad00:beef:0:3037:3e03:8c5f:bc0c
812Done
813```
814
815### childip max
816
817Get the maximum number of IP addresses that each MTD child may register with this device as parent.
818
819```bash
820> childip max
8214
822Done
823```
824
825### childip max \<count\>
826
827Set the maximum number of IP addresses that each MTD child may register with this device as parent. 0 to clear the setting and restore the default.
828
829`OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is required.
830
831```bash
832> childip max 2
833Done
834```
835
836### childmax
837
838Get the Thread maximum number of allowed children.
839
840```bash
841> childmax
8425
843Done
844```
845
846### childmax \<count\>
847
848Set the Thread maximum number of allowed children.
849
850```bash
851> childmax 2
852Done
853```
854
855### childsupervision interval
856
857Get the Child Supervision interval value on the child.
858
859Child Supervision feature provides a mechanism for parent to ensure that a message is sent to each sleepy child within the supervision interval. If there is no transmission to the child within the supervision interval, OpenThread enqueues and sends a Child Supervision Message to the child.
860
861```bash
862> childsupervision interval
86330
864Done
865```
866
867### childsupervision interval \<interval\>
868
869Set the Child Supervision interval value on the child.
870
871```bash
872> childsupervision interval 30
873Done
874```
875
876### childsupervision checktimeout
877
878Get the Child Supervision Check Timeout value on the child.
879
880If the device is a sleepy child and it does not hear from its parent within the specified check timeout, it initiates the re-attach process (MLE Child Update Request/Response exchange with its parent).
881
882```bash
883> childsupervision checktimeout
88430
885Done
886```
887
888### childsupervision checktimeout \<timeout\>
889
890Set the Child Supervision Check Timeout value on the child.
891
892```bash
893> childsupervision checktimeout 30
894Done
895```
896
897### childsupervision failcounter
898
899Get the current value of supervision check timeout failure counter.
900
901The counter tracks the number of supervision check failures on the child. It is incremented when the child does not hear from its parent within the specified check timeout interval.
902
903```bash
904> childsupervision failcounter
9050
906Done
907```
908
909### childsupervision failcounter reset
910
911Reset the supervision check timeout failure counter to zero.
912
913```bash
914> childsupervision failcounter reset
915Done
916```
917
918### childtimeout
919
920Get the Thread Child Timeout value.
921
922```bash
923> childtimeout
924300
925Done
926```
927
928### childtimeout \<timeout\>
929
930Set the Thread Child Timeout value.
931
932```bash
933> childtimeout 300
934Done
935```
936
937### coex
938
939Get the coex status.
940
941`OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE` is required.
942
943```bash
944> coex
945Enabled
946Done
947```
948
949### coex disable
950
951Disable coex.
952
953`OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE` is required.
954
955```bash
956> coex disable
957Done
958```
959
960### coex enable
961
962Enable coex.
963
964`OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE` is required.
965
966```bash
967> coex enable
968Done
969```
970
971### coex metrics
972
973Show coex metrics.
974
975`OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE` is required.
976
977```bash
978> coex metrics
979Stopped: false
980Grant Glitch: 0
981Transmit metrics
982 Request: 0
983 Grant Immediate: 0
984 Grant Wait: 0
985 Grant Wait Activated: 0
986 Grant Wait Timeout: 0
987 Grant Deactivated During Request: 0
988 Delayed Grant: 0
989 Average Request To Grant Time: 0
990Receive metrics
991 Request: 0
992 Grant Immediate: 0
993 Grant Wait: 0
994 Grant Wait Activated: 0
995 Grant Wait Timeout: 0
996 Grant Deactivated During Request: 0
997 Delayed Grant: 0
998 Average Request To Grant Time: 0
999 Grant None: 0
1000Done
1001```
1002
1003### contextreusedelay
1004
1005Get the CONTEXT_ID_REUSE_DELAY value.
1006
1007```bash
1008> contextreusedelay
100911
1010Done
1011```
1012
1013### contextreusedelay \<delay\>
1014
1015Set the CONTEXT_ID_REUSE_DELAY value.
1016
1017```bash
1018> contextreusedelay 11
1019Done
1020```
1021
1022### counters
1023
1024Get the supported counter names.
1025
1026```bash
1027> counters
1028br
1029ip
1030mac
1031mle
1032Done
1033```
1034
1035### counters \<countername\>
1036
1037Get the counter value.
1038
1039Note:
1040
1041- `OPENTHREAD_CONFIG_UPTIME_ENABLE` is required for MLE role time tracking in `counters mle`
1042- `OPENTHREAD_CONFIG_IP6_BR_COUNTERS_ENABLE` is required for `counters br`
1043
1044```bash
1045> counters mac
1046TxTotal: 10
1047 TxUnicast: 3
1048 TxBroadcast: 7
1049 TxAckRequested: 3
1050 TxAcked: 3
1051 TxNoAckRequested: 7
1052 TxData: 10
1053 TxDataPoll: 0
1054 TxBeacon: 0
1055 TxBeaconRequest: 0
1056 TxOther: 0
1057 TxRetry: 0
1058 TxErrCca: 0
1059 TxErrBusyChannel: 0
1060RxTotal: 2
1061 RxUnicast: 1
1062 RxBroadcast: 1
1063 RxData: 2
1064 RxDataPoll: 0
1065 RxBeacon: 0
1066 RxBeaconRequest: 0
1067 RxOther: 0
1068 RxAddressFiltered: 0
1069 RxDestAddrFiltered: 0
1070 RxDuplicated: 0
1071 RxErrNoFrame: 0
1072 RxErrNoUnknownNeighbor: 0
1073 RxErrInvalidSrcAddr: 0
1074 RxErrSec: 0
1075 RxErrFcs: 0
1076 RxErrOther: 0
1077Done
1078> counters mle
1079Role Disabled: 0
1080Role Detached: 1
1081Role Child: 0
1082Role Router: 0
1083Role Leader: 1
1084Attach Attempts: 1
1085Partition Id Changes: 1
1086Better Partition Attach Attempts: 0
1087Better Parent Attach Attempts: 0
1088Parent Changes: 0
1089Time Disabled Milli: 10026
1090Time Detached Milli: 6852
1091Time Child Milli: 0
1092Time Router Milli: 0
1093Time Leader Milli: 16195
1094Time Tracked Milli: 33073
1095Done
1096> counters ip
1097TxSuccess: 10
1098TxFailed: 0
1099RxSuccess: 5
1100RxFailed: 0
1101Done
1102> counters br
1103Inbound Unicast: Packets 4 Bytes 320
1104Inbound Multicast: Packets 0 Bytes 0
1105Outbound Unicast: Packets 2 Bytes 160
1106Outbound Multicast: Packets 0 Bytes 0
1107RA Rx: 4
1108RA TxSuccess: 2
1109RA TxFailed: 0
1110RS Rx: 0
1111RS TxSuccess: 2
1112RS TxFailed: 0
1113Done
1114```
1115
1116### counters \<countername\> reset
1117
1118Reset the counter value.
1119
1120```bash
1121> counters mac reset
1122Done
1123> counters mle reset
1124Done
1125> counters ip reset
1126Done
1127```
1128
1129### csl
1130
1131Get the CSL configuration.
1132
1133CSL period is shown in microseconds.
1134
1135```bash
1136> csl
1137Channel: 11
1138Period: 160000us
1139Timeout: 1000s
1140Done
1141```
1142
1143### csl channel \<channel\>
1144
1145Set CSL channel.
1146
1147```bash
1148> csl channel 20
1149Done
1150```
1151
1152### csl period \<period\>
1153
1154Set CSL period in microseconds. Disable CSL by setting this parameter to `0`.
1155
1156The CSL period MUST be a multiple 160 microseconds which is 802.15.4 "ten symbols time".
1157
1158```bash
1159> csl period 30000000
1160Done
1161```
1162
1163### csl timeout \<timeout\>
1164
1165Set the CSL timeout in seconds.
1166
1167```bash
1168> csl timeout 10
1169Done
1170```
1171
1172### debug
1173
1174Executes a series of CLI commands to gather information about the device and thread network. This is intended for debugging.
1175
1176The output will display each executed CLI command preceded by "\$", followed by the corresponding command's generated output.
1177
1178The generated output encompasses the following information:
1179
1180- Version
1181- Current state
1182- RLOC16, extended MAC address
1183- Unicast and multicast IPv6 address list
1184- Channel
1185- PAN ID and extended PAN ID
1186- Network Data
1187- Partition ID
1188- Leader Data
1189
1190If the device is operating as FTD:
1191
1192- Child and neighbor table
1193- Router table and next hop Info
1194- Address cache table
1195- Registered MTD child IPv6 address
1196- Device properties
1197
1198If the device supports and acts as an SRP client:
1199
1200- SRP client state
1201- SRP client services and host info
1202
1203If the device supports and acts as an SRP sever:
1204
1205- SRP server state and address mode
1206- SRP server registered hosts and services
1207
1208If the device supports TREL:
1209
1210- TREL status and peer table
1211
1212If the device supports and acts as a border router:
1213
1214- BR state
1215- BR prefixes (OMR, on-link, NAT64)
1216- Discovered prefix table
1217
1218### delaytimermin
1219
1220Get the minimal delay timer (in seconds).
1221
1222```bash
1223> delaytimermin
122430
1225Done
1226```
1227
1228### delaytimermin \<delaytimermin\>
1229
1230Set the minimal delay timer (in seconds).
1231
1232```bash
1233> delaytimermin 60
1234Done
1235```
1236
1237### detach
1238
1239Start the graceful detach process by first notifying other nodes (sending Address Release if acting as a router, or setting Child Timeout value to zero on parent if acting as a child) and then stopping Thread protocol operation.
1240
1241```bash
1242> detach
1243Finished detaching
1244Done
1245```
1246
1247### detach async
1248
1249Start the graceful detach process similar to the `detach` command without blocking and waiting for the callback indicating that detach is finished.
1250
1251```bash
1252> detach async
1253Done
1254```
1255
1256### deviceprops
1257
1258Get the current device properties.
1259
1260```bash
1261> deviceprops
1262PowerSupply : external
1263IsBorderRouter : yes
1264SupportsCcm : no
1265IsUnstable : no
1266WeightAdjustment : 0
1267Done
1268```
1269
1270### deviceprops \<power-supply\> \<is-br\> \<supports-ccm\> \<is-unstable\> \<weight-adjustment\>
1271
1272Set the device properties which are then used to determine and set the Leader Weight.
1273
1274- power-supply: `battery`, `external`, `external-stable`, or `external-unstable`.
1275- weight-adjustment: Valid range is from -16 to +16. Clamped if not within the range.
1276
1277```bash
1278> deviceprops battery 0 0 0 -5
1279Done
1280
1281> deviceprops
1282PowerSupply : battery
1283IsBorderRouter : no
1284SupportsCcm : no
1285IsUnstable : no
1286WeightAdjustment : -5
1287Done
1288
1289> leaderweight
129051
1291Done
1292```
1293
1294### discover \[channel\]
1295
1296Perform an MLE Discovery operation.
1297
1298- channel: The channel to discover on. If no channel is provided, the discovery will cover all valid channels.
1299
1300```bash
1301> discover
1302| J | Network Name | Extended PAN | PAN | MAC Address | Ch | dBm | LQI |
1303+---+------------------+------------------+------+------------------+----+-----+-----+
1304| 0 | OpenThread | dead00beef00cafe | ffff | f1d92a82c8d8fe43 | 11 | -20 | 0 |
1305Done
1306```
1307
1308### dns config
1309
1310Get the default query config used by DNS client.
1311
1312The config includes
1313
1314- Server IPv6 address and port
1315- Response timeout in msec (wait time to rx response)
1316- Maximum tx attempts before reporting failure
1317- Boolean flag to indicate whether the server can resolve the query recursively or not.
1318- Service resolution mode which specifies which records to query. Possible options are:
1319 - `srv` : Query for SRV record only.
1320 - `txt` : Query for TXT record only.
1321 - `srv_txt` : Query for both SRV and TXT records in the same message.
1322 - `srv_txt_sep`: Query in parallel for SRV and TXT using separate messages.
1323 - `srv_txt_opt`: Query for TXT/SRV together first, if it fails then query separately.
1324- Whether to allow/disallow NAT64 address translation during address resolution (requires `OPENTHREAD_CONFIG_DNS_CLIENT_NAT64_ENABLE`)
1325- Transport protocol UDP or TCP (requires `OPENTHREAD_CONFIG_DNS_CLIENT_OVER_TCP_ENABLE`)
1326
1327```bash
1328> dns config
1329Server: [fd00:0:0:0:0:0:0:1]:1234
1330ResponseTimeout: 5000 ms
1331MaxTxAttempts: 2
1332RecursionDesired: no
1333ServiceMode: srv_txt_opt
1334Nat64Mode: allow
1335TransportProtocol: udp
1336Done
1337>
1338```
1339
1340### dns config \[DNS server IP\] \[DNS server port\] \[response timeout (ms)\] \[max tx attempts\] \[recursion desired (boolean)\] \[service mode] \[protocol]
1341
1342Set the default query config.
1343
1344Service mode specifies which records to query. Possible options are:
1345
1346- `def` : Use default option.
1347- `srv` : Query for SRV record only.
1348- `txt` : Query for TXT record only.
1349- `srv_txt` : Query for both SRV and TXT records in the same message.
1350- `srv_txt_sep`: Query in parallel for SRV and TXT using separate messages.
1351- `srv_txt_opt`: Query for TXT/SRV together first, if it fails then query separately.
1352
1353To set protocol effectively to tcp `OPENTHREAD_CONFIG_DNS_CLIENT_OVER_TCP_ENABLE` is required.
1354
1355```bash
1356> dns config fd00::1 1234 5000 2 0 srv_txt_sep tcp
1357Done
1358
1359> dns config
1360Server: [fd00:0:0:0:0:0:0:1]:1234
1361ResponseTimeout: 5000 ms
1362MaxTxAttempts: 2
1363RecursionDesired: no
1364ServiceMode: srv_txt_sep
1365Nat64Mode: allow
1366TransportProtocol: tcp
1367Done
1368```
1369
1370We can leave some of the fields as unspecified (or use value zero). The unspecified fields are replaced by the corresponding OT config option definitions `OPENTHREAD_CONFIG_DNS_CLIENT_DEFAULT_{}` to form the default query config.
1371
1372```bash
1373> dns config fd00::2
1374Done
1375
1376> dns config
1377Server: [fd00:0:0:0:0:0:0:2]:53
1378ResponseTimeout: 6000 ms
1379MaxTxAttempts: 3
1380RecursionDesired: yes
1381Nat64Mode: allow
1382TransportProtocol: udp
1383Done
1384```
1385
1386This final example shows how only 'recursion desired' and the service mode are set, and all other parameters are set to their defaults:
1387
1388```bash
1389> dns config :: 0 0 0 1 srv_txt_sep
1390Done
1391
1392> dns config
1393Server: [2001:4860:4860:0:0:0:0:8888]:53
1394ResponseTimeout: 6000 ms
1395MaxTxAttempts: 3
1396RecursionDesired: yes
1397ServiceMode: srv_txt_sep
1398Nat64Mode: allow
1399TransportProtocol: udp
1400Done
1401```
1402
1403### dns resolve \<hostname\> \[DNS server IP\] \[DNS server port\] \[response timeout (ms)\] \[max tx attempts\] \[recursion desired (boolean)\] \[transport protocol\]
1404
1405Send DNS Query to obtain IPv6 address for given hostname.
1406
1407The parameters after `hostname` are optional. Any unspecified (or zero) value for these optional parameters is replaced by the value from the current default config (`dns config`).
1408
1409To use tcp, `OPENTHREAD_CONFIG_DNS_CLIENT_OVER_TCP_ENABLE` is required.
1410
1411```bash
1412> dns resolve ipv6.google.com
1413> DNS response for ipv6.google.com - 2a00:1450:401b:801:0:0:0:200e TTL: 300
1414```
1415
1416The DNS server IP can be an IPv4 address, which will be synthesized to an IPv6 address using the preferred NAT64 prefix from the network data.
1417
1418> Note: The command will return `InvalidState` when the DNS server IP is an IPv4 address but the preferred NAT64 prefix is unavailable.
1419
1420```bash
1421> dns resolve example.com 8.8.8.8
1422Synthesized IPv6 DNS server address: fdde:ad00:beef:2:0:0:808:808
1423DNS response for example.com. - fd4c:9574:3720:2:0:0:5db8:d822 TTL:20456
1424Done
1425```
1426
1427### dns resolve4 \<hostname\> \[DNS server IP\] \[DNS server port\] \[response timeout (ms)\] \[max tx attempts\] \[recursion desired (boolean)\]
1428
1429Send DNS query to obtain IPv4 address for a given hostname and provide the NAT64 synthesized IPv6 addresses for the IPv4 addresses from the query response.
1430
1431Requires `OPENTHREAD_CONFIG_DNS_CLIENT_NAT64_ENABLE`.
1432
1433The parameters after `hostname` are optional. Any unspecified (or zero) value for these optional parameters is replaced by the value from the current default config (`dns config`).
1434
1435This command requires a NAT64 prefix to be configured and present in Thread Network Data.
1436
1437For example, if a NAT64 prefix of `2001:db8:122:344::/96` is used within the Thread mesh, the outputted IPv6 address corresponds to an IPv4 address of `142.250.191.78` for the `ipv4.google.com` host:
1438
1439```bash
1440> dns resolve4 ipv4.google.com
1441> DNS response for ipv4.google.com - 2001:db8:122:344:0:0:8efa:bf4e TTL: 20456
1442```
1443
1444### dns browse \<service-name\> \[DNS server IP\] \[DNS server port\] \[response timeout (ms)\] \[max tx attempts\] \[recursion desired (boolean)\]
1445
1446Send a browse (service instance enumeration) DNS query to get the list of services for given service-name.
1447
1448The parameters after `service-name` are optional. Any unspecified (or zero) value for these optional parameters is replaced by the value from the current default config (`dns config`).
1449
1450```bash
1451> dns browse _service._udp.example.com
1452DNS browse response for _service._udp.example.com.
1453inst1
1454inst2
1455inst3
1456Done
1457```
1458
1459The detailed service info (port number, weight, host name, TXT data, host addresses) is outputted only when provided by server/resolver in the browse response (in additional Data Section). This is a SHOULD and not a MUST requirement, and servers/resolvers are not required to provide this.
1460
1461The recommended behavior, which is supported by the OpenThread DNS-SD resolver, is to only provide the additional data when there is a single instance in the response. However, users should assume that the browse response may only contain the list of matching service instances and not any detail service info. To resolve a service instance, users can use the `dns service` or `dns servicehost` commands.
1462
1463```bash
1464> dns browse _service._udp.example.com
1465DNS browse response for _service._udp.example.com.
1466inst1
1467 Port:1234, Priority:1, Weight:2, TTL:7200
1468 Host:host.example.com.
1469 HostAddress:fd00:0:0:0:0:0:0:abcd TTL:7200
1470 TXT:[a=6531, b=6c12] TTL:7300
1471Done
1472```
1473
1474```bash
1475> dns browse _airplay._tcp.default.service.arpa
1476DNS browse response for _airplay._tcp.default.service.arpa.
1477Gabe's Mac mini
1478 Port:7000, Priority:0, Weight:0, TTL:10
1479 Host:Gabes-Mac-mini.default.service.arpa.
1480 HostAddress:fd97:739d:386a:1:1c2e:d83c:fcbe:9cf4 TTL:10
1481Done
1482```
1483
1484> Note: The DNS server IP can be an IPv4 address, which will be synthesized to an IPv6 address using the preferred NAT64 prefix from the network data. The command will return `InvalidState` when the DNS server IP is an IPv4 address but the preferred NAT64 prefix is unavailable. When testing DNS-SD discovery proxy, the zone is not `local` and instead should be `default.service.arpa`.
1485
1486### dns service \<service-instance-label\> \<service-name\> \[DNS server IP\] \[DNS server port\] \[response timeout (ms)\] \[max tx attempts\] \[recursion desired (boolean)\]
1487
1488Send a service instance resolution DNS query for a given service instance. Service instance label is provided first, followed by the service name (note that service instance label can contain dot '.' character).
1489
1490The parameters after `service-name` are optional. Any unspecified (or zero) value for these optional parameters is replaced by the value from the current default config (`dns config`).
1491
1492> Note: The DNS server IP can be an IPv4 address, which will be synthesized to an IPv6 address using the preferred NAT64 prefix from the network data. The command will return `InvalidState` when the DNS server IP is an IPv4 address but the preferred NAT64 prefix is unavailable.
1493
1494### dns servicehost \<service-instance-label\> \<service-name\> \[DNS server IP\] \[DNS server port\] \[response timeout (ms)\] \[max tx attempts\] \[recursion desired (boolean)\]
1495
1496Send a service instance resolution DNS query for a given service instance with a potential follow-up address resolution for the host name discovered for the service instance (if the server/resolver does not provide AAAA/A records for the host name in the response to SRV query).
1497
1498Service instance label is provided first, followed by the service name (note that service instance label can contain dot '.' character).
1499
1500The parameters after `service-name` are optional. Any unspecified (or zero) value for these optional parameters is replaced by the value from the current default config (`dns config`).
1501
1502### dns server upstream \[enable|disable\]
1503
1504Enable/Disable the upstream DNS feature. If no argument is provided, it prints whether the upstream DNS feature is enabled.
1505
1506`OPENTHREAD_CONFIG_DNS_UPSTREAM_QUERY_ENABLE` is required.
1507
1508Enable the upstream DNS feature.
1509
1510```
1511> dns server upstream enable
1512Done
1513```
1514
1515Get whether the upstream DNS feature is enabled.
1516
1517```
1518> dns server upstream
1519Enabled
1520Done
1521```
1522
1523### dns compression \[enable|disable\]
1524
1525Enable/Disable the "DNS name compression" mode.
1526
1527By default DNS name compression is enabled. When disabled, DNS names are appended as full and never compressed. This is applicable to OpenThread's DNS and SRP client/server modules.
1528
1529This is intended for testing only and available under `REFERENCE_DEVICE` config.
1530
1531Get the current "DNS name compression" mode.
1532
1533```
1534> dns compression
1535Enabled
1536```
1537
1538Set the "DNS name compression" mode.
1539
1540```
1541> dns compression disable
1542Done
1543>
1544>
1545> dns compression
1546Disabled
1547Done
1548```
1549
1550### domainname
1551
1552Get the Thread Domain Name for Thread 1.2 device.
1553
1554```bash
1555> domainname
1556Thread
1557Done
1558```
1559
1560### domainname \<name\>
1561
1562Set the Thread Domain Name for Thread 1.2 device.
1563
1564```bash
1565> domainname Test\ Thread
1566Done
1567```
1568
1569### dua iid
1570
1571Get the Interface Identifier manually specified for Thread Domain Unicast Address on Thread 1.2 device.
1572
1573```bash
1574> dua iid
15750004000300020001
1576Done
1577```
1578
1579### dua iid \<iid\>
1580
1581Set the Interface Identifier manually specified for Thread Domain Unicast Address on Thread 1.2 device.
1582
1583```bash
1584> dua iid 0004000300020001
1585Done
1586```
1587
1588### dua iid clear
1589
1590Clear the Interface Identifier manually specified for Thread Domain Unicast Address on Thread 1.2 device.
1591
1592```bash
1593> dua iid clear
1594Done
1595```
1596
1597### eidcache
1598
1599Print the EID-to-RLOC cache entries.
1600
1601```bash
1602> eidcache
1603fd49:caf4:a29f:dc0e:97fc:69dd:3c16:df7d 2000 cache canEvict=1 transTime=0 eid=fd49:caf4:a29f:dc0e:97fc:69dd:3c16:df7d
1604fd49:caf4:a29f:dc0e:97fc:69dd:3c16:df7f fffe retry canEvict=1 timeout=10 retryDelay=30
1605Done
1606```
1607
1608### eui64
1609
1610Get the factory-assigned IEEE EUI-64.
1611
1612```bash
1613> eui64
16140615aae900124b00
1615Done
1616```
1617
1618### extaddr
1619
1620Get the IEEE 802.15.4 Extended Address.
1621
1622```bash
1623> extaddr
1624dead00beef00cafe
1625Done
1626```
1627
1628### extaddr \<extaddr\>
1629
1630Set the IEEE 802.15.4 Extended Address.
1631
1632```bash
1633> extaddr dead00beef00cafe
1634dead00beef00cafe
1635Done
1636```
1637
1638### extpanid
1639
1640Get the Thread Extended PAN ID value.
1641
1642**NOTE** The current commissioning credential becomes stale after changing this value. Use [pskc](#pskc--p-keypassphrase) to reset.
1643
1644```bash
1645> extpanid
1646dead00beef00cafe
1647Done
1648```
1649
1650### extpanid \<extpanid\>
1651
1652Set the Thread Extended PAN ID value.
1653
1654```bash
1655> extpanid dead00beef00cafe
1656Done
1657```
1658
1659### factoryreset
1660
1661Delete all stored settings, and signal a platform reset.
1662
1663```bash
1664> factoryreset
1665```
1666
1667### fake
1668
1669Send fake Thread messages.
1670
1671Note: Only for certification test.
1672
1673#### fake /a/an \<dst-ipaddr\> \<target\> \<meshLocalIid\>
1674
1675```bash
1676> fake /a/an fdde:ad00:beef:0:0:ff:fe00:a800 fd00:7d03:7d03:7d03:55f2:bb6a:7a43:a03b 1111222233334444
1677Done
1678```
1679
1680### fem
1681
1682Get external FEM parameters.
1683
1684```bash
1685> fem
1686LNA gain 11 dBm
1687Done
1688```
1689
1690### fem lnagain
1691
1692Get the Rx LNA gain in dBm of the external FEM.
1693
1694```bash
1695> fem lnagain
169611
1697Done
1698```
1699
1700### fem lnagain \<LNA gain\>
1701
1702Set the Rx LNA gain in dBm of the external FEM.
1703
1704```bash
1705> fem lnagain 8
1706Done
1707```
1708
1709### ifconfig
1710
1711Show the status of the IPv6 interface.
1712
1713```bash
1714> ifconfig
1715down
1716Done
1717```
1718
1719### ifconfig up
1720
1721Bring up the IPv6 interface.
1722
1723```bash
1724> ifconfig up
1725Done
1726```
1727
1728### ifconfig down
1729
1730Bring down the IPv6 interface.
1731
1732```bash
1733> ifconfig down
1734Done
1735```
1736
1737### instanceid
1738
1739Show OpenThread instance identifier.
1740
1741```bash
1742> instanceid
1743468697314
1744Done
1745```
1746
1747### ipaddr
1748
1749List all IPv6 addresses assigned to the Thread interface.
1750
1751```bash
1752> ipaddr
1753fdde:ad00:beef:0:0:ff:fe00:0
1754fdde:ad00:beef:0:558:f56b:d688:799
1755fe80:0:0:0:f3d9:2a82:c8d8:fe43
1756Done
1757```
1758
1759Use `-v` to get more verbose information about the address:
1760
1761- `origin`: can be `thread`, `slaac`, `dhcp6`, or `manual`, and indicates the origin of the address
1762- `plen`: prefix length (in bits)
1763- `preferred`: preferred flag (boolean)
1764- `valid`: valid flag (boolean)
1765
1766```bash
1767> ipaddr -v
1768fd5e:18fa:f4a5:b8:0:ff:fe00:fc00 origin:thread plen:64 preferred:0 valid:1
1769fd5e:18fa:f4a5:b8:0:ff:fe00:dc00 origin:thread plen:64 preferred:0 valid:1
1770fd5e:18fa:f4a5:b8:f8e:5d95:87a0:e82c origin:thread plen:64 preferred:0 valid:1
1771fe80:0:0:0:4891:b191:e277:8826 origin:thread plen:64 preferred:1 valid:1
1772Done
1773```
1774
1775### ipaddr add \<ipaddr\>
1776
1777Add an IPv6 address to the Thread interface.
1778
1779```bash
1780> ipaddr add 2001::dead:beef:cafe
1781Done
1782```
1783
1784### ipaddr del \<ipaddr\>
1785
1786Delete an IPv6 address from the Thread interface.
1787
1788```bash
1789> ipaddr del 2001::dead:beef:cafe
1790Done
1791```
1792
1793### ipaddr linklocal
1794
1795Print Thread link-local IPv6 address.
1796
1797```bash
1798> ipaddr linklocal
1799fe80:0:0:0:f3d9:2a82:c8d8:fe43
1800Done
1801```
1802
1803### ipaddr mleid
1804
1805Print Thread Mesh Local EID address.
1806
1807```bash
1808> ipaddr mleid
1809fdde:ad00:beef:0:558:f56b:d688:799
1810Done
1811```
1812
1813### ipaddr rloc
1814
1815Print Thread Routing Locator (RLOC) address.
1816
1817```bash
1818> ipaddr rloc
1819fdde:ad00:beef:0:0:ff:fe00:0
1820Done
1821```
1822
1823### ipmaddr
1824
1825List all IPv6 multicast addresses subscribed to the Thread interface.
1826
1827```bash
1828> ipmaddr
1829ff05:0:0:0:0:0:0:1
1830ff33:40:fdde:ad00:beef:0:0:1
1831ff32:40:fdde:ad00:beef:0:0:1
1832Done
1833```
1834
1835### ipmaddr add \<ipaddr\>
1836
1837Subscribe the Thread interface to the IPv6 multicast address.
1838
1839```bash
1840> ipmaddr add ff05::1
1841Done
1842```
1843
1844### ipmaddr del \<ipaddr\>
1845
1846Unsubscribe the Thread interface to the IPv6 multicast address.
1847
1848```bash
1849> ipmaddr del ff05::1
1850Done
1851```
1852
1853### ipmaddr llatn
1854
1855Get the Link-Local All Thread Nodes multicast address.
1856
1857```
1858> ipmaddr llatn
1859ff32:40:fdde:ad00:beef:0:0:1
1860Done
1861```
1862
1863### ipmaddr rlatn
1864
1865Get the Realm-Local All Thread Nodes multicast address.
1866
1867```
1868> ipmaddr rlatn
1869ff33:40:fdde:ad00:beef:0:0:1
1870Done
1871```
1872
1873### joinerport \<port\>
1874
1875Set the Joiner port.
1876
1877```bash
1878> joinerport 1000
1879Done
1880```
1881
1882### keysequence counter
1883
1884Get the Thread Key Sequence Counter.
1885
1886```bash
1887> keysequence counter
188810
1889Done
1890```
1891
1892### keysequence counter \<counter\>
1893
1894Set the Thread Key Sequence Counter.
1895
1896This command is reserved for testing and demo purposes only. Changing Key Sequence Counter will render a production application non-compliant with the Thread Specification.
1897
1898```bash
1899> keysequence counter 10
1900Done
1901```
1902
1903### keysequence guardtime
1904
1905Get Thread Key Switch Guard Time (in hours)
1906
1907```bash
1908> keysequence guardtime
19090
1910Done
1911```
1912
1913### keysequence guardtime \<guardtime\>
1914
1915Set Thread Key Switch Guard Time (in hours).
1916
1917This command is reserved for testing and demo purposes only. Changing Key Switch Guard Time will render a production application non-compliant with the Thread Specification.
1918
1919```bash
1920> keysequence guardtime 0
1921Done
1922```
1923
1924### leaderdata
1925
1926Show the Thread Leader Data.
1927
1928```bash
1929> leaderdata
1930Partition ID: 1077744240
1931Weighting: 64
1932Data Version: 109
1933Stable Data Version: 211
1934Leader Router ID: 60
1935Done
1936```
1937
1938### leaderweight
1939
1940Get the Thread Leader Weight.
1941
1942```bash
1943> leaderweight
1944128
1945Done
1946```
1947
1948### leaderweight \<weight\>
1949
1950Set the Thread Leader Weight.
1951
1952```bash
1953> leaderweight 128
1954Done
1955```
1956
1957### linkmetrics config \[async\] \<ipaddr\> enhanced-ack clear
1958
1959Send a Link Metrics Management Request to clear an Enhanced-ACK Based Probing.
1960
1961- async: Use the non-blocking mode.
1962- ipaddr: Peer address (SHOULD be link local address of the neighboring device).
1963
1964```bash
1965> linkmetrics config fe80:0:0:0:3092:f334:1455:1ad2 enhanced-ack clear
1966Received Link Metrics Management Response from: fe80:0:0:0:3092:f334:1455:1ad2
1967Status: Success
1968Done
1969
1970> linkmetrics config async fe80:0:0:0:3092:f334:1455:1ad2 enhanced-ack clear
1971Done
1972> Received Link Metrics Management Response from: fe80:0:0:0:3092:f334:1455:1ad2
1973Status: Success
1974```
1975
1976### linkmetrics config \[async\] \<ipaddr\> enhanced-ack register \<qmr\> \[r\]
1977
1978Send a Link Metrics Management Request to register an Enhanced-ACK Based Probing.
1979
1980- async: Use the non-blocking mode.
1981- ipaddr: Peer address.
1982- qmr: This specifies what metrics to query. At most two options are allowed to select (per spec 4.11.3.4.4.6).
1983 - q: Layer 2 LQI.
1984 - m: Link Margin.
1985 - r: RSSI.
1986- r: This is optional and only used for reference devices. When this option is specified, Type/Average Enum of each Type Id Flags would be set to `reserved`. This is used to verify the Probing Subject correctly handles invalid Type Id Flags. This is only available when `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is enabled.
1987
1988```bash
1989> linkmetrics config fe80:0:0:0:3092:f334:1455:1ad2 enhanced-ack register qm
1990Received Link Metrics Management Response from: fe80:0:0:0:3092:f334:1455:1ad2
1991Status: Success
1992Done
1993
1994> linkmetrics config async fe80:0:0:0:3092:f334:1455:1ad2 enhanced-ack register qm
1995Done
1996> Received Link Metrics Management Response from: fe80:0:0:0:3092:f334:1455:1ad2
1997Status: Success
1998
1999> linkmetrics config async fe80:0:0:0:3092:f334:1455:1ad2 enhanced-ack register qm r
2000Done
2001> Received Link Metrics Management Response from: fe80:0:0:0:3092:f334:1455:1ad2
2002Status: Cannot support new series
2003```
2004
2005### linkmetrics config \[async\] \<ipaddr\> forward \<seriesid\> \<ldraX\> \<pqmr\>
2006
2007Send a Link Metrics Management Request to configure a Forward Tracking Series.
2008
2009- async: Use the non-blocking mode.
2010- ipaddr: Peer address.
2011- seriesid: The Series ID.
2012- ldraX: This specifies which frames are to be accounted.
2013 - l: MLE Link Probe.
2014 - d: MAC Data.
2015 - r: MAC Data Request.
2016 - a: MAC Ack.
2017 - X: This represents none of the above flags, i.e., to stop accounting and remove the series. This can only be used without any other flags.
2018- pqmr: This specifies what metrics to query.
2019 - p: Layer 2 Number of PDUs received.
2020 - q: Layer 2 LQI.
2021 - m: Link Margin.
2022 - r: RSSI.
2023
2024```bash
2025> linkmetrics config fe80:0:0:0:3092:f334:1455:1ad2 forward 1 dra pqmr
2026Received Link Metrics Management Response from: fe80:0:0:0:3092:f334:1455:1ad2
2027Status: SUCCESS
2028Done
2029
2030> linkmetrics config async fe80:0:0:0:3092:f334:1455:1ad2 forward 1 dra pqmr
2031Done
2032> Received Link Metrics Management Response from: fe80:0:0:0:3092:f334:1455:1ad2
2033Status: SUCCESS
2034```
2035
2036### linkmetrics probe \<ipaddr\> \<seriesid\> \<length\>
2037
2038Send a MLE Link Probe message to the peer.
2039
2040- ipaddr: Peer address.
2041- seriesid: The Series ID for which this Probe message targets at.
2042- length: The length of the Probe message, valid range: [0, 64].
2043
2044```bash
2045> linkmetrics probe fe80:0:0:0:3092:f334:1455:1ad2 1 10
2046Done
2047```
2048
2049### linkmetrics request \[async\] \<ipaddr\> single \<pqmr\>
2050
2051Perform a Link Metrics query (Single Probe).
2052
2053- async: Use the non-blocking mode.
2054- ipaddr: Peer address.
2055- pqmr: This specifies what metrics to query.
2056 - p: Layer 2 Number of PDUs received.
2057 - q: Layer 2 LQI.
2058 - m: Link Margin.
2059 - r: RSSI.
2060
2061```bash
2062> linkmetrics request fe80:0:0:0:3092:f334:1455:1ad2 single qmr
2063Received Link Metrics Report from: fe80:0:0:0:3092:f334:1455:1ad2
2064
2065 - LQI: 76 (Exponential Moving Average)
2066 - Margin: 82 (dB) (Exponential Moving Average)
2067 - RSSI: -18 (dBm) (Exponential Moving Average)
2068Done
2069
2070> linkmetrics request async fe80:0:0:0:3092:f334:1455:1ad2 single qmr
2071Done
2072> Received Link Metrics Report from: fe80:0:0:0:3092:f334:1455:1ad2
2073
2074 - LQI: 76 (Exponential Moving Average)
2075 - Margin: 82 (dB) (Exponential Moving Average)
2076 - RSSI: -18 (dBm) (Exponential Moving Average)
2077```
2078
2079### linkmetrics request \[async\] \<ipaddr\> forward \<seriesid\>
2080
2081Perform a Link Metrics query (Forward Tracking Series).
2082
2083- sync: Use the blocking mode.
2084- ipaddr: Peer address.
2085- seriesid: The Series ID.
2086
2087```bash
2088> linkmetrics request fe80:0:0:0:3092:f334:1455:1ad2 forward 1
2089Received Link Metrics Report from: fe80:0:0:0:3092:f334:1455:1ad2
2090
2091 - PDU Counter: 2 (Count/Summation)
2092 - LQI: 76 (Exponential Moving Average)
2093 - Margin: 82 (dB) (Exponential Moving Average)
2094 - RSSI: -18 (dBm) (Exponential Moving Average)
2095Done
2096
2097> linkmetrics request async fe80:0:0:0:3092:f334:1455:1ad2 forward 1
2098Done
2099> Received Link Metrics Report from: fe80:0:0:0:3092:f334:1455:1ad2
2100
2101 - PDU Counter: 2 (Count/Summation)
2102 - LQI: 76 (Exponential Moving Average)
2103 - Margin: 82 (dB) (Exponential Moving Average)
2104 - RSSI: -18 (dBm) (Exponential Moving Average)
2105```
2106
2107### linkmetricsmgr disable
2108
2109Disable the Link Metrics Manager.
2110
2111`OPENTHREAD_CONFIG_LINK_METRICS_MANAGER_ENABLE` is required.
2112
2113```bash
2114> linkmetricsmgr disable
2115Done
2116```
2117
2118### linkmetricsmgr enable
2119
2120Enable the Link Metrics Manager.
2121
2122`OPENTHREAD_CONFIG_LINK_METRICS_MANAGER_ENABLE` is required.
2123
2124```bash
2125> linkmetricsmgr enable
2126Done
2127```
2128
2129### linkmetricsmgr show
2130
2131Display the Link Metrics data of all subjects. The subjects are identified by its extended address.
2132
2133`OPENTHREAD_CONFIG_LINK_METRICS_MANAGER_ENABLE` is required.
2134
2135```bash
2136
2137> linkmetricsmgr show
2138ExtAddr:827aa7f7f63e1234, LinkMargin:80, Rssi:-20
2139Done
2140```
2141
2142### locate
2143
2144Gets the current state (`In Progress` or `Idle`) of anycast locator.
2145
2146`OPENTHREAD_CONFIG_TMF_ANYCAST_LOCATOR_ENABLE` is required.
2147
2148```bash
2149> locate
2150Idle
2151Done
2152
2153> locate fdde:ad00:beef:0:0:ff:fe00:fc10
2154
2155> locate
2156In Progress
2157Done
2158```
2159
2160### locate \<anycastaddr\>
2161
2162Locate the closest destination of an anycast address (i.e., find the destination's mesh local EID and RLOC16).
2163
2164`OPENTHREAD_CONFIG_TMF_ANYCAST_LOCATOR_ENABLE` is required.
2165
2166The closest destination is determined based on the the current routing table and path costs within the Thread mesh.
2167
2168Locate the leader using its anycast address:
2169
2170```bash
2171> locate fdde:ad00:beef:0:0:ff:fe00:fc00
2172fdde:ad00:beef:0:d9d3:9000:16b:d03b 0xc800
2173Done
2174```
2175
2176Locate the closest destination of a service anycast address:
2177
2178```bash
2179
2180> srp server enable
2181Done
2182
2183> netdata show
2184Prefixes:
2185Routes:
2186Services:
218744970 5d c002 s c800
218844970 5d c002 s cc00
2189Done
2190
2191> locate fdde:ad00:beef:0:0:ff:fe00:fc10
2192fdde:ad00:beef:0:a477:dc98:a4e4:71ea 0xcc00
2193done
2194```
2195
2196### log filename \<filename\>
2197
2198- Note: Simulation Only, ie: `OPENTHREAD_EXAMPLES_SIMULATION`
2199- Requires `OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_DEBUG_UART`
2200
2201Specifies filename to capture otPlatLog() messages, useful when debugging automated test scripts on Linux when logging disrupts the automated test scripts.
2202
2203### log level
2204
2205Get the log level.
2206
2207```bash
2208> log level
22091
2210Done
2211```
2212
2213### log level \<level\>
2214
2215Set the log level.
2216
2217```bash
2218> log level 4
2219Done
2220```
2221
2222### meshdiag topology \[ip6-addrs\] \[children\]
2223
2224Discover network topology (list of routers and their connections).
2225
2226This command requires `OPENTHREAD_CONFIG_MESH_DIAG_ENABLE` and `OPENTHREAD_FTD`.
2227
2228Parameters are optional and indicate additional items to discover. Can be added in any order.
2229
2230- `ip6-addrs` to discover the list of IPv6 addresses of every router.
2231- `children` to discover the child table of every router.
2232
2233Output lists all discovered routers. Information per router:
2234
2235- Router ID
2236- RLOC16
2237- Extended MAC address
2238- Thread Version (if known).
2239- Whether the router is this device is itself (`me`)
2240- Whether the router is the parent of this device when device is a child (`parent`)
2241- Whether the router is `leader`
2242- Whether the router acts as a border router providing external connectivity (`br`)
2243- List of routers to which this router has a link:
2244 - `3-links`: Router IDs to which this router has a incoming link with link quality 3
2245 - `2-links`: Router IDs to which this router has a incoming link with link quality 2
2246 - `1-links`: Router IDs to which this router has a incoming link with link quality 1
2247 - If a list if empty, it is omitted in the out.
2248- If `ip6-addrs`, list of IPv6 addresses of the router
2249- If `children`, list of all children of the router. Information per child:
2250 - RLOC16
2251 - Incoming Link Quality from perspective of parent to child (zero indicates unknown)
2252 - Child Device mode (`r` rx-on-when-idle, `d` Full Thread Device, `n` Full Network Data, `-` no flags set)
2253 - Whether the child is this device itself (`me`)
2254 - Whether the child acts as a border router providing external connectivity (`br`)
2255
2256Discover network topology:
2257
2258```bash
2259> meshdiag topology
2260id:02 rloc16:0x0800 ext-addr:8aa57d2c603fe16c ver:4 - me - leader
2261 3-links:{ 46 }
2262id:46 rloc16:0xb800 ext-addr:fe109d277e0175cc ver:4
2263 3-links:{ 02 51 57 }
2264id:33 rloc16:0x8400 ext-addr:d2e511a146b9e54d ver:4
2265 3-links:{ 51 57 }
2266id:51 rloc16:0xcc00 ext-addr:9aab43ababf05352 ver:4
2267 3-links:{ 33 57 }
2268 2-links:{ 46 }
2269id:57 rloc16:0xe400 ext-addr:dae9c4c0e9da55ff ver:4
2270 3-links:{ 46 51 }
2271 1-links:{ 33 }
2272Done
2273```
2274
2275Discover network topology with router's IPv6 addresses and children:
2276
2277```bash
2278> meshdiag topology children ip6-addrs
2279id:62 rloc16:0xf800 ext-addr:ce349873897233a5 ver:4 - me - br
2280 3-links:{ 46 }
2281 ip6-addrs:
2282 fdde:ad00:beef:0:0:ff:fe00:f800
2283 fdde:ad00:beef:0:211d:39e9:6b2e:4ad1
2284 fe80:0:0:0:cc34:9873:8972:33a5
2285 children: none
2286id:02 rloc16:0x0800 ext-addr:8aa57d2c603fe16c ver:4 - leader - br
2287 3-links:{ 46 51 }
2288 ip6-addrs:
2289 fdde:ad00:beef:0:0:ff:fe00:fc00
2290 fdde:ad00:beef:0:0:ff:fe00:800
2291 fdde:ad00:beef:0:8a36:a3eb:47ae:a9b0
2292 fe80:0:0:0:88a5:7d2c:603f:e16c
2293 children:
2294 rloc16:0x0803 lq:3, mode:rn
2295 rloc16:0x0804 lq:3, mode:rdn
2296id:33 rloc16:0x8400 ext-addr:d2e511a146b9e54d ver:4
2297 3-links:{ 57 }
2298 ip6-addrs:
2299 fdde:ad00:beef:0:0:ff:fe00:8400
2300 fdde:ad00:beef:0:824:a126:cf19:a9f4
2301 fe80:0:0:0:d0e5:11a1:46b9:e54d
2302 children: none
2303id:51 rloc16:0xcc00 ext-addr:9aab43ababf05352 ver:4
2304 3-links:{ 02 46 57 }
2305 ip6-addrs:
2306 fdde:ad00:beef:0:0:ff:fe00:cc00
2307 fdde:ad00:beef:0:2986:bba3:12d0:1dd2
2308 fe80:0:0:0:98ab:43ab:abf0:5352
2309 children: none
2310id:57 rloc16:0xe400 ext-addr:dae9c4c0e9da55ff ver:4
2311 3-links:{ 33 51 }
2312 ip6-addrs:
2313 fdde:ad00:beef:0:0:ff:fe00:e400
2314 fdde:ad00:beef:0:87d0:550:bc18:9920
2315 fe80:0:0:0:d8e9:c4c0:e9da:55ff
2316 children:
2317 rloc16:0xe402 lq:3, mode:rn - br
2318 rloc16:0xe403 lq:3, mode:rn
2319id:46 rloc16:0xb800 ext-addr:fe109d277e0175cc ver:4
2320 3-links:{ 02 51 62 }
2321 ip6-addrs:
2322 fdde:ad00:beef:0:0:ff:fe00:b800
2323 fdde:ad00:beef:0:df4d:2994:d85c:c337
2324 fe80:0:0:0:fc10:9d27:7e01:75cc
2325 children: none
2326Done
2327```
2328
2329Discover network topology with children:
2330
2331```bash
2332> meshdiag topology children
2333id:02 rloc16:0x0800 ext-addr:8aa57d2c603fe16c ver:4 - parent - leader - br
2334 3-links:{ 46 51 }
2335 children:
2336 rloc16:0x0803 lq:0, mode:rn
2337 rloc16:0x0804 lq:0, mode:rdn - me
2338id:46 rloc16:0xb800 ext-addr:fe109d277e0175cc ver:4
2339 3-links:{ 02 51 62 }
2340 children: none
2341id:33 rloc16:0x8400 ext-addr:d2e511a146b9e54d ver:4
2342 3-links:{ 57 }
2343 children: none
2344id:51 rloc16:0xcc00 ext-addr:9aab43ababf05352 ver:4
2345 3-links:{ 02 46 57 }
2346 children: none
2347id:57 rloc16:0xe400 ext-addr:dae9c4c0e9da55ff ver:4
2348 3-links:{ 33 51 }
2349 children:
2350 rloc16:0xe402 lq:3, mode:rn - br
2351 rloc16:0xe403 lq:3, mode:rn
2352id:62 rloc16:0xf800 ext-addr:ce349873897233a5 ver:4 - br
2353 3-links:{ 46 }
2354 children: none
2355```
2356
2357### meshdiag childtable \<router-rloc16\>
2358
2359Start a query for child table of a router with a given RLOC16.
2360
2361Output lists all child entries. Information per child:
2362
2363- RLOC16
2364- Extended MAC address
2365- Thread Version
2366- Timeout (in seconds)
2367- Age (seconds since last heard)
2368- Supervision interval (in seconds)
2369- Number of queued messages (in case the child is sleepy)
2370- Device Mode
2371- RSS (average and last) and link margin
2372- Error rates, frame tx (at MAC layer), IPv6 message tx (above MAC)
2373- Connection time (seconds since link establishment {dd}d.{hh}:{mm}:{ss} format)
2374- CSL info
2375 - If synchronized
2376 - Period (in unit of 10-symbols-time)
2377 - Timeout (in seconds)
2378 - Channel
2379
2380```bash
2381> meshdiag childtable 0x6400
2382rloc16:0x6402 ext-addr:8e6f4d323bbed1fe ver:4
2383 timeout:120 age:36 supvn:129 q-msg:0
2384 rx-on:yes type:ftd full-net:yes
2385 rss - ave:-20 last:-20 margin:80
2386 err-rate - frame:11.51% msg:0.76%
2387 conn-time:00:11:07
2388 csl - sync:no period:0 timeout:0 channel:0
2389rloc16:0x6403 ext-addr:ee24e64ecf8c079a ver:4
2390 timeout:120 age:19 supvn:129 q-msg:0
2391 rx-on:no type:mtd full-net:no
2392 rss - ave:-20 last:-20 margin:80
2393 err-rate - frame:0.73% msg:0.00%
2394 conn-time:01:08:53
2395 csl - sync:no period:0 timeout:0 channel:0
2396Done
2397```
2398
2399### meshdiag childip6 \<parent-rloc16\>
2400
2401Send a query to a parent to retrieve the IPv6 addresses of all its MTD children.
2402
2403```bash
2404> meshdiag childip6 0xdc00
2405child-rloc16: 0xdc02
2406 fdde:ad00:beef:0:ded8:cd58:b73:2c21
2407 fd00:2:0:0:c24a:456:3b6b:c597
2408 fd00:1:0:0:120b:95fe:3ecc:d238
2409child-rloc16: 0xdc03
2410 fdde:ad00:beef:0:3aa6:b8bf:e7d6:eefe
2411 fd00:2:0:0:8ff8:a188:7436:6720
2412 fd00:1:0:0:1fcf:5495:790a:370f
2413Done
2414```
2415
2416### meshdiag routerneighbortable \<router-rloc16\>
2417
2418Start a query for router neighbor table of a router with a given RLOC16.
2419
2420Output lists all router neighbor entries. Information per entry:
2421
2422- RLOC16
2423- Extended MAC address
2424- Thread Version
2425- RSS (average and last) and link margin
2426- Error rates, frame tx (at MAC layer), IPv6 message tx (above MAC)
2427- Connection time (seconds since link establishment {dd}d.{hh}:{mm}:{ss} format)
2428
2429```bash
2430> meshdiag routerneighbortable 0x7400
2431rloc16:0x9c00 ext-addr:764788cf6e57a4d2 ver:4
2432 rss - ave:-20 last:-20 margin:80
2433 err-rate - frame:1.38% msg:0.00%
2434 conn-time:01:54:02
2435rloc16:0x7c00 ext-addr:4ed24fceec9bf6d3 ver:4
2436 rss - ave:-20 last:-20 margin:80
2437 err-rate - frame:0.72% msg:0.00%
2438 conn-time:00:11:27
2439Done
2440```
2441
2442### mliid \<iid\>
2443
2444Set the Mesh Local IID.
2445
2446It must be used before Thread stack is enabled.
2447
2448Only for testing/reference device.
2449
2450```bash
2451> mliid 1122334455667788
2452Done
2453```
2454
2455### mlr reg \<ipaddr\> ... [timeout]
2456
2457Register Multicast Listeners to Primary Backbone Router, with an optional `timeout` (in seconds).
2458
2459Omit `timeout` to use the default MLR timeout on the Primary Backbone Router.
2460
2461Use `timeout = 0` to deregister Multicast Listeners.
2462
2463NOTE: Only for Thread 1.2 Commissioner FTD device.
2464
2465```bash
2466> mlr reg ff04::1
2467status 0, 0 failed
2468Done
2469> mlr reg ff04::1 ff04::2 ff02::1
2470status 2, 1 failed
2471ff02:0:0:0:0:0:0:1
2472Done
2473> mlr reg ff04::1 ff04::2 1000
2474status 0, 0 failed
2475Done
2476> mlr reg ff04::1 ff04::2 0
2477status 0, 0 failed
2478Done
2479```
2480
2481### mode
2482
2483Get the Thread Device Mode value.
2484
2485- -: no flags set (rx-off-when-idle, minimal Thread device, stable network data)
2486- r: rx-on-when-idle
2487- d: Full Thread Device
2488- n: Full Network Data
2489
2490```bash
2491> mode
2492rdn
2493Done
2494```
2495
2496### mode [rdn]
2497
2498Set the Thread Device Mode value.
2499
2500- -: no flags set (rx-off-when-idle, minimal Thread device, stable network data)
2501- r: rx-on-when-idle
2502- d: Full Thread Device
2503- n: Full Network Data
2504
2505```bash
2506> mode rdn
2507Done
2508```
2509
2510```bash
2511> mode -
2512Done
2513```
2514
2515### multiradio
2516
2517Get the list of supported radio links by the device.
2518
2519This command is always available, even when only a single radio is supported by the device.
2520
2521```bash
2522> multiradio
2523[15.4, TREL]
2524Done
2525```
2526
2527### multiradio neighbor list
2528
2529Get the list of neighbors and their supported radios and their preference.
2530
2531This command is only available when device supports more than one radio link.
2532
2533```bash
2534> multiradio neighbor list
2535ExtAddr:3a65bc38dbe4a5be, RLOC16:0xcc00, Radios:[15.4(255), TREL(255)]
2536ExtAddr:17df23452ee4a4be, RLOC16:0x1300, Radios:[15.4(255)]
2537Done
2538```
2539
2540### multiradio neighbor \<ext address\>
2541
2542Get the radio info for specific neighbor with a given extended address.
2543
2544This command is only available when device supports more than one radio link.
2545
2546```bash
2547> multiradio neighbor 3a65bc38dbe4a5be
2548[15.4(255), TREL(255)]
2549Done
2550```
2551
2552### nat64 cidr
2553
2554Gets the IPv4 configured CIDR in the NAT64 translator.
2555
2556`OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE` is required.
2557
2558```bash
2559> nat64 cidr
2560192.168.255.0/24
2561Done
2562```
2563
2564### nat64 cidr \<IPv4 address\>
2565
2566Sets the IPv4 CIDR in the NAT64 translator.
2567
2568Note:
2569
2570- `OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE` is required.
2571- A valid CIDR must have a non-zero prefix length.
2572- When updating the CIDR, NAT64 translator will be reset and all existing sessions will be expired.
2573
2574```bash
2575> nat64 cidr 192.168.100.0/24
2576Done
2577```
2578
2579### nat64 disable
2580
2581Disable NAT64 functions, including the translator and the prefix publishing.
2582
2583This command will reset the mapping table in the translator (if NAT64 translator is enabled in the build).
2584
2585`OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE` or `OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE` are required.
2586
2587```bash
2588> nat64 disable
2589Done
2590```
2591
2592### nat64 enable
2593
2594Enable NAT64 functions, including the translator and the prefix publishing.
2595
2596This command can be called anytime.
2597
2598`OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE` or `OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE` are required.
2599
2600```bash
2601> nat64 enable
2602Done
2603```
2604
2605### nat64 state
2606
2607Gets the state of NAT64 functions.
2608
2609Possible results for prefix manager are (`OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE` is required):
2610
2611- `Disabled`: NAT64 prefix manager is disabled.
2612- `NotRunning`: NAT64 prefix manager is enabled, but is not running, probably because the routing manager is disabled.
2613- `Idle`: NAT64 prefix manager is enabled and is running, but is not publishing a NAT64 prefix. Usually when there is another border router publishing a NAT64 prefix with higher priority.
2614- `Active`: NAT64 prefix manager is enabled, running and publishing a NAT64 prefix.
2615
2616Possible results for NAT64 translator are (`OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE` is required):
2617
2618- `Disabled`: NAT64 translator is disabled.
2619- `NotRunning`: NAT64 translator is enabled, but is not translating packets, probably because it is not configured with a NAT64 prefix or a CIDR for NAT64.
2620- `Active`: NAT64 translator is enabled and is translating packets.
2621
2622`OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE` or `OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE` are required.
2623
2624```bash
2625> nat64 state
2626PrefixManager: NotRunning
2627Translator: NotRunning
2628Done
2629
2630> nat64 state
2631PrefixManager: Idle
2632Translator: NotRunning
2633Done
2634
2635> nat64 state
2636PrefixManager: Active
2637Translator: Active
2638Done
2639```
2640
2641### nat64 mappings
2642
2643Get the NAT64 translator mappings.
2644
2645`OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE` is required.
2646
2647```bash
2648> nat64 mappings
2649| | Address | | 4 to 6 | 6 to 4 |
2650+----------+---------------------------+--------+--------------+--------------+
2651| ID | IPv6 | IPv4 | Expiry | Pkts | Bytes | Pkts | Bytes |
2652+----------+------------+--------------+--------+------+-------+------+-------+
2653| 00021cb9 | fdc7::df79 | 192.168.64.2 | 7196s | 6 | 456 | 11 | 1928 |
2654| | TCP | 0 | 0 | 0 | 0 |
2655| | UDP | 1 | 136 | 16 | 1608 |
2656| | ICMP | 5 | 320 | 5 | 320 |
2657```
2658
2659### nat64 counters
2660
2661Get the NAT64 translator packet and error counters.
2662
2663`OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE` is required.
2664
2665```bash
2666> nat64 counters
2667| | 4 to 6 | 6 to 4 |
2668+---------------+-------------------------+-------------------------+
2669| Protocol | Pkts | Bytes | Pkts | Bytes |
2670+---------------+----------+--------------+----------+--------------+
2671| Total | 11 | 704 | 11 | 704 |
2672| TCP | 0 | 0 | 0 | 0 |
2673| UDP | 0 | 0 | 0 | 0 |
2674| ICMP | 11 | 704 | 11 | 704 |
2675| Errors | Pkts | Pkts |
2676+---------------+-------------------------+-------------------------+
2677| Total | 8 | 4 |
2678| Illegal Pkt | 0 | 0 |
2679| Unsup Proto | 0 | 0 |
2680| No Mapping | 2 | 0 |
2681Done
2682```
2683
2684### neighbor linkquality
2685
2686Print link quality info for all neighbors.
2687
2688```bash
2689> neighbor linkquality
2690| RLOC16 | Extended MAC | Frame Error | Msg Error | Avg RSS | Last RSS | Age |
2691+--------+------------------+-------------+-----------+---------+----------+-------+
2692| 0xe800 | 9e2fa4e1b84f92db | 0.00 % | 0.00 % | -46 | -48 | 1 |
2693| 0xc001 | 0ad7ed6beaa6016d | 4.67 % | 0.08 % | -68 | -72 | 10 |
2694Done
2695```
2696
2697### neighbor list
2698
2699List RLOC16 of neighbors.
2700
2701```bash
2702> neighbor list
27030xcc01 0xc800 0xf000
2704Done
2705```
2706
2707### neighbor table
2708
2709Print table of neighbors.
2710
2711```bash
2712> neighbor table
2713| Role | RLOC16 | Age | Avg RSSI | Last RSSI |R|D|N| Extended MAC |
2714+------+--------+-----+----------+-----------+-+-+-+------------------+
2715| C | 0xcc01 | 96 | -46 | -46 |1|1|1| 1eb9ba8a6522636b |
2716| R | 0xc800 | 2 | -29 | -29 |1|1|1| 9a91556102c39ddb |
2717| R | 0xf000 | 3 | -28 | -28 |1|1|1| 0ad7ed6beaa6016d |
2718Done
2719```
2720
2721### neighbor conntime
2722
2723Print connection time and age of neighbors.
2724
2725The table provides the following info per neighbor:
2726
2727- RLOC16
2728- Extended MAC address
2729- Age (seconds since last heard from neighbor)
2730- Connection time (seconds since link establishment with neighbor)
2731
2732Duration intervals are formatted as `<hh>:<mm>:<ss>` for hours, minutes, and seconds if the duration is less than one day. If the duration is longer than one day, the format is `<dd>d.<hh>:<mm>:<ss>`.
2733
2734```bash
2735> neighbor conntime
2736| RLOC16 | Extended MAC | Last Heard (Age) | Connection Time |
2737+--------+------------------+------------------+------------------+
2738| 0x8401 | 1a28be396a14a318 | 00:00:13 | 00:07:59 |
2739| 0x5c00 | 723ebf0d9eba3264 | 00:00:03 | 00:11:27 |
2740| 0xe800 | ce53628a1e3f5b3c | 00:00:02 | 00:00:15 |
2741Done
2742```
2743
2744### neighbor conntime list
2745
2746Print connection time and age of neighbors.
2747
2748This command is similar to `neighbor conntime`, but it displays the information in a list format. The age and connection time are both displayed in seconds.
2749
2750```bash
2751> neighbor conntime list
27520x8401 1a28be396a14a318 age:63 conn-time:644
27530x5c00 723ebf0d9eba3264 age:23 conn-time:852
27540xe800 ce53628a1e3f5b3c age:23 conn-time:180
2755Done
2756```
2757
2758### netstat
2759
2760List all UDP sockets.
2761
2762```bash
2763> netstat
2764| Local Address | Peer Address |
2765+-------------------------------------------------+-------------------------------------------------+
2766| [0:0:0:0:0:0:0:0]:49153 | [0:0:0:0:0:0:0:0]:0 |
2767| [0:0:0:0:0:0:0:0]:49152 | [0:0:0:0:0:0:0:0]:0 |
2768| [0:0:0:0:0:0:0:0]:61631 | [0:0:0:0:0:0:0:0]:0 |
2769| [0:0:0:0:0:0:0:0]:19788 | [0:0:0:0:0:0:0:0]:0 |
2770Done
2771```
2772
2773### networkdiagnostic get \<addr\> \<type\> ..
2774
2775Send network diagnostic request to retrieve tlv of \<type\>s.
2776
2777If \<addr\> is unicast address, `Diagnostic Get` will be sent. if \<addr\> is multicast address, `Diagnostic Query` will be sent.
2778
2779```bash
2780> networkdiagnostic get fdde:ad00:beef:0:0:ff:fe00:fc00 0 1 6
2781> DIAG_GET.rsp/ans: 00080e336e1c41494e1c01020c000608640b0f674074c503
2782Ext Address: '0e336e1c41494e1c'
2783Rloc16: 0x0c00
2784Leader Data:
2785 PartitionId: 0x640b0f67
2786 Weighting: 64
2787 DataVersion: 116
2788 StableDataVersion: 197
2789 LeaderRouterId: 0x03
2790Done
2791
2792> networkdiagnostic get ff02::1 0 1
2793> DIAG_GET.rsp/ans: 00080e336e1c41494e1c01020c00
2794Ext Address: '0e336e1c41494e1c'
2795Rloc16: 0x0c00
2796Done
2797DIAG_GET.rsp/ans: 00083efcdb7e3f9eb0f201021800
2798Ext Address: '3efcdb7e3f9eb0f2'
2799Rloc16: 0x1800
2800Done
2801```
2802
2803### networkdiagnostic reset \<addr\> \<type\> ..
2804
2805Send network diagnostic request to reset \<addr\>'s tlv of \<type\>s. Currently only `MAC Counters`(9) is supported.
2806
2807```bash
2808> diagnostic reset fd00:db8::ff:fe00:0 9
2809Done
2810```
2811
2812### networkidtimeout
2813
2814Get the NETWORK_ID_TIMEOUT parameter used in the Router role.
2815
2816```bash
2817> networkidtimeout
2818120
2819Done
2820```
2821
2822### networkidtimeout \<timeout\>
2823
2824Set the NETWORK_ID_TIMEOUT parameter used in the Router role.
2825
2826```bash
2827> networkidtimeout 120
2828Done
2829```
2830
2831### networkkey
2832
2833Get the Thread Network Key value.
2834
2835```bash
2836> networkkey
283700112233445566778899aabbccddeeff
2838Done
2839```
2840
2841### networkkey \<key\>
2842
2843Set the Thread Network Key value.
2844
2845```bash
2846> networkkey 00112233445566778899aabbccddeeff
2847Done
2848```
2849
2850### networkname
2851
2852Get the Thread Network Name.
2853
2854```bash
2855> networkname
2856OpenThread
2857Done
2858```
2859
2860### networkname \<name\>
2861
2862Set the Thread Network Name.
2863
2864**NOTE** The current commissioning credential becomes stale after changing this value. Use [pskc](#pskc--p-keypassphrase) to reset.
2865
2866```bash
2867> networkname OpenThread
2868Done
2869```
2870
2871### networktime
2872
2873Get the Thread network time and the time sync parameters.
2874
2875```bash
2876> networktime
2877Network Time: 21084154us (synchronized)
2878Time Sync Period: 100s
2879XTAL Threshold: 300ppm
2880Done
2881```
2882
2883### networktime \<timesyncperiod\> \<xtalthreshold\>
2884
2885Set time sync parameters
2886
2887- timesyncperiod: The time synchronization period, in seconds.
2888- xtalthreshold: The XTAL accuracy threshold for a device to become Router-Capable device, in PPM.
2889
2890```bash
2891> networktime 100 300
2892Done
2893```
2894
2895### nexthop
2896
2897Output the table of allocated Router IDs and the current next hop (as Router ID) and path cost for each ID.
2898
2899```bash
2900> nexthop
2901| ID |NxtHop| Cost |
2902+------+------+------+
2903| 9 | 9 | 1 |
2904| 25 | 25 | 0 |
2905| 30 | 30 | 1 |
2906| 46 | - | - |
2907| 50 | 30 | 3 |
2908| 60 | 30 | 2 |
2909Done
2910```
2911
2912### nexthop \<rloc16\>
2913
2914Get the next hop (as RLOC16) and path cost towards a given RLOC16 destination.
2915
2916```bash
2917> nexthop 0xc000
29180xc000 cost:0
2919Done
2920
2921nexthop 0x8001
29220x2000 cost:3
2923Done
2924```
2925
2926### panid
2927
2928Get the IEEE 802.15.4 PAN ID value.
2929
2930```bash
2931> panid
29320xdead
2933Done
2934```
2935
2936### panid \<panid\>
2937
2938Set the IEEE 802.15.4 PAN ID value.
2939
2940```bash
2941> panid 0xdead
2942Done
2943```
2944
2945### parent
2946
2947Get the diagnostic information for a Thread Router as parent.
2948
2949Note: When operating as a Thread Router when `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is enabled, this command will return the cached information from when the device was previously attached as a Thread Child. Returning cached information is necessary to support the Thread Test Harness - Test Scenario 8.2.x requests the former parent (i.e. Joiner Router's) MAC address even if the device has already promoted to a router.
2950
2951```bash
2952> parent
2953Ext Addr: be1857c6c21dce55
2954Rloc: 5c00
2955Link Quality In: 3
2956Link Quality Out: 3
2957Age: 20
2958Version: 4
2959Done
2960```
2961
2962Note: When `OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE` is enabled, this command will return two extra lines with information relevant for CSL Receiver operation.
2963
2964```bash
2965CSL clock accuracy: 20
2966CSL uncertainty: 5
2967```
2968
2969### parentpriority
2970
2971Get the assigned parent priority value, -2 means not assigned.
2972
2973```bash
2974> parentpriority
29751
2976Done
2977```
2978
2979### parentpriority \<parentpriority\>
2980
2981Set the assigned parent priority value: 1, 0, -1 or -2.
2982
2983```bash
2984> parentpriority 1
2985Done
2986```
2987
2988### partitionid
2989
2990Get the Thread Network Partition ID.
2991
2992```bash
2993> partitionid
29944294967295
2995Done
2996```
2997
2998### partitionid preferred
2999
3000Get the preferred Thread Leader Partition ID.
3001
3002`OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is required.
3003
3004```bash
3005> partitionid preferred
30064294967295
3007Done
3008```
3009
3010### partitionid preferred \<partitionid\>
3011
3012Set the preferred Thread Leader Partition ID.
3013
3014`OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is required.
3015
3016```bash
3017> partitionid preferred 0xffffffff
3018Done
3019```
3020
3021### ping \[async\] \[-I source\] \[-m] \<ipaddr\> \[size\] \[count\] \[interval\] \[hoplimit\] \[timeout\]
3022
3023Send an ICMPv6 Echo Request.
3024
3025- async: Use the non-blocking mode. New commands are allowed before the ping process terminates.
3026- source: The source IPv6 address of the echo request.
3027- -m: multicast loop, which allows looping back pings to multicast addresses that the device itself is subscribed to.
3028- size: The number of data bytes to be sent.
3029- count: The number of ICMPv6 Echo Requests to be sent.
3030- interval: The interval between two consecutive ICMPv6 Echo Requests in seconds. The value may have fractional form, for example `0.5`.
3031- hoplimit: The hoplimit of ICMPv6 Echo Request to be sent.
3032- timeout: Time in seconds to wait for the final ICMPv6 Echo Reply after sending out the request. The value may have fractional form, for example `3.5`.
3033
3034```bash
3035> ping fd00:db8:0:0:76b:6a05:3ae9:a61a
3036> 16 bytes from fd00:db8:0:0:76b:6a05:3ae9:a61a: icmp_seq=5 hlim=64 time=0ms
30371 packets transmitted, 1 packets received. Packet loss = 0.0%. Round-trip min/avg/max = 0/0.0/0 ms.
3038Done
3039
3040> ping -I fd00:db8:0:0:76b:6a05:3ae9:a61a ff02::1 100 1 1 1
3041> 108 bytes from fd00:db8:0:0:f605:fb4b:d429:d59a: icmp_seq=4 hlim=64 time=7ms
30421 packets transmitted, 1 packets received. Round-trip min/avg/max = 7/7.0/7 ms.
3043Done
3044```
3045
3046The address can be an IPv4 address, which will be synthesized to an IPv6 address using the preferred NAT64 prefix from the network data.
3047
3048> Note: The command will return `InvalidState` when the preferred NAT64 prefix is unavailable.
3049
3050```bash
3051> ping 172.17.0.1
3052Pinging synthesized IPv6 address: fdde:ad00:beef:2:0:0:ac11:1
3053> 16 bytes from fdde:ad00:beef:2:0:0:ac11:1: icmp_seq=5 hlim=64 time=0ms
30541 packets transmitted, 1 packets received. Packet loss = 0.0%. Round-trip min/avg/max = 0/0.0/0 ms.
3055Done
3056```
3057
3058### ping stop
3059
3060Stop sending ICMPv6 Echo Requests.
3061
3062```bash
3063> ping stop
3064Done
3065```
3066
3067### platform
3068
3069Print the current platform
3070
3071```bash
3072> platform
3073NRF52840
3074Done
3075```
3076
3077### pollperiod
3078
3079Get the customized data poll period of sleepy end device (milliseconds). Only for certification test.
3080
3081```bash
3082> pollperiod
30830
3084Done
3085```
3086
3087### pollperiod \<pollperiod\>
3088
3089Set the customized data poll period for sleepy end device (milliseconds >= 10ms). Only for certification test.
3090
3091```bash
3092> pollperiod 10
3093Done
3094```
3095
3096### pskc
3097
3098Get pskc in hex format.
3099
3100```bash
3101> pskc
310200000000000000000000000000000000
3103Done
3104```
3105
3106### pskc [-p] \<key\>|\<passphrase\>
3107
3108With `-p` generate pskc from \<passphrase\> (UTF-8 encoded) together with **current** network name and extended PAN ID, otherwise set pskc as \<key\> (hex format).
3109
3110```bash
3111> pskc 67c0c203aa0b042bfb5381c47aef4d9e
3112Done
3113> pskc -p 123456
3114Done
3115```
3116
3117### pskcref
3118
3119Get pskc key reference.
3120
3121`OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE` is required.
3122
3123```bash
3124> pskcref
31250x80000000
3126Done
3127```
3128
3129### pskcref \<keyref\>
3130
3131Set pskc key reference as \<keyref\>.
3132
3133`OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE` is required.
3134
3135```bash
3136> pskcref 0x20017
3137Done
3138```
3139
3140### preferrouterid \<routerid\>
3141
3142Prefer a Router ID when solicit router id from Leader.
3143
3144```bash
3145> preferrouterid 16
3146Done
3147```
3148
3149### prefix
3150
3151Get the prefix list in the local Network Data. Note: For the Thread 1.2 border router with backbone capability, the local Domain Prefix would be listed as well (with flag `D`), with preceding `-` if backbone functionality is disabled.
3152
3153```bash
3154> prefix
31552001:dead:beef:cafe::/64 paros med
3156- fd00:7d03:7d03:7d03::/64 prosD med
3157Done
3158```
3159
3160### prefix add \<prefix\> [padcrosnD][prf]
3161
3162Add a valid prefix to the Network Data.
3163
3164Note: The Domain Prefix flag (`D`) is only available for Thread 1.2.
3165
3166- p: Preferred flag
3167- a: Stateless IPv6 Address Autoconfiguration flag
3168- d: DHCPv6 IPv6 Address Configuration flag
3169- c: DHCPv6 Other Configuration flag
3170- r: Default Route flag
3171- o: On Mesh flag
3172- s: Stable flag
3173- n: Nd Dns flag
3174- D: Domain Prefix flag
3175- prf: Default router preference, which may be 'high', 'med', or 'low'.
3176
3177```bash
3178> prefix add 2001:dead:beef:cafe::/64 paros med
3179Done
3180
3181> prefix add fd00:7d03:7d03:7d03::/64 prosD med
3182Done
3183```
3184
3185### prefix meshlocal
3186
3187Get the mesh local prefix.
3188
3189```bash
3190> prefix meshlocal
3191fdde:ad00:beef:0::/64
3192Done
3193```
3194
3195### prefix meshlocal <prefix>
3196
3197Set the mesh local prefix.
3198
3199```bash
3200> prefix meshlocal fdde:ad00:beef:0::/64
3201Done
3202```
3203
3204### prefix remove \<prefix\>
3205
3206Invalidate a prefix in the Network Data.
3207
3208```bash
3209> prefix remove 2001:dead:beef:cafe::/64
3210Done
3211```
3212
3213### promiscuous
3214
3215Get radio promiscuous property.
3216
3217```bash
3218> promiscuous
3219Disabled
3220Done
3221```
3222
3223### promiscuous enable
3224
3225Enable radio promiscuous operation and print raw packet content.
3226
3227```bash
3228> promiscuous enable
3229Done
3230```
3231
3232### promiscuous disable
3233
3234Disable radio promiscuous operation.
3235
3236```bash
3237> promiscuous disable
3238Done
3239```
3240
3241### radio enable
3242
3243Enable radio.
3244
3245```bash
3246> radio enable
3247Done
3248```
3249
3250### radio disable
3251
3252Disable radio.
3253
3254```bash
3255> radio disable
3256Done
3257```
3258
3259### radio stats
3260
3261`OPENTHREAD_CONFIG_RADIO_STATS_ENABLE` is required. This feature is only available on FTD and MTD.
3262
3263The radio statistics shows the time when the radio is in sleep/tx/rx state. The command will show the time of these states since last reset in unit of microseconds. It will also show the percentage of the time.
3264
3265```bash
3266> radio stats
3267Radio Statistics:
3268Total Time: 67.756s
3269Tx Time: 0.022944s (0.03%)
3270Rx Time: 1.482353s (2.18%)
3271Sleep Time: 66.251128s (97.77%)
3272Disabled Time: 0.000080s (0.00%)
3273Done
3274```
3275
3276### radio stats clear
3277
3278`OPENTHREAD_CONFIG_RADIO_STATS_ENABLE` is required. This feature is only available on FTD and MTD.
3279
3280This command resets the radio statistics. It sets all the time to 0.
3281
3282```bash
3283> radio stats clear
3284Done
3285```
3286
3287### radiofilter
3288
3289`OPENTHREAD_CONFIG_MAC_FILTER_ENABLE` is required.
3290
3291The radio filter is mainly intended for testing. It can be used to temporarily block all tx/rx on the IEEE 802.15.4 radio.
3292
3293When radio filter is enabled, radio is put to sleep instead of receive (to ensure device does not receive any frame and/or potentially send ack). Also the frame transmission requests return immediately without sending the frame over the air (return "no ack" error if ack is requested, otherwise return success).
3294
3295Get radio filter status (enabled or disabled).
3296
3297```bash
3298> radiofilter
3299Disabled
3300Done
3301```
3302
3303### radiofilter enable
3304
3305`OPENTHREAD_CONFIG_MAC_FILTER_ENABLE` is required.
3306
3307Enable radio radio filter.
3308
3309```bash
3310> radiofilter enable
3311Done
3312```
3313
3314### radiofilter disable
3315
3316`OPENTHREAD_CONFIG_MAC_FILTER_ENABLE` is required.
3317
3318Disable radio radio filter.
3319
3320```bash
3321> radiofilter disable
3322Done
3323```
3324
3325### rcp
3326
3327RCP-related commands.
3328
3329### region
3330
3331Set the radio region, this can affect the transmit power limit.
3332
3333```bash
3334> region US
3335Done
3336> region
3337US
3338Done
3339```
3340
3341### rcp version
3342
3343Print RCP version string.
3344
3345```bash
3346> rcp version
3347OPENTHREAD/20191113-00825-g82053cc9d-dirty; SIMULATION; Jun 4 2020 17:53:16
3348Done
3349```
3350
3351### releaserouterid \<routerid\>
3352
3353Release a Router ID that has been allocated by the device in the Leader role.
3354
3355```bash
3356> releaserouterid 16
3357Done
3358```
3359
3360### reset
3361
3362Signal a platform reset.
3363
3364```bash
3365> reset
3366```
3367
3368### reset bootloader
3369
3370Signal a platform reset to bootloader mode, if supported.
3371
3372Requires `OPENTHREAD_CONFIG_PLATFORM_BOOTLOADER_MODE_ENABLE`.
3373
3374```bash
3375> reset bootloader
3376Done
3377```
3378
3379### rloc16
3380
3381Get the Thread RLOC16 value.
3382
3383```bash
3384> rloc16
33850xdead
3386Done
3387```
3388
3389### route
3390
3391Get the external route list in the local Network Data.
3392
3393```bash
3394> route
33952001:dead:beef:cafe::/64 s med
3396Done
3397```
3398
3399### route add \<prefix\> [sna][prf]
3400
3401Add a valid external route to the Network Data.
3402
3403- s: Stable flag
3404- n: NAT64 flag
3405- a: Advertising PIO (AP) flag
3406- prf: Default Router Preference, which may be: 'high', 'med', or 'low'.
3407
3408```bash
3409> route add 2001:dead:beef:cafe::/64 s med
3410Done
3411```
3412
3413### route remove \<prefix\>
3414
3415Invalidate a external route in the Network Data.
3416
3417```bash
3418> route remove 2001:dead:beef:cafe::/64
3419Done
3420```
3421
3422### router list
3423
3424List allocated Router IDs.
3425
3426```bash
3427> router list
34288 24 50
3429Done
3430```
3431
3432### router table
3433
3434Print table of routers.
3435
3436```bash
3437> router table
3438| ID | RLOC16 | Next Hop | Path Cost | LQ In | LQ Out | Age | Extended MAC | Link |
3439+----+--------+----------+-----------+-------+--------+-----+------------------+------+
3440| 22 | 0x5800 | 63 | 0 | 0 | 0 | 0 | 0aeb8196c9f61658 | 0 |
3441| 49 | 0xc400 | 63 | 0 | 3 | 3 | 0 | faa1c03908e2dbf2 | 1 |
3442Done
3443```
3444
3445### router \<id\>
3446
3447Print diagnostic information for a Thread Router. The `id` may be a Router ID or an RLOC16.
3448
3449```bash
3450> router 50
3451Alloc: 1
3452Router ID: 50
3453Rloc: c800
3454Next Hop: c800
3455Link: 1
3456Ext Addr: e2b3540590b0fd87
3457Cost: 0
3458Link Quality In: 3
3459Link Quality Out: 3
3460Age: 3
3461Done
3462```
3463
3464```bash
3465> router 0xc800
3466Alloc: 1
3467Router ID: 50
3468Rloc: c800
3469Next Hop: c800
3470Link: 1
3471Ext Addr: e2b3540590b0fd87
3472Cost: 0
3473Link Quality In: 3
3474Link Quality Out: 3
3475Age: 7
3476Done
3477```
3478
3479### routerdowngradethreshold
3480
3481Get the ROUTER_DOWNGRADE_THRESHOLD value.
3482
3483```bash
3484> routerdowngradethreshold
348523
3486Done
3487```
3488
3489### routerdowngradethreshold \<threshold\>
3490
3491Set the ROUTER_DOWNGRADE_THRESHOLD value.
3492
3493```bash
3494> routerdowngradethreshold 23
3495Done
3496```
3497
3498### routereligible
3499
3500Indicates whether the router role is enabled or disabled.
3501
3502```bash
3503> routereligible
3504Enabled
3505Done
3506```
3507
3508### routereligible enable
3509
3510Enable the router role.
3511
3512```bash
3513> routereligible enable
3514Done
3515```
3516
3517### routereligible disable
3518
3519Disable the router role.
3520
3521```bash
3522> routereligible disable
3523Done
3524```
3525
3526### routerselectionjitter
3527
3528Get the ROUTER_SELECTION_JITTER value.
3529
3530```bash
3531> routerselectionjitter
3532120
3533Done
3534```
3535
3536### routerselectionjitter \<jitter\>
3537
3538Set the ROUTER_SELECTION_JITTER value.
3539
3540```bash
3541> routerselectionjitter 120
3542Done
3543```
3544
3545### routerupgradethreshold
3546
3547Get the ROUTER_UPGRADE_THRESHOLD value.
3548
3549```bash
3550> routerupgradethreshold
355116
3552Done
3553```
3554
3555### routerupgradethreshold \<threshold\>
3556
3557Set the ROUTER_UPGRADE_THRESHOLD value.
3558
3559```bash
3560> routerupgradethreshold 16
3561Done
3562```
3563
3564### childrouterlinks
3565
3566Get the MLE_CHILD_ROUTER_LINKS value.
3567
3568```bash
3569> childrouterlinks
357016
3571Done
3572```
3573
3574### childrouterlinks \<number_of_links\>
3575
3576Set the MLE_CHILD_ROUTER_LINKS value.
3577
3578```bash
3579> childrouterlinks 16
3580Done
3581```
3582
3583### scan \[channel\]
3584
3585Perform an IEEE 802.15.4 Active Scan.
3586
3587- channel: The channel to scan on. If no channel is provided, the active scan will cover all valid channels.
3588
3589```bash
3590> scan
3591| PAN | MAC Address | Ch | dBm | LQI |
3592+------+------------------+----+-----+-----+
3593| ffff | f1d92a82c8d8fe43 | 11 | -20 | 0 |
3594Done
3595```
3596
3597### scan energy \[duration\] \[channel\]
3598
3599Perform an IEEE 802.15.4 Energy Scan.
3600
3601- duration: The time in milliseconds to spend scanning each channel.
3602
3603```bash
3604> scan energy 10
3605| Ch | RSSI |
3606+----+------+
3607| 11 | -59 |
3608| 12 | -62 |
3609| 13 | -67 |
3610| 14 | -61 |
3611| 15 | -87 |
3612| 16 | -86 |
3613| 17 | -86 |
3614| 18 | -52 |
3615| 19 | -58 |
3616| 20 | -82 |
3617| 21 | -76 |
3618| 22 | -82 |
3619| 23 | -74 |
3620| 24 | -81 |
3621| 25 | -88 |
3622| 26 | -71 |
3623Done
3624```
3625
3626```bash
3627> scan energy 10 20
3628| Ch | RSSI |
3629+----+------+
3630| 20 | -82 |
3631Done
3632```
3633
3634### service
3635
3636Module for controlling service registration in Network Data. Each change in service registration must be sent to leader by `netdata register` command before taking effect.
3637
3638### service add \<enterpriseNumber\> \<serviceData\> [\<serverData\>]
3639
3640Add service to the Network Data.
3641
3642- enterpriseNumber: IANA enterprise number
3643- serviceData: hex-encoded binary service data
3644- serverData: hex-encoded binary server data (empty if not provided)
3645
3646```bash
3647> service add 44970 112233 aabbcc
3648Done
3649> netdata register
3650Done
3651```
3652
3653### service remove \<enterpriseNumber\> \<serviceData\>
3654
3655Remove service from Network Data.
3656
3657- enterpriseNumber: IANA enterprise number
3658- serviceData: hext-encoded binary service data
3659
3660```bash
3661> service remove 44970 112233
3662Done
3663> netdata register
3664Done
3665```
3666
3667### singleton
3668
3669Return true when there are no other nodes in the network, otherwise return false.
3670
3671```bash
3672> singleton
3673true or false
3674Done
3675```
3676
3677### sntp query \[SNTP server IP\] \[SNTP server port\]
3678
3679Send SNTP Query to obtain current unix epoch time (from 1st January 1970). The latter two parameters have following default values:
3680
3681- NTP server IP: 2001:4860:4806:8:: (Google IPv6 NTP Server)
3682- NTP server port: 123
3683
3684```bash
3685> sntp query
3686> SNTP response - Unix time: 1540894725 (era: 0)
3687```
3688
3689You can use NAT64 of OpenThread Border Router to reach e.g. Google IPv4 NTP Server:
3690
3691```bash
3692> sntp query 64:ff9b::d8ef:2308
3693> SNTP response - Unix time: 1540898611 (era: 0)
3694```
3695
3696### state
3697
3698Return state of current state.
3699
3700```bash
3701> state
3702offline, disabled, detached, child, router or leader
3703Done
3704```
3705
3706### state leader
3707
3708Become a leader and start a new partition
3709
3710If the device is not attached, this command will force the device to start as the leader of the network. This use case is only intended for testing and demo purposes, and using the API while the device is detached can make a production application non-compliant with the Thread Specification.
3711
3712If the device is already attached, this API can be used to try to take over as the leader, creating a new partition. For this to work, the local leader weight (`leaderweight`) must be larger than the weight of the current leader (from `leaderdata`). If it is not, error `NotCapable` is outputted to indicate to the caller that they need to adjust the weight.
3713
3714Taking over the leader role in this way is only allowed when triggered by an explicit user action. Using this API without such user action can make a production application non-compliant with the Thread Specification.
3715
3716```bash
3717> leaderdata
3718Partition ID: 1886755069
3719Weighting: 65
3720Data Version: 178
3721Stable Data Version: 48
3722Leader Router ID: 59
3723Done
3724
3725> leaderweight
372664
3727Done
3728
3729> state leader
3730Error 27: NotCapable
3731
3732> leaderweight 66
3733Done
3734
3735> state leader
3736Done
3737```
3738
3739### state <state>
3740
3741Try to switch to state `detached`, `child`, `router`.
3742
3743```bash
3744> state detached
3745Done
3746```
3747
3748### test tmforiginfilter \[enable|disable\]
3749
3750Enable/disable filter that drops UDP messages sent to the TMF port from untrusted origin. Also get the current state of the filter if no argument is specified.
3751
3752Note: This filter is enabled by default.
3753
3754This command is intended for testing only. `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is required for all `test` sub-commands.
3755
3756Get the current state of the filter.
3757
3758```
3759> test tmforiginfilter
3760Enabled
3761```
3762
3763Enable or disable the filter.
3764
3765```
3766> test tmforiginfilter enable
3767Done
3768>
3769> test tmforiginfilter
3770Enabled
3771>
3772> test tmforiginfilter disable
3773Done
3774>
3775> test tmforiginfilter
3776Disabled
3777>
3778```
3779
3780### thread start
3781
3782Enable Thread protocol operation and attach to a Thread network.
3783
3784```bash
3785> thread start
3786Done
3787```
3788
3789### thread stop
3790
3791Disable Thread protocol operation and detach from a Thread network.
3792
3793```bash
3794> thread stop
3795Done
3796```
3797
3798### thread version
3799
3800Get the Thread Version number.
3801
3802```bash
3803> thread version
38042
3805Done
3806```
3807
3808### timeinqueue
3809
3810Print the tx queue time-in-queue histogram.
3811
3812Requires `OPENTHREAD_CONFIG_TX_QUEUE_STATISTICS_ENABLE`.
3813
3814The time-in-queue is tracked for direct transmissions only and is measured as the duration from when a message is added to the transmit queue until it is passed to the MAC layer for transmission or dropped.
3815
3816Each table row shows min and max time-in-queue (in milliseconds) followed by number of messages with time-in-queue within the specified min-max range. The histogram information is collected since the OpenThread instance was initialized or since the last time statistics collection was reset by the `timeinqueue reset` command.
3817
3818The collected statistics can be reset by `timeinqueue reset`.
3819
3820```bash
3821> timeinqueue
3822| Min | Max |Msg Count|
3823+------+------+---------+
3824| 0 | 9 | 1537 |
3825| 10 | 19 | 156 |
3826| 20 | 29 | 57 |
3827| 30 | 39 | 108 |
3828| 40 | 49 | 60 |
3829| 50 | 59 | 76 |
3830| 60 | 69 | 88 |
3831| 70 | 79 | 51 |
3832| 80 | 89 | 86 |
3833| 90 | 99 | 45 |
3834| 100 | 109 | 43 |
3835| 110 | 119 | 44 |
3836| 120 | 129 | 38 |
3837| 130 | 139 | 44 |
3838| 140 | 149 | 35 |
3839| 150 | 159 | 41 |
3840| 160 | 169 | 34 |
3841| 170 | 179 | 13 |
3842| 180 | 189 | 24 |
3843| 190 | 199 | 3 |
3844| 200 | 209 | 0 |
3845| 210 | 219 | 0 |
3846| 220 | 229 | 2 |
3847| 230 | 239 | 0 |
3848| 240 | 249 | 0 |
3849| 250 | 259 | 0 |
3850| 260 | 269 | 0 |
3851| 270 | 279 | 0 |
3852| 280 | 289 | 0 |
3853| 290 | 299 | 1 |
3854| 300 | 309 | 0 |
3855| 310 | 319 | 0 |
3856| 320 | 329 | 0 |
3857| 330 | 339 | 0 |
3858| 340 | 349 | 0 |
3859| 350 | 359 | 0 |
3860| 360 | 369 | 0 |
3861| 370 | 379 | 0 |
3862| 380 | 389 | 0 |
3863| 390 | 399 | 0 |
3864| 400 | 409 | 0 |
3865| 410 | 419 | 0 |
3866| 420 | 429 | 0 |
3867| 430 | 439 | 0 |
3868| 440 | 449 | 0 |
3869| 450 | 459 | 0 |
3870| 460 | 469 | 0 |
3871| 470 | 479 | 0 |
3872| 480 | 489 | 0 |
3873| 490 | inf | 0 |
3874Done
3875```
3876
3877### timeinqueue max
3878
3879Print the maximum observed time-in-queue in milliseconds.
3880
3881Requires `OPENTHREAD_CONFIG_TX_QUEUE_STATISTICS_ENABLE`.
3882
3883The time-in-queue is tracked for direct transmissions only and is measured as the duration from when a message is added to the transmit queue until it is passed to the MAC layer for transmission or dropped.
3884
3885```bash
3886> timeinqueue max
3887291
3888```
3889
3890### timeinqueue reset
3891
3892Reset the TX queue time-in-queue statistics.
3893
3894```bash
3895> timeinqueue reset
3896Done
3897```
3898
3899### trel
3900
3901Indicate whether TREL radio operation is enabled or not.
3902
3903`OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE` is required for all `trel` sub-commands.
3904
3905```bash
3906> trel
3907Enabled
3908Done
3909```
3910
3911### trel enable
3912
3913Enable TREL operation.
3914
3915```bash
3916> trel enable
3917Done
3918```
3919
3920### trel disable
3921
3922Disable TREL operation.
3923
3924```bash
3925> trel disable
3926Done
3927```
3928
3929### trel filter
3930
3931Indicate whether TREL filter mode is enabled or not
3932
3933When filter mode is enabled, any rx and tx traffic through TREL interface is silently dropped. This is mainly intended for use during testing.
3934
3935```bash
3936> trel filter
3937Disabled
3938Done
3939```
3940
3941### trel filter enable
3942
3943Enable TREL filter mode.
3944
3945```bash
3946> trel filter enable
3947Done
3948```
3949
3950### trel filter disable
3951
3952Disable TREL filter mode.
3953
3954```bash
3955> trel filter disable
3956Done
3957```
3958
3959### trel peers [list]
3960
3961Get the TREL peer table in table format or as a list.
3962
3963```bash
3964> trel peers
3965| No | Ext MAC Address | Ext PAN Id | IPv6 Socket Address |
3966+-----+------------------+------------------+--------------------------------------------------+
3967| 1 | 5e5785ba3a63adb9 | f0d9c001f00d2e43 | [fe80:0:0:0:cc79:2a29:d311:1aea]:9202 |
3968| 2 | ce792a29d3111aea | dead00beef00cafe | [fe80:0:0:0:5c57:85ba:3a63:adb9]:9203 |
3969Done
3970
3971> trel peers list
3972001 ExtAddr:5e5785ba3a63adb9 ExtPanId:f0d9c001f00d2e43 SockAddr:[fe80:0:0:0:cc79:2a29:d311:1aea]:9202
3973002 ExtAddr:ce792a29d3111aea ExtPanId:dead00beef00cafe SockAddr:[fe80:0:0:0:5c57:85ba:3a63:adb9]:9203
3974Done
3975```
3976
3977### trel counters
3978
3979Get the TREL counters.
3980
3981```bash
3982> trel counters
3983Inbound: Packets 32 Bytes 4000
3984Outbound: Packets 4 Bytes 320 Failures 1
3985Done
3986```
3987
3988### trel counters reset
3989
3990Reset the TREL counters.
3991
3992```bash
3993> trel counters reset
3994Done
3995```
3996
3997### trel port
3998
3999Get the TREL UDP port number.
4000
4001```bash
4002> trel port
400349154
4004Done
4005```
4006
4007### tvcheck enable
4008
4009Enable thread version check when upgrading to router or leader.
4010
4011Note: Thread version check is enabled by default.
4012
4013`OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is required.
4014
4015```bash
4016> tvcheck enable
4017Done
4018```
4019
4020### tvcheck disable
4021
4022Disable thread version check when upgrading to router or leader.
4023
4024Note: Thread version check is enabled by default.
4025
4026`OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is required.
4027
4028```bash
4029> tvcheck disable
4030Done
4031```
4032
4033### txpower
4034
4035Get the transmit power in dBm.
4036
4037```bash
4038> txpower
4039-10 dBm
4040Done
4041```
4042
4043### txpower \<txpower\>
4044
4045Set the transmit power in dBm.
4046
4047```bash
4048> txpower -10
4049Done
4050```
4051
4052### unsecureport add \<port\>
4053
4054Add a port to the allowed unsecured port list.
4055
4056```bash
4057> unsecureport add 1234
4058Done
4059```
4060
4061### unsecureport remove \<port\>
4062
4063Remove a port from the allowed unsecured port list.
4064
4065```bash
4066> unsecureport remove 1234
4067Done
4068```
4069
4070### unsecureport remove all
4071
4072Remove all ports from the allowed unsecured port list.
4073
4074```bash
4075> unsecureport remove all
4076Done
4077```
4078
4079### unsecureport get
4080
4081Print all ports from the allowed unsecured port list.
4082
4083```bash
4084> unsecureport get
40851234
4086Done
4087```
4088
4089### uptime
4090
4091This command requires `OPENTHREAD_CONFIG_UPTIME_ENABLE` to be enabled.
4092
4093Print the OpenThread stack uptime (duration since OpenThread stack initialization).
4094
4095```bash
4096> uptime
409712:46:35.469
4098Done
4099>
4100```
4101
4102### uptime ms
4103
4104This command requires `OPENTHREAD_CONFIG_UPTIME_ENABLE` to be enabled.
4105
4106Print the OpenThread stack uptime in msec.
4107
4108```bash
4109> uptime ms
4110426238
4111Done
4112>
4113```
4114
4115### vendor name
4116
4117Get the vendor name.
4118
4119```bash
4120> vendor name
4121nest
4122Done
4123```
4124
4125Set the vendor name (requires `OPENTHREAD_CONFIG_NET_DIAG_VENDOR_INFO_SET_API_ENABLE`).
4126
4127```bash
4128> vendor name nest
4129Done
4130```
4131
4132### vendor model
4133
4134Get the vendor model.
4135
4136```bash
4137> vendor model
4138Hub Max
4139Done
4140```
4141
4142Set the vendor model (requires `OPENTHREAD_CONFIG_NET_DIAG_VENDOR_INFO_SET_API_ENABLE`).
4143
4144```bash
4145> vendor model Hub\ Max
4146Done
4147```
4148
4149### vendor swversion
4150
4151Get the vendor SW version.
4152
4153```bash
4154> vendor swversion
4155Marble3.5.1
4156Done
4157```
4158
4159Set the vendor SW version (requires `OPENTHREAD_CONFIG_NET_DIAG_VENDOR_INFO_SET_API_ENABLE`).
4160
4161```bash
4162> vendor swversion Marble3.5.1
4163Done
4164```
4165
4166### verhoeff calculate
4167
4168Calculates the Verhoeff checksum for a given decimal string.
4169
4170Requires `OPENTHREAD_CONFIG_VERHOEFF_CHECKSUM_ENABLE`.
4171
4172The input string MUST consist of characters in `['0'-'9']`.
4173
4174```bash
4175> verhoeff calculate 30731842
41761
4177Done
4178```
4179
4180### verhoeff validate
4181
4182Validates the Verhoeff checksum for a given decimal string.
4183
4184Requires `OPENTHREAD_CONFIG_VERHOEFF_CHECKSUM_ENABLE`.
4185
4186The input string MUST consist of characters in `['0'-'9']`. The last digit is treated as checksum.
4187
4188```bash
4189> verhoeff validate 307318421
4190Done
4191> verhoeff validate 307318425
4192Error 1: Failed
4193```
4194
4195### version
4196
4197Print the build version information.
4198
4199```bash
4200> version
4201OPENTHREAD/gf4f2f04; Jul 1 2016 17:00:09
4202Done
4203```
4204
4205### version api
4206
4207Print API version number.
4208
4209```bash
4210> version api
421128
4212Done
4213```
4214
4215### mac altshortaddr
4216
4217Get the alternate short address used by MAC layer. Can be `0xfffe` if not set.
4218
4219```bash
4220> mac altshortaddr
42210x4801
4222Done
4223```
4224
4225### mac retries direct
4226
4227Get the number of direct TX retries on the MAC layer.
4228
4229```bash
4230> mac retries direct
42313
4232Done
4233```
4234
4235### mac retries direct \<number\>
4236
4237Set the number of direct TX retries on the MAC layer.
4238
4239```bash
4240> mac retries direct 5
4241Done
4242```
4243
4244### mac retries indirect
4245
4246Get the number of indirect TX retries on the MAC layer.
4247
4248```bash
4249> mac retries indirect
42503
4251Done
4252```
4253
4254### mac retries indirect \<number\>
4255
4256Set the number of indirect TX retries on the MAC layer.
4257
4258```bash
4259> mac retries indirect 5
4260Done
4261```
4262
4263### mac send \<op\>
4264
4265Instruct an Rx-Off-When-Idle device to send a mac frame to its parent. The mac frame could be either a mac data request or an empty mac data frame. Use `datarequest` to send a mac data request and `data` to send an empty mac data. This feature is for certification, it can only be used when `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is enabled.
4266
4267```bash
4268> mac send datarequest
4269Done
4270```
4271
4272```bash
4273> mac send emptydata
4274Done
4275```
4276
4277### macfilter
4278
4279List the macfilter status, including address and received signal strength filter settings.
4280
4281```bash
4282> macfilter
4283Address Mode: Allowlist
42840f6127e33af6b403 : rss -95 (lqi 1)
42850f6127e33af6b402
4286RssIn List:
42870f6127e33af6b403 : rss -95 (lqi 1)
4288Default rss: -50 (lqi 3)
4289Done
4290```
4291
4292### macfilter addr
4293
4294List the address filter status.
4295
4296```bash
4297> macfilter addr
4298Allowlist
42990f6127e33af6b403 : rss -95 (lqi 1)
43000f6127e33af6b402
4301Done
4302```
4303
4304### macfilter addr disable
4305
4306Disable address filter mode.
4307
4308```bash
4309> macfilter addr disable
4310Done
4311```
4312
4313### macfilter addr allowlist
4314
4315Enable allowlist address filter mode.
4316
4317```bash
4318> macfilter addr allowlist
4319Done
4320```
4321
4322### macfilter addr denylist
4323
4324Enable denylist address filter mode.
4325
4326```bash
4327> macfilter addr denylist
4328Done
4329```
4330
4331### macfilter addr add \<extaddr\> \[rss\]
4332
4333Add an IEEE 802.15.4 Extended Address to the address filter, and fixed the received signal strength for the messages from the address if rss is specified.
4334
4335```bash
4336> macfilter addr add 0f6127e33af6b403 -95
4337Done
4338```
4339
4340```bash
4341> macfilter addr add 0f6127e33af6b402
4342Done
4343```
4344
4345### macfilter addr remove \<extaddr\>
4346
4347Remove the IEEE802.15.4 Extended Address from the address filter.
4348
4349```bash
4350> macfilter addr remove 0f6127e33af6b402
4351Done
4352```
4353
4354### macfilter addr clear
4355
4356Clear all the IEEE802.15.4 Extended Addresses from the address filter.
4357
4358```bash
4359> macfilter addr clear
4360Done
4361```
4362
4363### macfilter rss
4364
4365List the rss filter status
4366
4367```bash
4368> macfilter rss
43690f6127e33af6b403 : rss -95 (lqi 1)
4370Default rss: -50 (lqi 3)
4371Done
4372```
4373
4374### macfilter rss add \<extaddr\> \<rss\>
4375
4376Set the received signal strength for the messages from the IEEE802.15.4 Extended Address. If extaddr is \*, default received signal strength for all received messages would be set.
4377
4378```bash
4379> macfilter rss add * -50
4380Done
4381```
4382
4383```bash
4384> macfilter rss add 0f6127e33af6b404 -85
4385Done
4386```
4387
4388### macfilter rss add-lqi \<extaddr\> \<lqi\>
4389
4390Set the received link quality for the messages from the IEEE802.15.4 Extended Address. Valid lqi range [0,3] If extaddr is \*, default received link quality for all received messages would be set. Equivalent with 'filter rss add' with similar usage
4391
4392```bash
4393> macfilter rss add-lqi * 3
4394Done
4395```
4396
4397```bash
4398> macfilter rss add-lqi 0f6127e33af6b404 2
4399Done
4400```
4401
4402### macfilter rss remove \<extaddr\>
4403
4404Removes the received signal strength or received link quality setting on the Extended Address. If extaddr is \*, default received signal strength or link quality for all received messages would be unset.
4405
4406```bash
4407> macfilter rss remove *
4408Done
4409```
4410
4411```bash
4412> macfilter rss remove 0f6127e33af6b404
4413Done
4414```
4415
4416### macfilter rss clear
4417
4418Clear all the received signal strength or received link quality settings.
4419
4420```bash
4421> macfilter rss clear
4422Done
4423```
4424
4425### diag
4426
4427Factory Diagnostics module is enabled only when building OpenThread with `OPENTHREAD_CONFIG_DIAG_ENABLE=1` option. Go [diagnostics module][diag] for more information.
4428
4429[diag]: ../../src/core/diags/README.md
4430
4431### wakeup channel
4432
4433Get the wake-up channel.
4434
4435Requires `OPENTHREAD_CONFIG_WAKEUP_COORDINATOR_ENABLE` or `OPENTHREAD_CONFIG_WAKEUP_END_DEVICE_ENABLE`.
4436
4437```bash
4438> wakeup channel
443912
4440Done
4441```
4442
4443### wakeup channel \<channel\>
4444
4445Set the wake-up channel.
4446
4447Requires `OPENTHREAD_CONFIG_WAKEUP_COORDINATOR_ENABLE` or `OPENTHREAD_CONFIG_WAKEUP_END_DEVICE_ENABLE`.
4448
4449```bash
4450> wakeup channel 12
4451Done
4452```
4453
4454### wakeup parameters
4455
4456Get the wake-up listen interval and duration.
4457
4458Requires `OPENTHREAD_CONFIG_WAKEUP_END_DEVICE_ENABLE`.
4459
4460```bash
4461> wakeup parameters
4462interval: 1000000us
4463duration: 8000us
4464Done
4465```
4466
4467### wakeup parameters \<interval\> \<duration\>
4468
4469Set the wake-up listen interval and duration.
4470
4471Requires `OPENTHREAD_CONFIG_WAKEUP_END_DEVICE_ENABLE`.
4472
4473```bash
4474> wakeup parameters 1000000 8000
4475Done
4476```
4477
4478### wakeup listen
4479
4480Show the state of wake-up listening feature.
4481
4482`OPENTHREAD_CONFIG_WAKEUP_END_DEVICE_ENABLE` is required.
4483
4484```bash
4485> wakeup listen
4486Enabled
4487Done
4488```
4489
4490### wakeup listen \[enable|disable\]
4491
4492Enable/disable listening for wake-up frames.
4493
4494`OPENTHREAD_CONFIG_WAKEUP_END_DEVICE_ENABLE` is required.
4495
4496```bash
4497> wakeup listen enable
4498Done
4499```
4500
4501### wakeup wake \<extaddr\> \<wakeup-interval\> \<wakeup-duration\>
4502
4503Wakes a Wake-up End Device.
4504
4505`OPENTHREAD_CONFIG_WAKEUP_COORDINATOR_ENABLE` is required.
4506
4507```bash
4508> wakeup wake 1ece0a6c4653a7c1 7500 1090
4509Done
4510```
4511
README_BR.md
1# OpenThread CLI - Border Router (BR)
2
3## Command List
4
5Usage : `br [command] ...`
6
7- [counters](#counters)
8- [disable](#disable)
9- [enable](#enable)
10- [help](#help)
11- [init](#init)
12- [nat64prefix](#nat64prefix)
13- [omrprefix](#omrprefix)
14- [onlinkprefix](#onlinkprefix)
15- [pd](#pd)
16- [peers](#peers)
17- [prefixtable](#prefixtable)
18- [rioprf](#rioprf)
19- [routeprf](#routeprf)
20- [routers](#routers)
21- [state](#state)
22
23## Command Details
24
25### help
26
27Usage: `br help`
28
29Print BR command help menu.
30
31```bash
32> br help
33counters
34disable
35enable
36omrprefix
37onlinkprefix
38pd
39peers
40prefixtable
41raoptions
42rioprf
43routeprf
44routers
45state
46Done
47```
48
49### init
50
51Usage: `br init <interface> <enabled>`
52
53Initializes the Border Routing Manager on given infrastructure interface.
54
55```bash
56> br init 2 1
57Done
58```
59
60### enable
61
62Usage: `br enable`
63
64Enable the Border Routing functionality.
65
66```bash
67> br enable
68Done
69```
70
71### disable
72
73Usage: `br disable`
74
75Disable the Border Routing functionality.
76
77```bash
78> br disable
79Done
80```
81
82### state
83
84Usage: `br state`
85
86Get the Border Routing state:
87
88- `uninitialized`: Routing Manager is uninitialized.
89- `disabled`: Routing Manager is initialized but disabled.
90- `stopped`: Routing Manager in initialized and enabled but currently stopped.
91- `running`: Routing Manager is initialized, enabled, and running.
92
93```bash
94> br state
95running
96```
97
98### counters
99
100Usage : `br counters`
101
102Get the Border Router counter.
103
104```bash
105> br counters
106Inbound Unicast: Packets 4 Bytes 320
107Inbound Multicast: Packets 0 Bytes 0
108Outbound Unicast: Packets 2 Bytes 160
109Outbound Multicast: Packets 0 Bytes 0
110RA Rx: 4
111RA TxSuccess: 2
112RA TxFailed: 0
113RS Rx: 0
114RS TxSuccess: 2
115RS TxFailed: 0
116Done
117```
118
119### omrprefix
120
121Usage: `br omrprefix [local|favored]`
122
123Get local or favored or both off-mesh-routable prefixes of the Border Router.
124
125```bash
126> br omrprefix
127Local: fdfc:1ff5:1512:5622::/64
128Favored: fdfc:1ff5:1512:5622::/64 prf:low
129Done
130
131> br omrprefix favored
132fdfc:1ff5:1512:5622::/64 prf:low
133Done
134
135> br omrprefix local
136fdfc:1ff5:1512:5622::/64
137Done
138```
139
140### onlinkprefix
141
142Usage: `br onlinkprefix [local|favored]`
143
144Get local or favored or both on-link prefixes of the Border Router.
145
146```bash
147> br onlinkprefix
148Local: fd41:2650:a6f5:0::/64
149Favored: 2600::0:1234:da12::/64
150Done
151
152> br onlinkprefix favored
1532600::0:1234:da12::/64
154Done
155
156> br onlinkprefix local
157fd41:2650:a6f5:0::/64
158Done
159```
160
161### nat64prefix
162
163Usage: `br nat64prefix [local|favored]`
164
165Get local or favored or both NAT64 prefixes of the Border Router.
166
167`OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE` is required.
168
169```bash
170> br nat64prefix
171Local: fd14:1078:b3d5:b0b0:0:0::/96
172Favored: fd14:1078:b3d5:b0b0:0:0::/96 prf:low
173Done
174
175> br nat64prefix favored
176fd14:1078:b3d5:b0b0:0:0::/96 prf:low
177Done
178
179> br nat64prefix
180fd14:1078:b3d5:b0b0:0:0::/96
181Done
182```
183
184### pd
185
186Usage: `br pd [enable|disable]`
187
188Enable/Disable the DHCPv6 PD.
189
190```bash
191> br pd enable
192Done
193
194> br pd disable
195Done
196```
197
198Usage: `br pd state`
199
200Get the state of DHCPv6 PD.
201
202`OPENTHREAD_CONFIG_BORDER_ROUTING_DHCP6_PD_ENABLE` is required.
203
204- `disabled`: DHCPv6 PD is disabled on the border router.
205- `stopped`: DHCPv6 PD in enabled but won't try to request and publish a prefix.
206- `running`: DHCPv6 PD is enabled and will try to request and publish a prefix.
207
208```bash
209> br pd state
210running
211Done
212```
213
214Usage `br pd omrprefix`
215
216Get the DHCPv6 Prefix Delegation (PD) provided off-mesh-routable (OMR) prefix.
217
218`OPENTHREAD_CONFIG_BORDER_ROUTING_DHCP6_PD_ENABLE` is required.
219
220```bash
221> br pd omrprefix
2222001:db8:cafe:0:0/64 lifetime:1800 preferred:1800
223Done
224```
225
226### peers
227
228Usage: `br peers`
229
230Get the list of peer BRs found in the Network Data.
231
232`OPENTHREAD_CONFIG_BORDER_ROUTING_TRACK_PEER_BR_INFO_ENABLE` is required.
233
234Peer BRs are other devices within the Thread mesh that provide external IP connectivity. A device is considered to provide external IP connectivity if at least one of the following conditions is met regarding its Network Data entries:
235
236- It has added at least one external route entry.
237- It has added at least one prefix entry with both the default-route and on-mesh flags set.
238- It has added at least one domain prefix (with both the domain and on-mesh flags set).
239
240The list of peer BRs specifically excludes the current device, even if it is itself acting as a BR.
241
242Info per BR entry:
243
244- RLOC16 of the BR
245- Age as the duration interval since this BR appeared in Network Data. It is formatted as `{hh}:{mm}:{ss}` for hours, minutes, seconds, if the duration is less than 24 hours. If the duration is 24 hours or more, the format is `{dd}d.{hh}:{mm}:{ss}` for days, hours, minutes, seconds.
246
247```bash
248> br peers
249rloc16:0x5c00 age:00:00:49
250rloc16:0xf800 age:00:01:51
251Done
252```
253
254Usage: `br peers count`
255
256Gets the number of peer BRs found in the Network Data.
257
258The count does not include the current device, even if it is itself acting as a BR.
259
260The output indicates the minimum age among all peer BRs. Age is formatted as `{hh}:{mm}:{ss}` for hours, minutes, seconds, if the duration is less than 24 hours. If the duration is 24 hours or more, the format is `{dd}d.{hh}:{mm}:{ss}` for days, hours, minutes, seconds.
261
262```bash
263> br peer count
2642 min-age:00:00:49
265Done
266```
267
268### prefixtable
269
270Usage: `br prefixtable`
271
272Get the discovered prefixes by Border Routing Manager on the infrastructure link.
273
274Info per prefix entry:
275
276- The prefix
277- Whether the prefix is on-link or route
278- Milliseconds since last received Router Advertisement containing this prefix
279- Prefix lifetime in seconds
280- Preferred lifetime in seconds only if prefix is on-link
281- Route preference (low, med, high) only if prefix is route (not on-link)
282- The router IPv6 address which advertising this prefix
283- Flags in received Router Advertisement header:
284 - M: Managed Address Config flag
285 - O: Other Config flag
286 - S: SNAC Router flag
287
288```bash
289> br prefixtable
290prefix:fd00:1234:5678:0::/64, on-link:no, ms-since-rx:29526, lifetime:1800, route-prf:med, router:ff02:0:0:0:0:0:0:1 (M:0 O:0 S:1)
291prefix:1200:abba:baba:0::/64, on-link:yes, ms-since-rx:29527, lifetime:1800, preferred:1800, router:ff02:0:0:0:0:0:0:1 (M:0 O:0 S:1)
292Done
293```
294
295### raoptions
296
297Usage: `br raoptions <options>`
298
299Sets additional options to append at the end of emitted Router Advertisement (RA) messages. `<options>` provided as hex bytes.
300
301```bash
302> br raoptions 0400ff00020001
303Done
304```
305
306### raoptions clear
307
308Usage: `br raoptions clear`
309
310Clear any previously set additional options to append at the end of emitted Router Advertisement (RA) messages.
311
312```bash
313> br raoptions clear
314Done
315```
316
317### rioprf
318
319Usage: `br rioprf`
320
321Get the preference used when advertising Route Info Options (e.g., for discovered OMR prefixes) in emitted Router Advertisement message.
322
323```bash
324> br rioprf
325med
326Done
327```
328
329### rioprf \<prf\>
330
331Usage: `br rioprf high|med|low`
332
333Set the preference (which may be 'high', 'med', or 'low') to use when advertising Route Info Options (e.g., for discovered OMR prefixes) in emitted Router Advertisement message.
334
335```bash
336> br rioprf low
337Done
338```
339
340### rioprf clear
341
342Usage: `br rioprf clear`
343
344Clear a previously set preference value for advertising Route Info Options (e.g., for discovered OMR prefixes) in emitted Router Advertisement message. When cleared BR will use device's role to determine the RIO preference: Medium preference when in router/leader role and low preference when in child role.
345
346```bash
347> br rioprf clear
348Done
349```
350
351### routeprf
352
353Usage: `br routeprf`
354
355Get the preference used for publishing routes in Thread Network Data. This may be the automatically determined route preference, or an administratively set fixed route preference - if applicable.
356
357```bash
358> br routeprf
359med
360Done
361```
362
363### routeprf \<prf\>
364
365Usage: `br routeprf high|med|low`
366
367Set the preference (which may be 'high', 'med', or 'low') to use publishing routes in Thread Network Data. Setting a preference value overrides the automatic route preference determination. It is used only for an explicit administrative configuration of a Border Router.
368
369```bash
370> br routeprf low
371Done
372```
373
374### routeprf clear
375
376Usage: `br routeprf clear`
377
378Clear a previously set preference value for publishing routes in Thread Network Data. When cleared BR will automatically determine the route preference based on device's role and link quality to parent (when acting as end-device).
379
380```bash
381> br routeprf clear
382Done
383```
384
385### routers
386
387Usage: `br routers`
388
389Get the list of discovered routers by Border Routing Manager on the infrastructure link.
390
391Info per router:
392
393- The router IPv6 address
394- Flags in received Router Advertisement header:
395 - M: Managed Address Config flag
396 - O: Other Config flag
397 - S: SNAC Router flag (indicates whether the router is a stub router)
398- Milliseconds since last received message from this router
399- Reachability flag: A router is marked as unreachable if it fails to respond to multiple Neighbor Solicitation probes.
400- Age: Duration interval since this router was first discovered. It is formatted as `{hh}:{mm}:{ss}` for hours, minutes, seconds, if the duration is less than 24 hours. If the duration is 24 hours or more, the format is `{dd}d.{hh}:{mm}:{ss}` for days, hours, minutes, seconds.
401- `(this BR)` is appended when the router is the local device itself.
402- `(peer BR)` is appended when the router is likely a peer BR connected to the same Thread mesh. This requires `OPENTHREAD_CONFIG_BORDER_ROUTING_TRACK_PEER_BR_INFO_ENABLE`.
403
404```bash
405> br routers
406ff02:0:0:0:0:0:0:1 (M:0 O:0 S:1) ms-since-rx:1505 reachable:yes age:00:18:13
407Done
408```
409
README_COAP.md
1# OpenThread CLI - CoAP Example
2
3The OpenThread CoAP APIs may be invoked via the OpenThread CLI.
4
5## Quick Start
6
7### Form Network
8
9Form a network with at least two devices.
10
11### Node 1
12
13On node 1, setup CoAP server with resource `test-resource`.
14
15```bash
16> coap start
17Done
18> coap resource test-resource
19Done
20```
21
22### Node 2
23
24```bash
25> coap start
26Done
27> coap get fdde:ad00:beef:0:d395:daee:a75:3964 test-resource
28Done
29coap response from [fdde:ad00:beef:0:2780:9423:166c:1aac] with payload: 30
30> coap put fdde:ad00:beef:0:2780:9423:166c:1aac test-resource con payload
31Done
32coap response from [fdde:ad00:beef:0:2780:9423:166c:1aac]
33```
34
35### Result
36
37On node 1, you should see output similar to below:
38
39```bash
40coap request from [fdde:ad00:beef:0:b3:e3f6:2dcc:4b79] GET
41coap response sent
42coap request from [fdde:ad00:beef:0:b3:e3f6:2dcc:4b79] PUT with payload: 7061796c6f6164
43coap response sent
44```
45
46## Command List
47
48- [help](#help)
49- [cancel](#cancel)
50- [delete](#delete-address-uri-path-type-payload)
51- [get](#get-address-uri-path-type)
52- [observe](#observe-address-uri-path-type)
53- [parameters](#parameters)
54- [post](#post-address-uri-path-type-payload)
55- [put](#put-address-uri-path-type-payload)
56- [resource](#resource-uri-path)
57- [set](#set-new-content)
58- [start](#start)
59- [stop](#stop)
60
61## Command Details
62
63### help
64
65```bash
66> coap help
67help
68cancel
69delete
70get
71observe
72parameters
73post
74put
75resource
76set
77start
78stop
79Done
80```
81
82List the CoAP CLI commands.
83
84### cancel
85
86Request the cancellation of an existing observation subscription to a remote resource.
87
88```bash
89> coap cancel
90Done
91```
92
93### delete \<address\> \<uri-path\> \[type\] \[payload\]
94
95- address: IPv6 address of the CoAP server.
96- uri-path: URI path of the resource.
97- type: "con" for Confirmable or "non-con" for Non-confirmable (default).
98- payload: CoAP request payload.
99
100```bash
101> coap delete fdde:ad00:beef:0:2780:9423:166c:1aac test-resource con payload
102Done
103```
104
105### get \<address\> \<uri-path\> \[type\]
106
107- address: IPv6 address of the CoAP server.
108- uri-path: URI path of the resource.
109- type: "con" for Confirmable or "non-con" for Non-confirmable (default). Use "block-<block-size>" if the response should be transferred block-wise. ("block-16","block-32","block-64","block-128","block-256","block-512","block-1024")
110
111```bash
112> coap get fdde:ad00:beef:0:2780:9423:166c:1aac test-resource
113Done
114```
115
116```bash
117> coap get fdde:ad00:beef:0:2780:9423:166c:1aac test-resource block-1024
118Done
119```
120
121### observe \<address\> \<uri-path\> \[type\]
122
123This is the same a `get`, but the `Observe` parameter will be sent, set to 0 triggering a subscription request.
124
125- address: IPv6 address of the CoAP server.
126- uri-path: URI path of the resource.
127- type: "con" for Confirmable or "non-con" for Non-confirmable (default).
128
129```bash
130> coap observe fdde:ad00:beef:0:2780:9423:166c:1aac test-resource
131Done
132```
133
134### parameters \<type\> \["default"|<ack_timeout\> <ack_random_factor_numerator\> <ack_random_factor_denominator\> <max_retransmit\>\]
135
136Sets transmission parameters for the following interactions.
137
138- type: "request" for CoAP requests and "response" for CoAP responses.
139
140If no more parameters are given, the command prints the current configuration:
141
142```bash
143> coap parameters request
144Transmission parameters for request:
145ACK_TIMEOUT=1000 ms, ACK_RANDOM_FACTOR=255/254, MAX_RETRANSMIT=2
146Done
147```
148
149If `"default"` is given, the command sets the default configuration for the transmission parameters.
150
151```bash
152> coap parameters request default
153Transmission parameters for request:
154default
155Done
156```
157
158Also, you can specify the transmission parameters in the command line:
159
160- ack_timeout (0~UINT32_MAX): RFC7252 ACK_TIMEOUT, in milliseconds.
161- ack_random_factor_numerator, ack_random_factor_denominator (0~255): RFC7252 ACK_RANDOM_FACTOR=ack_random_factor_numerator/ack_random_factor_denominator.
162- max_retransmit (0~255): RFC7252 MAX_RETRANSMIT.
163
164```bash
165> coap parameters request 1000 255 254 2
166Transmission parameters for request:
167ACK_TIMEOUT=1000 ms, ACK_RANDOM_FACTOR=255/254, MAX_RETRANSMIT=2
168Done
169```
170
171### post \<address\> \<uri-path\> \[type\] \[payload\]
172
173- address: IPv6 address of the CoAP server.
174- uri-path: URI path of the resource.
175- type: "con" for Confirmable or "non-con" for Non-confirmable (default). Use "block-<block-size>" to send blocks with random payload. ("block-16","block-32","block-64","block-128","block-256","block-512","block-1024")
176- payload: CoAP request payload. If \[type\] is "block-<block-size>", the amount of blocks to be sent can be set here.
177
178```bash
179> coap post fdde:ad00:beef:0:2780:9423:166c:1aac test-resource con payload
180Done
181```
182
183```bash
184> coap post fdde:ad00:beef:0:2780:9423:166c:1aac test-resource block-1024 10
185Done
186```
187
188### put \<address\> \<uri-path\> \[type\] \[payload\]
189
190- address: IPv6 address of the CoAP server.
191- uri-path: URI path of the resource.
192- type: "con" for Confirmable or "non-con" for Non-confirmable (default). Use "block-<block-size>" to send blocks with random payload. ("block-16","block-32","block-64","block-128","block-256","block-512","block-1024")
193- payload: CoAP request payload. If \[type\] is "block-<block-size>", the amount of blocks to be sent can be set here.
194
195```bash
196> coap put fdde:ad00:beef:0:2780:9423:166c:1aac test-resource con payload
197Done
198```
199
200```bash
201> coap put fdde:ad00:beef:0:2780:9423:166c:1aac test-resource block-1024 10
202Done
203```
204
205### resource \[uri-path\]
206
207Sets the URI path for the test resource.
208
209```bash
210> coap resource test-resource
211Done
212> coap resource
213test-resource
214Done
215```
216
217### set \[new-content\]
218
219Sets the content sent by the test resource. If a CoAP client is observing the resource, a notification is sent to that client.
220
221```bash
222> coap set Testing123
223Done
224```
225
226### start
227
228Starts the application coap service.
229
230```bash
231> coap start
232Done
233```
234
235### stop
236
237Stops the application coap service.
238
239```bash
240> coap stop
241Done
242```
243
README_COAPS.md
1# OpenThread CLI - CoAPS Example
2
3The OpenThread CoAPS APIs may be invoked via the OpenThread CLI.
4
5## Quick Start
6
7### Form Network
8
9Form a network with at least two devices.
10
11### Configure DTLS ciphersuite.
12
13CoAPS uses DTLS to establish a secure, end-to-end connection.
14
15This example supports two ciphersuites:
16
17- TLS_PSK_WITH_AES_128_CCM_8
18
19 ```bash
20 > coaps psk <your-psk> <your-psk-id>
21 Done
22 ```
23
24- TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8
25 ```bash
26 > coaps x509
27 Done
28 ```
29 The X.509 certificate stored in `core/cli/x509_cert_key.hpp`.
30
31### Node 1
32
33On node 1, setup CoAPS server with resource `test-resource`.
34
35```bash
36> coaps start
37Done
38> coaps resource test-resource
39Done
40```
41
42### Node 2
43
44```bash
45> coaps start
46Done
47> coaps connect <peer-ip6-address>
48Done
49coaps connected
50> coaps get test-resource
51Done
52coaps response from fdde:ad00:beef:0:9903:14b:27e0:5744 with payload: 68656c6c6f576f726c6400
53> coaps put test-resource con payload
54Done
55coaps response from fdde:ad00:beef:0:9903:14b:27e0:5744
56```
57
58### Result
59
60On node 1, you should see output similar to below:
61
62```bash
63coaps request from fdde:ad00:beef:0:9e68:576f:714c:f395 GET
64coaps response sent
65coaps request from fdde:ad00:beef:0:9e68:576f:714c:f395 PUT with payload: 7061796c6f6164
66coaps response sent
67```
68
69## Generate Elliptic Curve Private Key and X.509 Certificate
70
71### EC Private Key
72
73```bash
74> openssl ecparam -genkey -name prime256v1 -noout -out ec_private.pem
75```
76
77### X.509 Certificate
78
79```bash
80> openssl req -x509 -new -key ec_private.pem -out x509_cert.pem -days 30
81```
82
83## Command List
84
85- [help](#help)
86- [connect](#connect-address)
87- [delete](#delete-uri-path-type-payload)
88- [disconnect](#disconnect)
89- [get](#get-uri-path-type)
90- [isclosed](#isclosed)
91- [isconnactive](#isconnactive)
92- [isconnected](#isconnected)
93- [post](#post-uri-path-type-payload)
94- [psk](#psk-psk-pskid)
95- [put](#put-uri-path-type-payload)
96- [resource](#resource-uri-path)
97- [set](#set-new-content)
98- [start](#start)
99- [stop](#stop)
100- [x509](#x509)
101
102## Command Details
103
104### help
105
106```bash
107> coaps help
108connect
109delete
110disconnect
111get
112isclosed
113isconnactive
114isconnected
115post
116psk
117put
118resource
119set
120start
121stop
122x509
123Done
124```
125
126List the CoAPS CLI commands.
127
128### connect \<address\>
129
130Establish DTLS session.
131
132- address: IPv6 address of the peer.
133
134```bash
135> coaps connect fdde:ad00:beef:0:9903:14b:27e0:5744
136Done
137coaps connected
138```
139
140### delete \<uri-path\> \[type\] \[payload\]
141
142- uri-path: URI path of the resource.
143- type: "con" for Confirmable or "non-con" for Non-confirmable (default).
144- payload: CoAPS request payload.
145
146```bash
147> coaps delete test-resource con payload
148Done
149```
150
151### disconnect
152
153```bash
154> coaps disconnect
155coaps disconnected
156Done
157```
158
159### get \<uri-path\> \[type\]
160
161- uri-path: URI path of the resource.
162- type: "con" for Confirmable or "non-con" for Non-confirmable (default). Use "block-<block-size>" if the response should be transferred block-wise. ("block-16","block-32","block-64","block-128","block-256","block-512","block-1024")
163
164```bash
165> coaps get test-resource
166Done
167```
168
169```bash
170> coaps get test-resource block-1024
171Done
172```
173
174### post \<uri-path\> \[type\] \[payload\]
175
176- uri-path: URI path of the resource.
177- type: "con" for Confirmable or "non-con" for Non-confirmable (default). Use "block-<block-size>" to send blocks with random payload. ("block-16","block-32","block-64","block-128","block-256","block-512","block-1024")
178- payload: CoAP request payload. If \[type\] is "block-<block-size>", the amount of blocks to be sent can be set here.
179
180```bash
181> coaps post test-resource con payload
182Done
183```
184
185```bash
186> coaps post test-resource block-1024 10
187Done
188```
189
190### psk \<psk\> \<pskid\>
191
192Set DTLS ciphersuite to `TLS_PSK_WITH_AES_128_CCM_8`.
193
194- psk: pre-shared key
195- pskid: pre-shared key identifier
196
197```bash
198> coaps psk 123 pskid
199Done
200```
201
202### put \<uri-path\> \[type\] \[payload\]
203
204- uri-path: URI path of the resource.
205- type: "con" for Confirmable or "non-con" for Non-confirmable (default). Use "block-<block-size>" to send blocks with random payload. ("block-16","block-32","block-64","block-128","block-256","block-512","block-1024")
206- payload: CoAP request payload. If \[type\] is "block-<block-size>", the amount of blocks to be sent can be set here.
207
208```bash
209> coaps put test-resource con payload
210Done
211```
212
213```bash
214> coaps put test-resource block-1024 10
215Done
216```
217
218### resource \[uri-path\]
219
220Sets the URI path for the test resource.
221
222```bash
223> coaps resource test-resource
224Done
225> coaps resource
226test-resource
227Done
228```
229
230### set \[new-content\]
231
232Sets the content sent by the test resource.
233
234```bash
235> coaps set Testing123
236Done
237```
238
239### start \[check-peer-cert\|max-conn-attempts\]
240
241Starts the application coaps service.
242
243The `check-peer-cert` parameter determines if the peer-certificate check is enabled (default) or disabled. The `max-conn-attempts` parameter sets the maximum number of allowed attempts, successful or failed, to connect to the CoAP Secure server. The default value of this parameter is 0, which means that there is no limit to the number of attempts. The `check-peer-cert` and `max-conn-attempts` parameters work together in the following combinations, even though you can only specify one argument:
244
245- No argument specified: Defaults are used.
246- Setting `check-peer-cert` to `true`: Has the same effect as as omitting the argument, which is that the `check-peer-cert` value is `true`, and the `max-conn-attempts` value is 0.
247- Setting `check-peer-cert` to `false`: `check-peer-cert` value is `false`, and the `max-conn-attempts` value is `0`.
248- Specifying a number: `check-peer-cert` is `true`, and the `max-conn-attempts` value is the number specified in the argument.
249
250```bash
251> coaps start
252Done
253```
254
255### stop
256
257Stops the application coaps service.
258
259```bash
260> coaps stop
261Done
262```
263
264### isconnected
265
266Indicates whether or not the CoAP secure service is connected.
267
268```bash
269> coaps isconnected
270yes
271Done
272```
273
274### isconnactive
275
276Indicates whether or not the CoAP secure service connection is active (already connected or establishing a connection).
277
278```bash
279> coaps isconnactive
280yes
281Done
282```
283
284### isclosed
285
286Indicates whether or not the CoAP secure service is closed.
287
288```bash
289> coaps isclosed
290no
291Done
292```
293
294### x509
295
296Set DTLS ciphersuite to `TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8`.
297
298The X.509 certificate stored in [`src/cli/x509_cert_key.hpp`](x509_cert_key.hpp).
299
300```bash
301> coaps x509
302Done
303```
304
README_COMMISSIONER.md
1# OpenThread CLI - Commissioner
2
3## Overview
4
5The Commissioner is an entity that can add new Thread devices securely to a Thread network. It also can manage a Thread network by changing network configuration parameters ([Operational Datasets](README_DATASET.md)) or sending specific management/diagnostic commands to selected Thread devices. Before a Commissioner can do its tasks, it has to petition to the Leader to get permission to become the Commissioner.
6
7## Quick Start
8
9See [README_COMMISSIONING.md](README_COMMISSIONING.md).
10
11## Command List
12
13- [help](#help)
14- [announce](#announce)
15- [energy](#energy)
16- [joiner add](#joiner-add)
17- [joiner remove](#joiner-remove)
18- [joiner table](#joiner-table)
19- [mgmtget](#mgmtget)
20- [mgmtset](#mgmtset)
21- [panid](#panid)
22- [provisioningurl](#provisioningurl)
23- [sessionid](#sessionid)
24- [start](#start)
25- [state](#state)
26- [stop](#stop)
27
28## Command Details
29
30### help
31
32Usage: `commissioner help`
33
34Print commissioner help menu.
35
36```bash
37> commissioner help
38help
39announce
40energy
41joiner
42mgmtget
43mgmtset
44panid
45provisioningurl
46sessionid
47start
48stop
49Done
50```
51
52### announce
53
54Usage: `commissioner announce <mask> <count> <period> <destination>`
55
56Send a `MGMT_ANNOUNCE_BEGIN` message.
57
58- mask: Bitmask identifying channels to send MLE Announce messages.
59- count: Number of MLE Announce transmissions per channel.
60- period: Period between successive MLE Announce transmissions (milliseconds).
61- destination: IPv6 destination for the message (may be multicast).
62
63```bash
64> commissioner announce 0x00050000 2 32 fdde:ad00:beef:0:0:ff:fe00:c00
65Done
66```
67
68### energy
69
70Usage: `commissioner energy <mask> <count> <period> <scanDuration> <destination>`
71
72Send a `MGMT_ED_SCAN` message.
73
74- mask: Bitmask identifying channels to perform IEEE 802.15.4 ED Scans.
75- count: Number of IEEE 802.15.4 ED Scans per channel.
76- period: Period between successive IEEE 802.15.4 ED Scans (milliseconds).
77- scanDuration: IEEE 802.15.4 ScanDuration to use when performing an IEEE 802.15.4 ED Scan (milliseconds).
78- destination: IPv6 destination for the message (may be multicast).
79
80The contents of `MGMT_ED_REPORT` messages (i.e. Channel Mask and Energy List) are printed as they are received.
81
82```bash
83> commissioner energy 0x00050000 2 32 1000 fdde:ad00:beef:0:0:ff:fe00:c00
84Done
85Energy: 00050000 0 0 0 0
86```
87
88### joiner add
89
90Usage: `commissioner joiner add <eui64>|<discerner> <pskd> [timeout]`
91
92Add a Joiner entry.
93
94- eui64: The IEEE EUI-64 of the Joiner or '\*' to match any Joiner.
95- discerner: The Joiner discerner in format `number/length`.
96- pskd: Pre-Shared Key for the Joiner.
97- timeout: joiner timeout in seconds.
98
99```bash
100> commissioner joiner add d45e64fa83f81cf7 J01NME
101Done
102```
103
104```bash
105> commissioner joiner add 0xabc/12 J01NME
106Done
107```
108
109### joiner remove
110
111Usage: `commissioner joiner remove <eui64>|<discerner>`
112
113Remove a Joiner entry.
114
115- eui64: The IEEE EUI-64 of the Joiner or '\*' to match any Joiner.
116- discerner: The Joiner discerner in format `number/length`.
117
118```bash
119> commissioner joiner remove d45e64fa83f81cf7
120Done
121```
122
123```bash
124> commissioner joiner remove 0xabc/12
125Done
126```
127
128### joiner table
129
130Usage: `commissioner joiner table`
131
132List all Joiner entries.
133
134```bash
135> commissioner joiner table
136| ID | PSKd | Expiration |
137+-----------------------+----------------------------------+------------+
138| * | J01NME | 81015 |
139| d45e64fa83f81cf7 | J01NME | 101204 |
140| 0x0000000000000abc/12 | J01NME | 114360 |
141Done
142```
143
144### mgmtget
145
146Usage: `commissioner mgmtget [locator] [sessionid] [steeringdata] [joinerudpport] [-x <TLV Types>]`
147
148Send a `MGMT_GET` message to the Leader.
149
150```bash
151> commissioner mgmtget locator sessionid
152Done
153```
154
155### mgmtset
156
157Usage: `commissioner mgmtset [locator <locator>] [sessionid <sessionid>] [steeringdata <steeringdata>] [joinerudpport <joinerudpport>] [-x <TLVs>]`
158
159Send a `MGMT_SET` message to the Leader.
160
161```bash
162> commissioner mgmtset joinerudpport 9988
163Done
164```
165
166### panid
167
168Usage: `commissioner panid <panid> <mask> <destination>`
169
170Send a `MGMT_PANID_QUERY` message.
171
172- panid: PAN ID to check for conflicts.
173- mask: Bitmask identifying channels to perform IEEE 802.15.4 Active Scans.
174- destination: IPv6 destination for the message (may be multicast).
175
176The contents of `MGMT_PANID_CONFLICT` messages (i.e. PAN ID and Channel Mask) are printed as they are received.
177
178```bash
179> commissioner panid 0xdead 0x7fff800 fdde:ad00:beef:0:0:ff:fe00:c00
180Done
181Conflict: dead, 00000800
182```
183
184### provisioningurl
185
186Usage: `commissioner provisioningurl <provisioningurl>`
187
188Set the Provisioning URL.
189
190```bash
191> commissioner provisioningurl http://github.com/openthread/openthread
192Done
193```
194
195### sessionid
196
197Usage: `commissioner sessionid`
198
199Get current commissioner session id.
200
201```bash
202> commissioner sessionid
2030
204Done
205```
206
207### id
208
209Usage: `commissioner id`
210
211Get the commissioner id.
212
213```bash
214> commissioner id
215OpenThread Commissioner
216Done
217```
218
219### id \<name\>
220
221Set the commissioner id.
222
223```bash
224> commissioner id "Custom Commissioner Id"
225Done
226```
227
228### start
229
230Usage: `commissioner start`
231
232Start the Commissioner role.
233
234This command will cause the device to send `LEAD_PET` and `LEAD_KA` messages.
235
236```bash
237> commissioner start
238Commissioner: petitioning
239Done
240Commissioner: active
241```
242
243### state
244
245Usage: `commissioner state`
246
247Get Commissioner state.
248
249This command will return the current Commissioner state.
250
251```bash
252> commissioner state
253active
254Done
255```
256
257### stop
258
259Usage: `commissioner stop`
260
261Stop the Commissioner role.
262
263This command will cause the device to send `LEAD_KA[Reject]` messages.
264
265```bash
266> commissioner stop
267Done
268```
269
README_COMMISSIONING.md
1# OpenThread CLI - Commissioning
2
3## Overview
4
5Commissioning is the process of adding a new Thread device, called the Joiner, to a Thread network. This process is done under guidance of a [Commissioner](README_COMMISSIONER.md).
6
7## Quick Start
8
9### Form Network
10
11Form a network with the Thread device that has Commissioner support.
12
131. Generate and view new network configuration.
14
15 ```bash
16 > dataset init new
17 Done
18 > dataset
19 Active Timestamp: 1
20 Channel: 13
21 Channel Mask: 0x07fff800
22 Ext PAN ID: d63e8e3e495ebbc3
23 Mesh Local Prefix: fd3d:b50b:f96d:722d::/64
24 Network Key: dfd34f0f05cad978ec4e32b0413038ff
25 Network Name: OpenThread-8f28
26 PAN ID: 0x8f28
27 PSKc: c23a76e98f1a6483639b1ac1271e2e27
28 Security Policy: 0, onrc
29 Done
30 ```
31
322. Commit new dataset to the Active Operational Dataset in non-volatile storage.
33
34 ```bash
35 dataset commit active
36 Done
37 ```
38
393. Enable Thread interface
40
41 ```bash
42 > ifconfig up
43 Done
44 > thread start
45 Done
46 ```
47
48### Obtain Joiner IEEE EUI-64
49
501. Start the Joiner node and obtain the Joiner's IEEE EUI-64.
51
52 ```bash
53 > eui64
54 18b4300000000002
55 Done
56 ```
57
58### Start Commissioner
59
601. Start the Commissioner Role
61
62 ```bash
63 > commissioner start
64 Commissioner: petitioning
65 Done
66 Commissioner: active
67 ```
68
692. Add the Joiner with the device-specific pre-shared key (PSKd)
70
71 ```bash
72 > commissioner joiner add 18b4300000000002 J01NME
73 Done
74 ```
75
76### Start Joiner
77
781. Factory reset the device.
79
80 ```bash
81 > factoryreset
82 ```
83
842. Start the Joiner process.
85
86 ```bash
87 > ifconfig up
88 Done
89 > joiner start J01NME
90 Done
91 Join success
92 ```
93
943. Attach to Thread network
95
96 ```bash
97 > thread start
98 Done
99 ```
100
1014. After successful attach, validate the device has the same Active Operational Dataset as above.
102
103 ```bash
104 > dataset active
105 Active Timestamp: 1
106 Channel: 13
107 Channel Mask: 0x07fff800
108 Ext PAN ID: d63e8e3e495ebbc3
109 Mesh Local Prefix: fd3d:b50b:f96d:722d::/64
110 Network Key: dfd34f0f05cad978ec4e32b0413038ff
111 Network Name: OpenThread-8f28
112 PAN ID: 0x8f28
113 PSKc: c23a76e98f1a6483639b1ac1271e2e27
114 Security Policy: 0, onrc
115 Done
116 ```
117
118## CLI Reference
119
120- [Commissioner CLI Reference](README_COMMISSIONER.md)
121- [Joiner CLI Reference](README_JOINER.md)
122
README_DATASET.md
1# OpenThread CLI - Operational Datasets
2
3## Overview
4
5Thread network configuration parameters are managed using Active and Pending Operational Dataset objects.
6
7### WARNING - Restrictions for production use!
8
9The CLI commands to write/change the Active and Pending Operational Datasets may allow setting invalid parameters, or invalid combinations of parameters, for testing purposes. These CLI commands can only be used:
10
11- To configure network parameters for the first device in a newly created Thread network.
12- For testing (not applicable to production devices).
13
14In production Thread networks, the correct method to write/change Operational Datasets is via a [Commissioner](README_COMMISSIONER.md) that performs [commissioning](README_COMMISSIONING.md). Production devices that are not an active Commissioner and are part of a Thread network MUST NOT modify the Operational Datasets in any way.
15
16### Active Operational Dataset
17
18The Active Operational Dataset includes parameters that are currently in use across an entire Thread network. The Active Operational Dataset contains:
19
20- Active Timestamp
21- Channel
22- Wake-up Channel
23- Channel Mask
24- Extended PAN ID
25- Mesh-Local Prefix
26- Network Name
27- PAN ID
28- PSKc
29- Security Policy
30
31### Pending Operational Dataset
32
33The 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:
34
35- Delay Timer
36- Pending Timestamp
37
38## Quick Start
39
40### Form Network
41
421. Generate and view new network configuration.
43
44 ```bash
45 > dataset init new
46 Done
47 > dataset
48 Active Timestamp: 1
49 Channel: 15
50 Wake-up Channel: 16
51 Channel Mask: 0x07fff800
52 Ext PAN ID: 39758ec8144b07fb
53 Mesh Local Prefix: fdf1:f1ad:d079:7dc0::/64
54 Network Key: f366cec7a446bab978d90d27abe38f23
55 Network Name: OpenThread-5938
56 PAN ID: 0x5938
57 PSKc: 3ca67c969efb0d0c74a4d8ee923b576c
58 Security Policy: 672 onrc 0
59 Done
60 ```
61
622. Commit new dataset to the Active Operational Dataset in non-volatile storage.
63
64 ```bash
65 dataset commit active
66 Done
67 ```
68
693. Enable Thread interface
70
71 ```bash
72 > ifconfig up
73 Done
74 > thread start
75 Done
76 ```
77
78### Attach to Existing Network
79
80Only the Network Key is required for a device to attach to a Thread network.
81
82While not required, specifying the channel avoids the need to search across multiple channels, improving both latency and efficiency of the attach process.
83
84After the device successfully attaches to a Thread network, the device will retrieve the complete Active Operational Dataset.
85
861. Create a partial Active Operational Dataset.
87
88 ```bash
89 > dataset networkkey dfd34f0f05cad978ec4e32b0413038ff
90 Done
91 > dataset commit active
92 Done
93 ```
94
952. Enable Thread interface.
96
97 ```bash
98 > ifconfig up
99 Done
100 > thread start
101 Done
102 ```
103
1043. After attaching, validate that the device received the complete Active Operational Dataset.
105
106 ```bash
107 > dataset active
108 Active Timestamp: 1
109 Channel: 15
110 Wake-up Channel: 16
111 Channel Mask: 0x07fff800
112 Ext PAN ID: 39758ec8144b07fb
113 Mesh Local Prefix: fdf1:f1ad:d079:7dc0::/64
114 Network Key: f366cec7a446bab978d90d27abe38f23
115 Network Name: OpenThread-5938
116 PAN ID: 0x5938
117 PSKc: 3ca67c969efb0d0c74a4d8ee923b576c
118 Security Policy: 672 onrc 0
119 Done
120 ```
121
122### Using the Dataset Updater to update Operational Dataset
123
124Dataset Updater can be used for a delayed update of network parameters on all devices of a Thread Network.
125
1261. Clear the dataset buffer and add the Dataset fields to update.
127
128 ```bash
129 > dataset clear
130 Done
131
132 > dataset channel 12
133 Done
134 ```
135
1362. Set the delay timer parameter (example uses 5 minutes or 300000 ms). Check the resulting dataset. There is no need to specify active or pending timestamps because the Dataset Updater will handle this. If specified the `dataset updater start` will issue an error.
137
138 ```bash
139 > dataset delay 300000
140
141 > dataset
142 Channel: 12
143 Delay: 30000
144 Done
145 ```
146
1473. Start the Dataset Updater, which will prepare a Pending Operation Dataset and inform the Leader to distribute it to other devices.
148
149 ```bash
150 > dataset updater start
151 Done
152
153 > dataset updater
154 Enabled
155 ```
156
1574. After about 5 minutes, the changes are applied to the Active Operational Dataset on the Leader. This can also be checked at other devices on the network: these should have applied the new Dataset too, at approximately the same time as the Leader has done this.
158
159 ```bash
160 > dataset active
161 Active Timestamp: 10
162 Channel: 12
163 Channel Mask: 0x07fff800
164 Ext PAN ID: 324a71d90cdc8345
165 Mesh Local Prefix: fd7d:da74:df5e:80c::/64
166 Network Key: be768535bac1b8d228960038311d6ca2
167 Network Name: OpenThread-bcaf
168 PAN ID: 0xbcaf
169 PSKc: e79b274ab22414a814ed5cce6a30be67
170 Security Policy: 672 onrc 0
171 Done
172 ```
173
174### Using the Pending Operational Dataset for Delayed Dataset Updates
175
176The Pending Operational Dataset can be used for a delayed update of network parameters on all devices of a Thread Network. If certain Active Operational Dataset parameters need to be changed, but the change would impact the connectivity of the network, delaying the update helps to let all devices receive the new parameters before the update is applied. Examples of such parameters are the channel, PAN ID, certain Security Policy bits, or Network Key.
177
178The delay timer determines the time period after which the Pending Operational Dataset takes effect and becomes the Active Operational Dataset. The following example shows how a Pending Operational Dataset with delay timer can be set at a Leader device. The Leader will initiate the distribution of the Pending Operational Dataset to the rest of the devices in the network.
179
180Normally, an active Commissioner will set a new Pending Operational Dataset. For testing purposes, we will do this in the example directly on the Leader using the CLI - so without using a Commissioner.
181
1821. The main parameter to change is the channel. We can display the current Active Operational Dataset to see that the current channel is 16.
183
184 ```bash
185 > dataset active
186 Active Timestamp: 1691070443
187 Channel: 16
188 Channel Mask: 0x07fff800
189 Ext PAN ID: 324a71d90cdc8345
190 Mesh Local Prefix: fd7d:da74:df5e:80c::/64
191 Network Key: be768535bac1b8d228960038311d6ca2
192 Network Name: OpenThread-bcaf
193 PAN ID: 0xbcaf
194 PSKc: e79b274ab22414a814ed5cce6a30be67
195 Security Policy: 672 onrc 0
196 Done
197 ```
198
1992. Create a new Dataset in the dataset buffer, by copying the Active Operational Dataset. Then change the channel number to 12 and increase the timestamp.
200
201 ```bash
202 > dataset init active
203 Done
204 > dataset activetimestamp 1696177379
205 Done
206 > dataset pendingtimestamp 1696177379
207 Done
208 > dataset channel 12
209 Done
210 ```
211
2123. Set the delay timer parameter to 5 minutes (300000 ms). Show the resulting Dataset that's ready to be used.
213
214 ```bash
215 > dataset delay 300000
216 Done
217 > dataset
218 Pending Timestamp: 1696177379
219 Active Timestamp: 1696177379
220 Channel: 12
221 Channel Mask: 0x07fff800
222 Delay: 300000
223 Ext PAN ID: 324a71d90cdc8345
224 Mesh Local Prefix: fd7d:da74:df5e:80c::/64
225 Network Key: be768535bac1b8d228960038311d6ca2
226 Network Name: OpenThread-bcaf
227 PAN ID: 0xbcaf
228 PSKc: e79b274ab22414a814ed5cce6a30be67
229 Security Policy: 672 onrc 0
230 Done
231 ```
232
2334. Commit the new Dataset as the Pending Operational Dataset. This also starts the delay timer countdown. The Leader then starts the distribution of the Pending Operational Dataset to other devices in the network.
234
235 ```bash
236 > dataset commit pending
237 Done
238 ```
239
2405. To verify that the delay timer is counting down, display the Pending Operational Dataset after a few seconds.
241
242 ```bash
243 > dataset pending
244 Pending Timestamp: 1696177379
245 Active Timestamp: 1696177379
246 Channel: 12
247 Channel Mask: 0x07fff800
248 Delay: 293051
249 Ext PAN ID: 324a71d90cdc8345
250 Mesh Local Prefix: fd7d:da74:df5e:80c::/64
251 Network Key: be768535bac1b8d228960038311d6ca2
252 Network Name: OpenThread-bcaf
253 PAN ID: 0xbcaf
254 PSKc: e79b274ab22414a814ed5cce6a30be67
255 Security Policy: 672 onrc 0
256 Done
257 ```
258
259 This shows that indeed the delay timer has started counting down from its initial value `300000`. The same can be optionally checked on other devices in the network.
260
2616) After about 5 minutes, check that the Pending Operational Dataset has been applied at the Leader. This can also be checked at other devices on the network: these should have applied the new Dataset too, at approximately the same time as the Leader has done this.
262
263 ```bash
264 > dataset active
265 Active Timestamp: 1696177379
266 Channel: 12
267 Channel Mask: 0x07fff800
268 Ext PAN ID: 324a71d90cdc8345
269 Mesh Local Prefix: fd7d:da74:df5e:80c::/64
270 Network Key: be768535bac1b8d228960038311d6ca2
271 Network Name: OpenThread-bcaf
272 PAN ID: 0xbcaf
273 PSKc: e79b274ab22414a814ed5cce6a30be67
274 Security Policy: 672 onrc 0
275 Done
276 ```
277
278 This shows that the Active Operational Dataset has now been updated to use channel 12. And the Pending Operational Dataset is no longer present, as can be seen by this command:
279
280 ```bash
281 > dataset pending
282 Error 23: NotFound
283 ```
284
285## Command List
286
287- [help](#help)
288- [active](#active)
289- [activetimestamp](#activetimestamp)
290- [channel](#channel)
291- [channelmask](#channelmask)
292- [clear](#clear)
293- [commit](#commit)
294- [delay](#delay)
295- [extpanid](#extpanid)
296- [init](#init)
297- [meshlocalprefix](#meshlocalprefix)
298- [mgmtgetcommand](#mgmtgetcommand)
299- [mgmtsetcommand](#mgmtsetcommand)
300- [networkkey](#networkkey)
301- [networkname](#networkname)
302- [panid](#panid)
303- [pending](#pending)
304- [pendingtimestamp](#pendingtimestamp)
305- [pskc](#pskc)
306- [securitypolicy](#securitypolicy)
307- [tlvs](#tlvs)
308- [updater](#updater)
309- [wakeupchannel](#wakeupchannel)
310
311## Command Details
312
313### help
314
315Usage: `dataset help`
316
317Print dataset help menu.
318
319```bash
320> dataset help
321help
322active
323activetimestamp
324channel
325channelmask
326clear
327commit
328delay
329extpanid
330init
331meshlocalprefix
332mgmtgetcommand
333mgmtsetcommand
334networkkey
335networkname
336panid
337pending
338pendingtimestamp
339pskc
340securitypolicy
341set
342tlvs
343wakeupchannel
344Done
345```
346
347### active
348
349Usage: `dataset active [-x]`
350
351Print Active Operational Dataset in human-readable form.
352
353```bash
354> dataset active
355Active Timestamp: 1
356Channel: 15
357Wake-up Channel: 16
358Channel Mask: 0x07fff800
359Ext PAN ID: 39758ec8144b07fb
360Mesh Local Prefix: fdf1:f1ad:d079:7dc0::/64
361Network Key: f366cec7a446bab978d90d27abe38f23
362Network Name: OpenThread-5938
363PAN ID: 0x5938
364PSKc: 3ca67c969efb0d0c74a4d8ee923b576c
365Security Policy: 672 onrc 0
366Done
367```
368
369Print Active Operational Dataset as hex-encoded TLVs.
370
371```bash
372> dataset active -x
3730e08000000000001000000030000164a0300001735060004001fffe00208b182e6a17996cecc0708fd3f363fa8f1b0bc0510ebb6f6a447c96e1542176df3a834ac0e030f4f70656e5468726561642d3663393901026c99041096e9cdfe1eb1363a3676e2b94df0271b0c0402a0f7f8
374Done
375```
376
377### activetimestamp
378
379Usage: `dataset activetimestamp [timestamp]`
380
381Get active timestamp seconds. It represents a "Unix time", in number of seconds since Jan 1st, 1970.
382
383```bash
384> dataset activetimestamp
385123456789
386Done
387```
388
389Set active timestamp seconds.
390
391```bash
392> dataset activetimestamp 123456789
393Done
394```
395
396### channel
397
398Usage: `channel [channel]`
399
400Get channel.
401
402```bash
403> dataset channel
40412
405Done
406```
407
408Set channel.
409
410```bash
411> dataset channel 12
412Done
413```
414
415### channelmask
416
417Usage: `dataset channelmask [channelmask]`
418
419Get channel mask.
420
421```bash
422> dataset channelmask
4230x07fff800
424Done
425```
426
427Set channel mask.
428
429```bash
430> dataset channelmask 0x07fff800
431Done
432```
433
434### clear
435
436Usage: `dataset clear`
437
438Reset operational dataset buffer.
439
440```bash
441> dataset clear
442Done
443```
444
445### commit
446
447Usage: `dataset commit <active|pending>`
448
449Commit operational dataset buffer to active/pending operational dataset.
450
451```bash
452> dataset commit active
453Done
454```
455
456### delay
457
458Usage: `dataset delay [delay]`
459
460Get delay timer value. The timer value is in milliseconds.
461
462```bash
463> dataset delay
4641000
465Done
466```
467
468Set delay timer value.
469
470```bash
471> dataset delay 100000
472Done
473```
474
475### extpanid
476
477Usage: `dataset extpanid [extpanid]`
478
479Get extended panid.
480
481```bash
482> dataset extpanid
483000db80123456789
484Done
485```
486
487Set extended panid.
488
489**NOTE** The commissioning credential in the dataset buffer becomes stale after changing this value. Use [pskc](#pskc) to reset.
490
491```bash
492> dataset extpanid 000db80123456789
493Done
494```
495
496### init
497
498Usage: `dataset init <active|new|pending|tlvs <hex-encoded TLVs>>`
499
500Initialize operational dataset buffer. Use `new` to initialize with randomly selected values:
501
502```bash
503> dataset init new
504Done
505```
506
507Use `active` or `pending` to initialize the dataset buffer with a copy of the current Active Operational Dataset or Pending Operational Dataset, respectively:
508
509```bash
510> dataset init active
511Done
512```
513
514Use the `tlvs` option to initialize the dataset buffer from a string of hex-encoded TLVs:
515
516```bash
517> dataset init tlvs 0e080000000000010000000300001235060004001fffe002088665f03e6e42e7750708fda576e5f9a5bd8c0510506071d8391be671569e080d52870fd5030f4f70656e5468726561642d633538640102c58d04108a926cf8b13275a012ceedeeae40910d0c0402a0f7f8
518Done
519```
520
521### meshlocalprefix
522
523Usage: `dataset meshlocalprefix [prefix]`
524
525Get mesh local prefix.
526
527```bash
528> dataset meshlocalprefix
529fd00:db8:0:0::/64
530Done
531```
532
533Set mesh local prefix.
534
535```bash
536> dataset meshlocalprefix fd00:db8::
537Done
538```
539
540### mgmtgetcommand
541
542Usage: `dataset mgmtgetcommand <active|pending> [address <destination>] [TLV list] [-x]`
543
544Send MGMT_ACTIVE_GET or MGMT_PENDING_GET.
545
546```bash
547> dataset mgmtgetcommand active address fdde:ad00:beef:0:558:f56b:d688:799 activetimestamp securitypolicy
548Done
549```
550
551### mgmtsetcommand
552
553Usage: `dataset mgmtsetcommand <active|pending> [TLV Type list] [-x]`
554
555Send MGMT_ACTIVE_SET or MGMT_PENDING_SET.
556
557```bash
558> dataset mgmtsetcommand active activetimestamp 123 securitypolicy 1 onrc 0
559Done
560```
561
562### networkkey
563
564Usage: `dataset networkkey [key]`
565
566Get network key
567
568```bash
569> dataset networkkey
57000112233445566778899aabbccddeeff
571Done
572```
573
574Set network key.
575
576```bash
577> dataset networkkey 00112233445566778899aabbccddeeff
578Done
579```
580
581### networkname
582
583Usage: `dataset networkname [name]`
584
585Get network name.
586
587```bash
588> dataset networkname
589OpenThread
590Done
591```
592
593Set network name.
594
595**NOTE** The commissioning credential in the dataset buffer becomes stale after changing this value. Use [pskc](#pskc) to reset.
596
597```bash
598> dataset networkname OpenThread
599Done
600```
601
602### panid
603
604Usage: `dataset panid [panid]`
605
606Get panid.
607
608```bash
609> dataset panid
6100x1234
611Done
612```
613
614Set panid.
615
616```bash
617> dataset panid 0x1234
618Done
619```
620
621### pending
622
623Usage: `dataset pending [-x]`
624
625Print Pending Operational Dataset in human-readable form.
626
627```bash
628> dataset pending
629Pending Timestamp: 2
630Active Timestamp: 1
631Channel: 26
632Channel Mask: 0x07fff800
633Delay: 58706
634Ext PAN ID: a74182f4d3f4de41
635Mesh Local Prefix: fd46:c1b9:e159:5574::/64
636Network Key: ed916e454d96fd00184f10a6f5c9e1d3
637Network Name: OpenThread-bff8
638PAN ID: 0xbff8
639PSKc: 264f78414adc683191863d968f72d1b7
640Security Policy: 672 onrc 0
641Done
642```
643
644Print Pending Operational Dataset as hex-encoded TLVs.
645
646```bash
647> dataset pending -x
6480e0800000000000100003308000000000002000034040000b512000300001a35060004001fffe00208a74182f4d3f4de410708fd46c1b9e15955740510ed916e454d96fd00184f10a6f5c9e1d3030f4f70656e5468726561642d626666380102bff80410264f78414adc683191863d968f72d1b70c0402a0f7f8
649Done
650```
651
652### pendingtimestamp
653
654Usage: `dataset pendingtimestamp [timestamp]`
655
656Get pending timestamp seconds. It represents a "Unix time", in number of seconds since Jan 1st, 1970.
657
658```bash
659> dataset pendingtimestamp
660123456789
661Done
662```
663
664Set pending timestamp seconds.
665
666```bash
667> dataset pendingtimestamp 123456789
668Done
669```
670
671### pskc
672
673Usage: `pskc [-p] [<key>|<passphrase>]`
674
675Get PSKc.
676
677```bash
678> dataset pskc
67967c0c203aa0b042bfb5381c47aef4d9e
680Done
681```
682
683Set PSKc.
684
685With `-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).
686
687```bash
688> dataset pskc 67c0c203aa0b042bfb5381c47aef4d9e
689Done
690> dataset pskc -p 123456
691Done
692```
693
694### securitypolicy
695
696Usage: `dataset securitypolicy [<rotationtime> [onrcCepR] [versionthreshold]]`
697
698Get security policy.
699
700```bash
701> dataset securitypolicy
702672 onrc 0
703Done
704```
705
706Set security policy.
707
708- o: Obtaining the Network Key for out-of-band commissioning is enabled.
709- n: Native Commissioning using PSKc is allowed.
710- r: Thread 1.x Routers are enabled.
711- c: External Commissioner authentication is allowed using PSKc.
712- C: Thread 1.2 Commercial Commissioning is enabled.
713- e: Thread 1.2 Autonomous Enrollment is enabled.
714- p: Thread 1.2 Network Key Provisioning is enabled.
715- R: Non-CCM routers are allowed in Thread 1.2 CCM networks.
716
717If the `versionthreshold` parameter is not provided, a default value of zero is assumed.
718
719```bash
720> dataset securitypolicy 672 onrc 0
721Done
722```
723
724### set
725
726Usage: `dataset set <active|pending> <dataset>`
727
728Set the Active Operational Dataset using hex-encoded TLVs.
729
730```bash
731> dataset set active 0e080000000000010000000300000f35060004001fffe0020839758ec8144b07fb0708fdf1f1add0797dc00510f366cec7a446bab978d90d27abe38f23030f4f70656e5468726561642d353933380102593804103ca67c969efb0d0c74a4d8ee923b576c0c0402a0f7f8
732Done
733```
734
735Set the Pending Operational Dataset using hex-encoded TLVs.
736
737```bash
738> dataset set pending 0e0800000000000100003308000000000002000034040000b512000300001a35060004001fffe00208a74182f4d3f4de410708fd46c1b9e15955740510ed916e454d96fd00184f10a6f5c9e1d3030f4f70656e5468726561642d626666380102bff80410264f78414adc683191863d968f72d1b70c0402a0f7f8
739Done
740```
741
742### tlvs
743
744Usage: `dataset tlvs`
745
746Convert the Operational Dataset to hex-encoded TLVs.
747
748```bash
749> dataset
750Active Timestamp: 1
751Channel: 22
752Channel Mask: 0x07fff800
753Ext PAN ID: d196fa2040e973b6
754Mesh Local Prefix: fdbb:c310:c48f:3a39::/64
755Network Key: 9929154dbc363218bcd22f907caf5c15
756Network Name: OpenThread-de2b
757PAN ID: 0xde2b
758PSKc: 15b2c16f7ba92ed4bc7b1ee054f1553f
759Security Policy: 672 onrc 0
760Done
761
762> dataset tlvs
7630e080000000000010000000300001635060004001fffe00208d196fa2040e973b60708fdbbc310c48f3a3905109929154dbc363218bcd22f907caf5c15030f4f70656e5468726561642d646532620102de2b041015b2c16f7ba92ed4bc7b1ee054f1553f0c0402a0f7f8
764Done
765```
766
767### updater
768
769Usage: `dataset updater`
770
771Requires `OPENTHREAD_CONFIG_DATASET_UPDATER_ENABLE`.
772
773Indicate whether there is an ongoing Operation Dataset update request.
774
775```bash
776> dataset updater
777Enabled
778```
779
780### updater start
781
782Usage: `dataset updater start`
783
784Requires `OPENTHREAD_CONFIG_DATASET_UPDATER_ENABLE`.
785
786Request network to update its Operation Dataset to the current operational dataset buffer.
787
788The current operational dataset buffer should contain the fields to be updated with their new values. It must not contain Active or Pending Timestamp fields. The Delay field is optional. If not provided, a default value (1000 ms) is used.
789
790```bash
791> channel
79219
793Done
794
795> dataset clear
796Done
797> dataset channel 15
798Done
799> dataset
800Channel: 15
801Done
802
803> dataset updater start
804Done
805> dataset updater
806Enabled
807Done
808
809Dataset update complete: OK
810
811> channel
81215
813Done
814```
815
816### updater cancel
817
818Usage: `dataset updater cancel`
819
820Requires `OPENTHREAD_CONFIG_DATASET_UPDATER_ENABLE`.
821
822Cancels an ongoing (if any) Operational Dataset update request.
823
824```bash
825> dataset updater start
826Done
827> dataset updater
828Enabled
829Done
830>
831> dataset updater cancel
832Done
833> dataset updater
834Disabled
835Done
836```
837
838### wakeupchannel
839
840Usage: `wakeupchannel [channel]`
841
842Get wake-up channel.
843
844```bash
845> dataset wakeupchannel
84613
847Done
848```
849
850Set wake-up channel.
851
852```bash
853> dataset wakeupchannel 13
854Done
855```
856
README_HISTORY.md
1# OpenThread CLI - History Tracker
2
3History Tracker module records history of different events (e.g., RX and TX IPv6 messages or network info changes, etc.) as the Thread network operates. All tracked entries are timestamped.
4
5All commands under `history` require `OPENTHREAD_CONFIG_HISTORY_TRACKER_ENABLE` feature to be enabled.
6
7The number of entries recorded for each history list is configurable through a set of OpenThread config options, e.g. `OPENTHREAD_CONFIG_HISTORY_TRACKER_NET_INFO_LIST_SIZE` specifies the number of entries in Network Info history list. The History Tracker will keep the most recent entries overwriting oldest one when the list gets full.
8
9## Command List
10
11Usage : `history [command] ...`
12
13- [help](#help)
14- [ipaddr](#ipaddr)
15- [ipmaddr](#ipmaddr)
16- [neighbor](#neighbor)
17- [netinfo](#netinfo)
18- [prefix](#prefix)
19- [route](#route)
20- [router](#router)
21- [rx](#rx)
22- [rxtx](#rxtx)
23- [tx](#tx)
24
25## Timestamp Format
26
27Recorded entries are timestamped. When the history list is printed, the timestamps are shown relative the time the command was issues (i.e., when the list was printed) indicating how long ago the entry was recorded.
28
29```bash
30> history netinfo
31| Age | Role | Mode | RLOC16 | Partition ID |
32+----------------------+----------+------+--------+--------------+
33| 02:31:50.628 | leader | rdn | 0x2000 | 151029327 |
34| 02:31:53.262 | detached | rdn | 0xfffe | 0 |
35| 02:31:54.663 | detached | rdn | 0x2000 | 0 |
36Done
37```
38
39For example `02:31:50.628` indicates the event was recorded "2 hours, 31 minutes, 50 seconds, and 628 milliseconds ago". Number of days is added for events that are older than 24 hours, e.g., `1 day 11:25:31.179`, or `31 days 03:00:23.931`.
40
41Timestamps use millisecond accuracy and are tacked up to 49 days. If the event is older than 49 days, the entry is still tracked in the list but the timestamp is shown as `more than 49 days`.
42
43## Command Details
44
45### help
46
47Usage: `history help`
48
49Print SRP client help menu.
50
51```bash
52> history help
53help
54ipaddr
55ipmaddr
56neighbor
57netinfo
58prefix
59route
60router
61rx
62rxtx
63tx
64Done
65>
66```
67
68### ipaddr
69
70Usage `history ipaddr [list] [<num-entries>]`
71
72Print the unicast IPv6 address history. Each entry provides:
73
74- Event: Added or Removed.
75- Address: Unicast address along with its prefix length (in bits).
76- Origin: thread, slaac, dhcp6, or manual.
77- Address Scope.
78- Flags: Preferred, Valid, and RLOC (whether the address is RLOC).
79
80Print the unicast IPv6 address history as table.
81
82```bash
83> history ipaddr
84| Age | Event | Address / PrefixLength | Origin |Scope| P | V | R |
85+----------------------+---------+---------------------------------------------+--------+-----+---+---+---+
86| 00:00:04.991 | Removed | 2001:dead:beef:cafe:c4cb:caba:8d55:e30b/64 | slaac | 14 | Y | Y | N |
87| 00:00:44.647 | Added | 2001:dead:beef:cafe:c4cb:caba:8d55:e30b/64 | slaac | 14 | Y | Y | N |
88| 00:01:07.199 | Added | fd00:0:0:0:0:0:0:1/64 | manual | 14 | Y | Y | N |
89| 00:02:17.885 | Added | fdde:ad00:beef:0:0:ff:fe00:fc00/64 | thread | 3 | N | Y | N |
90| 00:02:17.885 | Added | fdde:ad00:beef:0:0:ff:fe00:5400/64 | thread | 3 | N | Y | Y |
91| 00:02:20.107 | Removed | fdde:ad00:beef:0:0:ff:fe00:5400/64 | thread | 3 | N | Y | Y |
92| 00:02:21.575 | Added | fdde:ad00:beef:0:0:ff:fe00:5400/64 | thread | 3 | N | Y | Y |
93| 00:02:21.575 | Added | fdde:ad00:beef:0:ecea:c4fc:ad96:4655/64 | thread | 3 | N | Y | N |
94| 00:02:23.904 | Added | fe80:0:0:0:3c12:a4d2:fbe0:31ad/64 | thread | 2 | Y | Y | N |
95Done
96```
97
98Print the unicast IPv6 address history as a list (the last 5 entries).
99
100```bash
101> history ipaddr list 5
10200:00:20.327 -> event:Removed address:2001:dead:beef:cafe:c4cb:caba:8d55:e30b prefixlen:64 origin:slaac scope:14 preferred:yes valid:yes rloc:no
10300:00:59.983 -> event:Added address:2001:dead:beef:cafe:c4cb:caba:8d55:e30b prefixlen:64 origin:slaac scope:14 preferred:yes valid:yes rloc:no
10400:01:22.535 -> event:Added address:fd00:0:0:0:0:0:0:1 prefixlen:64 origin:manual scope:14 preferred:yes valid:yes rloc:no
10500:02:33.221 -> event:Added address:fdde:ad00:beef:0:0:ff:fe00:fc00 prefixlen:64 origin:thread scope:3 preferred:no valid:yes rloc:no
10600:02:33.221 -> event:Added address:fdde:ad00:beef:0:0:ff:fe00:5400 prefixlen:64 origin:thread scope:3 preferred:no valid:yes rloc:yes
107Done
108```
109
110### ipmaddr
111
112Usage `history ipmaddr [list] [<num-entries>]`
113
114Print the multicast IPv6 address history. Each entry provides:
115
116- Event: Subscribed or Unsubscribed.
117- Address: Multicast address.
118- Origin: Thread, or Manual.
119
120Print the multicast IPv6 address history as table.
121
122```bash
123> history ipmaddr
124| Age | Event | Multicast Address | Origin |
125+----------------------+--------------+-----------------------------------------+--------+
126| 00:00:08.592 | Unsubscribed | ff05:0:0:0:0:0:0:1 | Manual |
127| 00:01:25.353 | Subscribed | ff05:0:0:0:0:0:0:1 | Manual |
128| 00:01:54.953 | Subscribed | ff03:0:0:0:0:0:0:2 | Thread |
129| 00:01:54.953 | Subscribed | ff02:0:0:0:0:0:0:2 | Thread |
130| 00:01:59.329 | Subscribed | ff33:40:fdde:ad00:beef:0:0:1 | Thread |
131| 00:01:59.329 | Subscribed | ff32:40:fdde:ad00:beef:0:0:1 | Thread |
132| 00:02:01.129 | Subscribed | ff03:0:0:0:0:0:0:fc | Thread |
133| 00:02:01.129 | Subscribed | ff03:0:0:0:0:0:0:1 | Thread |
134| 00:02:01.129 | Subscribed | ff02:0:0:0:0:0:0:1 | Thread |
135Done
136```
137
138Print the multicast IPv6 address history as a list.
139
140```bash
141> history ipmaddr list
14200:00:25.447 -> event:Unsubscribed address:ff05:0:0:0:0:0:0:1 origin:Manual
14300:01:42.208 -> event:Subscribed address:ff05:0:0:0:0:0:0:1 origin:Manual
14400:02:11.808 -> event:Subscribed address:ff03:0:0:0:0:0:0:2 origin:Thread
14500:02:11.808 -> event:Subscribed address:ff02:0:0:0:0:0:0:2 origin:Thread
14600:02:16.184 -> event:Subscribed address:ff33:40:fdde:ad00:beef:0:0:1 origin:Thread
14700:02:16.184 -> event:Subscribed address:ff32:40:fdde:ad00:beef:0:0:1 origin:Thread
14800:02:17.984 -> event:Subscribed address:ff03:0:0:0:0:0:0:fc origin:Thread
14900:02:17.984 -> event:Subscribed address:ff03:0:0:0:0:0:0:1 origin:Thread
15000:02:17.984 -> event:Subscribed address:ff02:0:0:0:0:0:0:1 origin:Thread
151Done
152```
153
154### neighbor
155
156Usage `history neighbor [list] [<num-entries>]`
157
158Print the neighbor table history. Each entry provides:
159
160- Type: Child or Router
161- Event: Added, Removed, Changed (e.g., mode change).
162- Extended Address
163- RLOC16
164- MLE Link Mode
165- Average RSS (in dBm) of received frames from neighbor at the time the entry was recorded
166
167Print the neighbor history as a table.
168
169```bash
170> history neighbor
171| Age | Type | Event | Extended Address | RLOC16 | Mode | Ave RSS |
172+----------------------+--------+-----------+------------------+--------+------+---------+
173| 00:00:29.233 | Child | Added | ae5105292f0b9169 | 0x8404 | - | -20 |
174| 00:01:38.368 | Child | Removed | ae5105292f0b9169 | 0x8401 | - | -20 |
175| 00:04:27.181 | Child | Changed | ae5105292f0b9169 | 0x8401 | - | -20 |
176| 00:04:51.236 | Router | Added | 865c7ca38a5fa960 | 0x9400 | rdn | -20 |
177| 00:04:51.587 | Child | Removed | 865c7ca38a5fa960 | 0x8402 | rdn | -20 |
178| 00:05:22.764 | Child | Changed | ae5105292f0b9169 | 0x8401 | rn | -20 |
179| 00:06:40.764 | Child | Added | 4ec99efc874a1841 | 0x8403 | r | -20 |
180| 00:06:44.060 | Child | Added | 865c7ca38a5fa960 | 0x8402 | rdn | -20 |
181| 00:06:49.515 | Child | Added | ae5105292f0b9169 | 0x8401 | - | -20 |
182Done
183```
184
185Print the neighbor history as a list.
186
187```bash
188
189> history neighbor list
19000:00:34.753 -> type:Child event:Added extaddr:ae5105292f0b9169 rloc16:0x8404 mode:- rss:-20
19100:01:43.888 -> type:Child event:Removed extaddr:ae5105292f0b9169 rloc16:0x8401 mode:- rss:-20
19200:04:32.701 -> type:Child event:Changed extaddr:ae5105292f0b9169 rloc16:0x8401 mode:- rss:-20
19300:04:56.756 -> type:Router event:Added extaddr:865c7ca38a5fa960 rloc16:0x9400 mode:rdn rss:-20
19400:04:57.107 -> type:Child event:Removed extaddr:865c7ca38a5fa960 rloc16:0x8402 mode:rdn rss:-20
19500:05:28.284 -> type:Child event:Changed extaddr:ae5105292f0b9169 rloc16:0x8401 mode:rn rss:-20
19600:06:46.284 -> type:Child event:Added extaddr:4ec99efc874a1841 rloc16:0x8403 mode:r rss:-20
19700:06:49.580 -> type:Child event:Added extaddr:865c7ca38a5fa960 rloc16:0x8402 mode:rdn rss:-20
19800:06:55.035 -> type:Child event:Added extaddr:ae5105292f0b9169 rloc16:0x8401 mode:- rss:-20
199Done
200```
201
202### netinfo
203
204Usage `history netinfo [list] [<num-entries>]`
205
206Print the Network Info history. Each Network Info provides:
207
208- Device Role
209- MLE Link Mode
210- RLOC16
211- Partition ID
212
213Print the Network Info history as a table.
214
215```bash
216> history netinfo
217| Age | Role | Mode | RLOC16 | Partition ID |
218+----------------------+----------+------+--------+--------------+
219| 00:00:10.069 | router | rdn | 0x6000 | 151029327 |
220| 00:02:09.337 | child | rdn | 0x2001 | 151029327 |
221| 00:02:09.338 | child | rdn | 0x2001 | 151029327 |
222| 00:07:40.806 | child | - | 0x2001 | 151029327 |
223| 00:07:42.297 | detached | - | 0x6000 | 0 |
224| 00:07:42.968 | disabled | - | 0x6000 | 0 |
225Done
226```
227
228Print the Network Info history as a list.
229
230```bash
231> history netinfo list
23200:00:59.467 -> role:router mode:rdn rloc16:0x6000 partition-id:151029327
23300:02:58.735 -> role:child mode:rdn rloc16:0x2001 partition-id:151029327
23400:02:58.736 -> role:child mode:rdn rloc16:0x2001 partition-id:151029327
23500:08:30.204 -> role:child mode:- rloc16:0x2001 partition-id:151029327
23600:08:31.695 -> role:detached mode:- rloc16:0x6000 partition-id:0
23700:08:32.366 -> role:disabled mode:- rloc16:0x6000 partition-id:0
238Done
239```
240
241Print only the latest 2 entries.
242
243```bash
244> history netinfo 2
245| Age | Role | Mode | RLOC16 | Partition ID |
246+----------------------+----------+------+--------+--------------+
247| 00:02:05.451 | router | rdn | 0x6000 | 151029327 |
248| 00:04:04.719 | child | rdn | 0x2001 | 151029327 |
249Done
250```
251
252### prefix
253
254Usage `history prefix [list] [<num-entries>]`
255
256Print the Network Data on mesh prefix history. Each item provides:
257
258- Event (`Added` or `Removed`)
259- Prefix
260- Flags
261- Preference (`high`, `med`, `low`)
262- RLOC16
263
264The flags are as follows:
265
266- `p`: Preferred flag
267- `a`: Stateless IPv6 Address Autoconfiguration flag
268- `d`: DHCPv6 IPv6 Address Configuration flag
269- `c`: DHCPv6 Other Configuration flag
270- `r`: Default Route flag
271- `o`: On Mesh flag
272- `s`: Stable flag
273- `n`: Nd Dns flag
274- `D`: Domain Prefix flag
275
276Print the history as a table.
277
278```bash
279> history prefix
280| Age | Event | Prefix | Flags | Pref | RLOC16 |
281+----------------------+---------+---------------------------------------------+-----------+------+--------+
282| 00:00:10.663 | Added | fd00:1111:2222:3333::/64 | paro | med | 0x5400 |
283| 00:01:02.054 | Removed | fd00:dead:beef:1::/64 | paros | high | 0x5400 |
284| 00:01:21.136 | Added | fd00:abba:cddd:0::/64 | paos | med | 0x5400 |
285| 00:01:45.144 | Added | fd00:dead:beef:1::/64 | paros | high | 0x3c00 |
286| 00:01:50.944 | Added | fd00:dead:beef:1::/64 | paros | high | 0x5400 |
287| 00:01:59.887 | Added | fd00:dead:beef:1::/64 | paros | med | 0x8800 |
288Done
289```
290
291Print the history as a list.
292
293```bash
294> history prefix list
29500:04:12.487 -> event:Added prefix:fd00:1111:2222:3333::/64 flags:paro pref:med rloc16:0x5400
29600:05:03.878 -> event:Removed prefix:fd00:dead:beef:1::/64 flags:paros pref:high rloc16:0x5400
29700:05:22.960 -> event:Added prefix:fd00:abba:cddd:0::/64 flags:paos pref:med rloc16:0x5400
29800:05:46.968 -> event:Added prefix:fd00:dead:beef:1::/64 flags:paros pref:high rloc16:0x3c00
29900:05:52.768 -> event:Added prefix:fd00:dead:beef:1::/64 flags:paros pref:high rloc16:0x5400
30000:06:01.711 -> event:Added prefix:fd00:dead:beef:1::/64 flags:paros pref:med rloc16:0x8800
301```
302
303### route
304
305Usage `history route [list] [<num-entries>]`
306
307Print the Network Data external route history. Each item provides:
308
309- Event (`Added` or `Removed`)
310- Route
311- Flags
312- Preference (`high`, `med`, `low`)
313- RLOC16
314
315The flags are as follows:
316
317- `s`: Stable flag
318- `n`: NAT64 flag
319
320Print the history as a table.
321
322```bash
323history route
324| Age | Event | Route | Flags | Pref | RLOC16 |
325+----------------------+---------+---------------------------------------------+-----------+------+--------+
326| 00:00:05.456 | Removed | fd00:1111:0::/48 | s | med | 0x3c00 |
327| 00:00:29.310 | Added | fd00:1111:0::/48 | s | med | 0x3c00 |
328| 00:00:42.822 | Added | fd00:1111:0::/48 | s | med | 0x5400 |
329| 00:01:27.688 | Added | fd00:aaaa:bbbb:cccc::/64 | s | med | 0x8800 |
330Done
331```
332
333Print the history as a list (last two entries).
334
335```bash
336> history route list 2
33700:00:48.704 -> event:Removed route:fd00:1111:0::/48 flags:s pref:med rloc16:0x3c00
33800:01:12.558 -> event:Added route:fd00:1111:0::/48 flags:s pref:med rloc16:0x3c00
339Done
340```
341
342### router
343
344Usage `history router [list] [<num-entries>]`
345
346Print the route table history. Each item provides:
347
348- Event (`Added`, `Removed`, `NextHopChanged`, `CostChanged`)
349- Router ID and RLOC16 of router
350- Next Hop (Router ID and RLOC16) - `none` if no next hop.
351- Path cost (old `->` new) - `inf` to indicate infinite path cost.
352
353Print the history as a table.
354
355```bash
356> history router
357| Age | Event | ID (RLOC16) | Next Hop | Path Cost |
358+----------------------+----------------+-------------+-------------+------------+
359| 00:00:05.258 | NextHopChanged | 7 (0x1c00) | 34 (0x8800) | inf -> 3 |
360| 00:00:08.604 | NextHopChanged | 34 (0x8800) | 34 (0x8800) | inf -> 2 |
361| 00:00:08.604 | Added | 7 (0x1c00) | none | inf -> inf |
362| 00:00:11.931 | Added | 34 (0x8800) | none | inf -> inf |
363| 00:00:14.948 | Removed | 59 (0xec00) | none | inf -> inf |
364| 00:00:14.948 | Removed | 54 (0xd800) | none | inf -> inf |
365| 00:00:14.948 | Removed | 34 (0x8800) | none | inf -> inf |
366| 00:00:14.948 | Removed | 7 (0x1c00) | none | inf -> inf |
367| 00:00:54.795 | NextHopChanged | 59 (0xec00) | 34 (0x8800) | 1 -> 5 |
368| 00:02:33.735 | NextHopChanged | 54 (0xd800) | none | 15 -> inf |
369| 00:03:10.915 | CostChanged | 54 (0xd800) | 34 (0x8800) | 13 -> 15 |
370| 00:03:45.716 | NextHopChanged | 54 (0xd800) | 34 (0x8800) | 15 -> 13 |
371| 00:03:46.188 | CostChanged | 54 (0xd800) | 59 (0xec00) | 13 -> 15 |
372| 00:04:19.124 | CostChanged | 54 (0xd800) | 59 (0xec00) | 11 -> 13 |
373| 00:04:52.008 | CostChanged | 54 (0xd800) | 59 (0xec00) | 9 -> 11 |
374| 00:05:23.176 | CostChanged | 54 (0xd800) | 59 (0xec00) | 7 -> 9 |
375| 00:05:51.081 | CostChanged | 54 (0xd800) | 59 (0xec00) | 5 -> 7 |
376| 00:06:48.721 | CostChanged | 54 (0xd800) | 59 (0xec00) | 3 -> 5 |
377| 00:07:13.792 | NextHopChanged | 54 (0xd800) | 59 (0xec00) | 1 -> 3 |
378| 00:09:28.681 | NextHopChanged | 7 (0x1c00) | 34 (0x8800) | inf -> 3 |
379| 00:09:31.882 | Added | 7 (0x1c00) | none | inf -> inf |
380| 00:09:51.240 | NextHopChanged | 54 (0xd800) | 54 (0xd800) | inf -> 1 |
381| 00:09:54.204 | Added | 54 (0xd800) | none | inf -> inf |
382| 00:10:20.645 | NextHopChanged | 34 (0x8800) | 34 (0x8800) | inf -> 2 |
383| 00:10:24.242 | NextHopChanged | 59 (0xec00) | 59 (0xec00) | inf -> 1 |
384| 00:10:24.242 | Added | 34 (0x8800) | none | inf -> inf |
385| 00:10:41.900 | NextHopChanged | 59 (0xec00) | none | 1 -> inf |
386| 00:10:42.480 | Added | 3 (0x0c00) | 3 (0x0c00) | inf -> inf |
387| 00:10:43.614 | Added | 59 (0xec00) | 59 (0xec00) | inf -> 1 |
388Done
389```
390
391Print the history as a list (last 20 entries).
392
393```bash
394> history router list 20
39500:00:06.959 -> event:NextHopChanged router:7(0x1c00) nexthop:34(0x8800) old-cost:inf new-cost:3
39600:00:10.305 -> event:NextHopChanged router:34(0x8800) nexthop:34(0x8800) old-cost:inf new-cost:2
39700:00:10.305 -> event:Added router:7(0x1c00) nexthop:none old-cost:inf new-cost:inf
39800:00:13.632 -> event:Added router:34(0x8800) nexthop:none old-cost:inf new-cost:inf
39900:00:16.649 -> event:Removed router:59(0xec00) nexthop:none old-cost:inf new-cost:inf
40000:00:16.649 -> event:Removed router:54(0xd800) nexthop:none old-cost:inf new-cost:inf
40100:00:16.649 -> event:Removed router:34(0x8800) nexthop:none old-cost:inf new-cost:inf
40200:00:16.649 -> event:Removed router:7(0x1c00) nexthop:none old-cost:inf new-cost:inf
40300:00:56.496 -> event:NextHopChanged router:59(0xec00) nexthop:34(0x8800) old-cost:1 new-cost:5
40400:02:35.436 -> event:NextHopChanged router:54(0xd800) nexthop:none old-cost:15 new-cost:inf
40500:03:12.616 -> event:CostChanged router:54(0xd800) nexthop:34(0x8800) old-cost:13 new-cost:15
40600:03:47.417 -> event:NextHopChanged router:54(0xd800) nexthop:34(0x8800) old-cost:15 new-cost:13
40700:03:47.889 -> event:CostChanged router:54(0xd800) nexthop:59(0xec00) old-cost:13 new-cost:15
40800:04:20.825 -> event:CostChanged router:54(0xd800) nexthop:59(0xec00) old-cost:11 new-cost:13
40900:04:53.709 -> event:CostChanged router:54(0xd800) nexthop:59(0xec00) old-cost:9 new-cost:11
41000:05:24.877 -> event:CostChanged router:54(0xd800) nexthop:59(0xec00) old-cost:7 new-cost:9
41100:05:52.782 -> event:CostChanged router:54(0xd800) nexthop:59(0xec00) old-cost:5 new-cost:7
41200:06:50.422 -> event:CostChanged router:54(0xd800) nexthop:59(0xec00) old-cost:3 new-cost:5
41300:07:15.493 -> event:NextHopChanged router:54(0xd800) nexthop:59(0xec00) old-cost:1 new-cost:3
41400:09:30.382 -> event:NextHopChanged router:7(0x1c00) nexthop:34(0x8800) old-cost:inf new-cost:3
415Done
416```
417
418### rx
419
420Usage `history rx [list] [<num-entries>]`
421
422Print the IPv6 message RX history in either table or list format. Entries provide same information and follow same format as in `history rxtx` command.
423
424Print the IPv6 message RX history as a table:
425
426```bash
427> history rx
428| Age | Type | Len | Chksum | Sec | Prio | RSS |Dir | Neighb | Radio |
429+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
430| | UDP | 50 | 0xbd26 | no | net | -20 | RX | 0x4800 | 15.4 |
431| 00:00:07.640 | src: [fe80:0:0:0:d03d:d3e7:cc5e:7cd7]:19788 |
432| | dst: [ff02:0:0:0:0:0:0:1]:19788 |
433+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
434| | HopOpts | 44 | 0x0000 | yes | norm | -20 | RX | 0x4800 | 15.4 |
435| 00:00:09.263 | src: [fdde:ad00:beef:0:0:ff:fe00:4800]:0 |
436| | dst: [ff03:0:0:0:0:0:0:2]:0 |
437+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
438| | UDP | 12 | 0x3f7d | yes | net | -20 | RX | 0x4800 | 15.4 |
439| 00:00:09.302 | src: [fdde:ad00:beef:0:0:ff:fe00:4800]:61631 |
440| | dst: [fdde:ad00:beef:0:0:ff:fe00:4801]:61631 |
441+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
442| | ICMP6(EchoReqst) | 16 | 0x942c | yes | norm | -20 | RX | 0x4800 | 15.4 |
443| 00:00:09.304 | src: [fdde:ad00:beef:0:ac09:a16b:3204:dc09]:0 |
444| | dst: [fdde:ad00:beef:0:dc0e:d6b3:f180:b75b]:0 |
445+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
446| | HopOpts | 44 | 0x0000 | yes | norm | -20 | RX | 0x4800 | 15.4 |
447| 00:00:09.304 | src: [fdde:ad00:beef:0:0:ff:fe00:4800]:0 |
448| | dst: [ff03:0:0:0:0:0:0:2]:0 |
449+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
450| | UDP | 50 | 0x2e37 | no | net | -20 | RX | 0x4800 | 15.4 |
451| 00:00:21.622 | src: [fe80:0:0:0:d03d:d3e7:cc5e:7cd7]:19788 |
452| | dst: [ff02:0:0:0:0:0:0:1]:19788 |
453+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
454| | UDP | 50 | 0xe177 | no | net | -20 | RX | 0x4800 | 15.4 |
455| 00:00:26.640 | src: [fe80:0:0:0:d03d:d3e7:cc5e:7cd7]:19788 |
456| | dst: [ff02:0:0:0:0:0:0:1]:19788 |
457+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
458| | UDP | 165 | 0x82ee | yes | net | -20 | RX | 0x4800 | 15.4 |
459| 00:00:30.000 | src: [fe80:0:0:0:d03d:d3e7:cc5e:7cd7]:19788 |
460| | dst: [fe80:0:0:0:a4a5:bbac:a8e:bd07]:19788 |
461+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
462| | UDP | 93 | 0x52df | no | net | -20 | RX | unknwn | 15.4 |
463| 00:00:30.480 | src: [fe80:0:0:0:d03d:d3e7:cc5e:7cd7]:19788 |
464| | dst: [fe80:0:0:0:a4a5:bbac:a8e:bd07]:19788 |
465+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
466| | UDP | 50 | 0x5ccf | no | net | -20 | RX | unknwn | 15.4 |
467| 00:00:30.772 | src: [fe80:0:0:0:d03d:d3e7:cc5e:7cd7]:19788 |
468| | dst: [ff02:0:0:0:0:0:0:1]:19788 |
469Done
470
471```
472
473Print the latest 5 entries of the IPv6 message RX history as a list:
474
475```bash
476> history rx list 4
47700:00:13.368
478 type:UDP len:50 checksum:0xbd26 sec:no prio:net rss:-20 from:0x4800 radio:15.4
479 src:[fe80:0:0:0:d03d:d3e7:cc5e:7cd7]:19788
480 dst:[ff02:0:0:0:0:0:0:1]:19788
48100:00:14.991
482 type:HopOpts len:44 checksum:0x0000 sec:yes prio:norm rss:-20 from:0x4800 radio:15.4
483 src:[fdde:ad00:beef:0:0:ff:fe00:4800]:0
484 dst:[ff03:0:0:0:0:0:0:2]:0
48500:00:15.030
486 type:UDP len:12 checksum:0x3f7d sec:yes prio:net rss:-20 from:0x4800 radio:15.4
487 src:[fdde:ad00:beef:0:0:ff:fe00:4800]:61631
488 dst:[fdde:ad00:beef:0:0:ff:fe00:4801]:61631
48900:00:15.032
490 type:ICMP6(EchoReqst) len:16 checksum:0x942c sec:yes prio:norm rss:-20 from:0x4800 radio:15.4
491 src:[fdde:ad00:beef:0:ac09:a16b:3204:dc09]:0
492 dst:[fdde:ad00:beef:0:dc0e:d6b3:f180:b75b]:0
493Done
494```
495
496### rxtx
497
498Usage `history rxtx [list] [<num-entries>]`
499
500Print the combined IPv6 message RX and TX history in either table or list format. Each entry provides:
501
502- IPv6 message type: UDP, TCP, ICMP6 (and its subtype), etc.
503- IPv6 payload length (excludes the IPv6 header).
504- Source IPv6 address and port number.
505- Destination IPv6 address and port number (port number is valid for UDP/TCP, it is zero otherwise).
506- Whether or not link-layer security was used.
507- Message priority: low, norm, high, net (for Thread control messages).
508- Message checksum (valid for UDP, TCP, or ICMP6 message)
509- RSS: Received Signal Strength (in dBm) - averaged over all received fragment frames that formed the message. For TX history `NA` (not applicable) is used.
510- Whether the message was sent or received (`TX` or `RX`). A failed transmission (e.g., if tx was aborted or no ack from peer for any of the message fragments) is indicated with `TX-F` in the table format or `tx-success:no` in the list format.
511- Short address (RLOC16) of neighbor to/from which the message was sent/received. If the frame is broadcast, it is shown as `bcast` in table format or `0xffff` in the list format. If the short address of neighbor is not available, it is shown as `unknwn` in the table format or `0xfffe` in the list format.
512- Radio link on which the message was sent/received (useful when `OPENTHREAD_CONFIG_MULTI_RADIO` is enabled). Can be `15.4`, `trel`, or `all` (if sent on all radio links).
513
514Print the IPv6 message RX and TX history as a table:
515
516```bash
517> history rxtx
518| Age | Type | Len | Chksum | Sec | Prio | RSS |Dir | Neighb | Radio |
519+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
520| | HopOpts | 44 | 0x0000 | yes | norm | -20 | RX | 0x0800 | 15.4 |
521| 00:00:09.267 | src: [fdde:ad00:beef:0:0:ff:fe00:800]:0 |
522| | dst: [ff03:0:0:0:0:0:0:2]:0 |
523+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
524| | UDP | 12 | 0x6c6b | yes | net | -20 | RX | 0x0800 | 15.4 |
525| 00:00:09.290 | src: [fdde:ad00:beef:0:0:ff:fe00:800]:61631 |
526| | dst: [fdde:ad00:beef:0:0:ff:fe00:801]:61631 |
527+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
528| | ICMP6(EchoReqst) | 16 | 0xc6a2 | yes | norm | -20 | RX | 0x0800 | 15.4 |
529| 00:00:09.292 | src: [fdde:ad00:beef:0:efe8:4910:cf95:dee9]:0 |
530| | dst: [fdde:ad00:beef:0:af4c:3644:882a:3698]:0 |
531+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
532| | ICMP6(EchoReply) | 16 | 0xc5a2 | yes | norm | NA | TX | 0x0800 | 15.4 |
533| 00:00:09.292 | src: [fdde:ad00:beef:0:af4c:3644:882a:3698]:0 |
534| | dst: [fdde:ad00:beef:0:efe8:4910:cf95:dee9]:0 |
535+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
536| | UDP | 50 | 0xaa0d | yes | net | NA | TX | 0x0800 | 15.4 |
537| 00:00:09.294 | src: [fdde:ad00:beef:0:0:ff:fe00:801]:61631 |
538| | dst: [fdde:ad00:beef:0:0:ff:fe00:800]:61631 |
539+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
540| | HopOpts | 44 | 0x0000 | yes | norm | -20 | RX | 0x0800 | 15.4 |
541| 00:00:09.296 | src: [fdde:ad00:beef:0:0:ff:fe00:800]:0 |
542| | dst: [ff03:0:0:0:0:0:0:2]:0 |
543+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
544| | UDP | 50 | 0xc1d8 | no | net | -20 | RX | 0x0800 | 15.4 |
545| 00:00:09.569 | src: [fe80:0:0:0:54d9:5153:ffc6:df26]:19788 |
546| | dst: [ff02:0:0:0:0:0:0:1]:19788 |
547+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
548| | UDP | 50 | 0x3cb1 | no | net | -20 | RX | 0x0800 | 15.4 |
549| 00:00:16.519 | src: [fe80:0:0:0:54d9:5153:ffc6:df26]:19788 |
550| | dst: [ff02:0:0:0:0:0:0:1]:19788 |
551+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
552| | UDP | 50 | 0xeda0 | no | net | -20 | RX | 0x0800 | 15.4 |
553| 00:00:20.599 | src: [fe80:0:0:0:54d9:5153:ffc6:df26]:19788 |
554| | dst: [ff02:0:0:0:0:0:0:1]:19788 |
555+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
556| | UDP | 165 | 0xbdfa | yes | net | -20 | RX | 0x0800 | 15.4 |
557| 00:00:21.059 | src: [fe80:0:0:0:54d9:5153:ffc6:df26]:19788 |
558| | dst: [fe80:0:0:0:8893:c2cc:d983:1e1c]:19788 |
559+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
560| | UDP | 64 | 0x1c11 | no | net | NA | TX | 0x0800 | 15.4 |
561| 00:00:21.062 | src: [fe80:0:0:0:8893:c2cc:d983:1e1c]:19788 |
562| | dst: [fe80:0:0:0:54d9:5153:ffc6:df26]:19788 |
563+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
564| | UDP | 93 | 0xedff | no | net | -20 | RX | unknwn | 15.4 |
565| 00:00:21.474 | src: [fe80:0:0:0:54d9:5153:ffc6:df26]:19788 |
566| | dst: [fe80:0:0:0:8893:c2cc:d983:1e1c]:19788 |
567+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
568| | UDP | 44 | 0xd383 | no | net | NA | TX | bcast | 15.4 |
569| 00:00:21.811 | src: [fe80:0:0:0:8893:c2cc:d983:1e1c]:19788 |
570| | dst: [ff02:0:0:0:0:0:0:2]:19788 |
571Done
572```
573
574Print the latest 5 entries of the IPv6 message RX history as a list:
575
576```bash
577> history rxtx list 5
578
57900:00:02.100
580 type:UDP len:50 checksum:0xd843 sec:no prio:net rss:-20 from:0x0800 radio:15.4
581 src:[fe80:0:0:0:54d9:5153:ffc6:df26]:19788
582 dst:[ff02:0:0:0:0:0:0:1]:19788
58300:00:15.331
584 type:HopOpts len:44 checksum:0x0000 sec:yes prio:norm rss:-20 from:0x0800 radio:15.4
585 src:[fdde:ad00:beef:0:0:ff:fe00:800]:0
586 dst:[ff03:0:0:0:0:0:0:2]:0
58700:00:15.354
588 type:UDP len:12 checksum:0x6c6b sec:yes prio:net rss:-20 from:0x0800 radio:15.4
589 src:[fdde:ad00:beef:0:0:ff:fe00:800]:61631
590 dst:[fdde:ad00:beef:0:0:ff:fe00:801]:61631
59100:00:15.356
592 type:ICMP6(EchoReqst) len:16 checksum:0xc6a2 sec:yes prio:norm rss:-20 from:0x0800 radio:15.4
593 src:[fdde:ad00:beef:0:efe8:4910:cf95:dee9]:0
594 dst:[fdde:ad00:beef:0:af4c:3644:882a:3698]:0
59500:00:15.356
596 type:ICMP6(EchoReply) len:16 checksum:0xc5a2 sec:yes prio:norm tx-success:yes to:0x0800 radio:15.4
597 src:[fdde:ad00:beef:0:af4c:3644:882a:3698]:0
598 dst:[fdde:ad00:beef:0:efe8:4910:cf95:dee9]:0
599```
600
601### tx
602
603Usage `history tx [list] [<num-entries>]`
604
605Print the IPv6 message TX history in either table or list format. Entries provide same information and follow same format as in `history rxtx` command.
606
607Print the IPv6 message TX history as a table (10 latest entries):
608
609```bash
610> history tx
611| Age | Type | Len | Chksum | Sec | Prio | RSS |Dir | Neighb | Radio |
612+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
613| | ICMP6(EchoReply) | 16 | 0x932c | yes | norm | NA | TX | 0x4800 | 15.4 |
614| 00:00:18.798 | src: [fdde:ad00:beef:0:dc0e:d6b3:f180:b75b]:0 |
615| | dst: [fdde:ad00:beef:0:ac09:a16b:3204:dc09]:0 |
616+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
617| | UDP | 50 | 0xce87 | yes | net | NA | TX | 0x4800 | 15.4 |
618| 00:00:18.800 | src: [fdde:ad00:beef:0:0:ff:fe00:4801]:61631 |
619| | dst: [fdde:ad00:beef:0:0:ff:fe00:4800]:61631 |
620+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
621| | UDP | 64 | 0xf7ba | no | net | NA | TX | 0x4800 | 15.4 |
622| 00:00:39.499 | src: [fe80:0:0:0:a4a5:bbac:a8e:bd07]:19788 |
623| | dst: [fe80:0:0:0:d03d:d3e7:cc5e:7cd7]:19788 |
624+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
625| | UDP | 44 | 0x26d4 | no | net | NA | TX | bcast | 15.4 |
626| 00:00:40.256 | src: [fe80:0:0:0:a4a5:bbac:a8e:bd07]:19788 |
627| | dst: [ff02:0:0:0:0:0:0:2]:19788 |
628Done
629```
630
631Print the IPv6 message TX history as a list:
632
633```bash
634history tx list
63500:00:23.957
636 type:ICMP6(EchoReply) len:16 checksum:0x932c sec:yes prio:norm tx-success:yes to:0x4800 radio:15.4
637 src:[fdde:ad00:beef:0:dc0e:d6b3:f180:b75b]:0
638 dst:[fdde:ad00:beef:0:ac09:a16b:3204:dc09]:0
63900:00:23.959
640 type:UDP len:50 checksum:0xce87 sec:yes prio:net tx-success:yes to:0x4800 radio:15.4
641 src:[fdde:ad00:beef:0:0:ff:fe00:4801]:61631
642 dst:[fdde:ad00:beef:0:0:ff:fe00:4800]:61631
64300:00:44.658
644 type:UDP len:64 checksum:0xf7ba sec:no prio:net tx-success:yes to:0x4800 radio:15.4
645 src:[fe80:0:0:0:a4a5:bbac:a8e:bd07]:19788
646 dst:[fe80:0:0:0:d03d:d3e7:cc5e:7cd7]:19788
64700:00:45.415
648 type:UDP len:44 checksum:0x26d4 sec:no prio:net tx-success:yes to:0xffff radio:15.4
649 src:[fe80:0:0:0:a4a5:bbac:a8e:bd07]:19788
650 dst:[ff02:0:0:0:0:0:0:2]:19788
651Done
652```
653
README_JOINER.md
1# OpenThread CLI - Joiner
2
3## Quick Start
4
5See [README_COMMISSIONING.md](README_COMMISSIONING.md).
6
7## Command List
8
9- [help](#help)
10- [discerner](#discerner)
11- [id](#id)
12- [start](#start)
13- [state](#state)
14- [stop](#stop)
15
16## Command Details
17
18### help
19
20Usage: `joiner help`
21
22Print joiner help menu.
23
24```bash
25> joiner help
26help
27id
28start
29state
30stop
31Done
32```
33
34### discerner
35
36Usage: `joiner discerner [discerner]`
37
38Print or set the Joiner Discerner. Note this value takes the place of the place of EUI-64 during the joiner session of Thread commissioning.
39
40- discerner: `clear` to clear discerner, `number/length` to set discerner
41
42```bash
43> joiner discerner 0xabc/12
44Done
45> joiner discerner
460xabc/12
47Done
48> joiner discerner clear
49Done
50```
51
52### id
53
54Usage: `joiner id`
55
56Print the Joiner ID.
57
58```bash
59> joiner id
60d65e64fa83f81cf7
61Done
62```
63
64### start
65
66Usage: `joiner start <pskd> [provisioning-url]`
67
68Start the Joiner role.
69
70- pskd: Pre-Shared Key for the Joiner.
71- provisioning-url: Provisioning URL for the Joiner (optional).
72
73This command will cause the device to start the Joiner process.
74
75```bash
76> joiner start J01NM3
77Done
78```
79
80### state
81
82Usage: `joiner state`
83
84Print the Joiner state.
85
86- Idle
87- Discover
88- Connecting
89- Connected
90- Entrust
91- Joined
92
93```bash
94> joiner state
95Idle
96Done
97```
98
99### stop
100
101Usage: `joiner stop`
102
103Stop the Joiner role.
104
105```bash
106> joiner stop
107Done
108```
109
README_NETDATA.md
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, onrc
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 interface.
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- [full](#full)
146- [length](#length)
147- [maxlength](#maxlength)
148- [publish](#publish)
149- [register](#register)
150- [show](#show)
151- [steeringdata](#steeringdata-check-eui64discerner)
152- [unpublish](#unpublish)
153
154## Command Details
155
156### help
157
158Usage: `netdata help`
159
160Print netdata help menu.
161
162```bash
163> netdata help
164full
165length
166maxlength
167publish
168register
169show
170steeringdata
171unpublish
172Done
173```
174
175### full
176
177Usage: `netdata full`
178
179Print "yes" or "no" flag tracking whether or not the "net data full" callback has been invoked since start of Thread operation or since the last time `netdata full reset` was used to reset the flag.
180
181This command requires `OPENTHREAD_CONFIG_BORDER_ROUTER_SIGNAL_NETWORK_DATA_FULL`.
182
183The "net data full" callback is invoked whenever:
184
185- The device is acting as a leader and receives a Network Data registration from a Border Router (BR) that it cannot add to Network Data (running out of space).
186- The device is acting as a BR and new entries cannot be added to its local Network Data.
187- The device is acting as a BR and tries to register its local Network Data entries with the leader, but determines that its local entries will not fit.
188
189```
190> netdata full
191no
192Done
193```
194
195### full reset
196
197Usage: `netdata full reset`
198
199Reset the flag tracking whether "net data full" callback was invoked.
200
201This command requires `OPENTHREAD_CONFIG_BORDER_ROUTER_SIGNAL_NETWORK_DATA_FULL`.
202
203```
204> netdata full reset
205Done
206```
207
208### length
209
210Usage: `netdata length`
211
212Get the current length of (number of bytes) Partition's Thread Network Data.
213
214```bash
215> netdata length
21623
217Done
218```
219
220### maxlength
221
222Usage: `netdata maxlength`
223
224Get the maximum observed length of the Thread Network Data since OT stack initialization or since the last call to `netdata maxlength reset`.
225
226```bash
227> netdata maxlength
22840
229Done
230```
231
232### maxlength reset
233
234Usage: `netdata maxlength reset`
235
236Reset the tracked maximum length of the Thread Network Data.
237
238```bash
239> netdata maxlength reset
240Done
241```
242
243### publish
244
245The 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.
246
247The Publisher requires `OPENTHREAD_CONFIG_NETDATA_PUBLISHER_ENABLE`.
248
249### publish dnssrp
250
251Publish DNS/SRP service entry.
252
253This command requires `OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE`.
254
255The following formats are available: :
256
257- `netdata publish dnssrp anycast <seq-num> [<version>]` to publish "DNS/SRP Service Anycast Address" with a given sequence number and version.
258- `netdata publish dnssrp unicast <address> <port> [<version>]` to publish "DNS/SRP Service Unicast Address" with given address, port number and version info. The address/port/version info is included in Service TLV data.
259- `netdata publish dnssrp unicast <port> [<version>]` to publish "DNS/SRP Service Unicast Address" with given port number, version, and the device's mesh-local EID for the address. The address/port/version info is included in Server TLV data.
260
261A 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).
262
263```bash
264> netdata publish dnssrp anycast 1 2
265Done
266
267> netdata publish dnssrp unicast fd00::1234 51525 1
268Done
269
270> netdata publish dnssrp unicast 50152 2
271Done
272```
273
274### publish prefix \<prefix\> [padcrosnD][prf]
275
276Publish an on-mesh prefix entry.
277
278- p: Preferred flag
279- a: Stateless IPv6 Address Autoconfiguration flag
280- d: DHCPv6 IPv6 Address Configuration flag
281- c: DHCPv6 Other Configuration flag
282- r: Default Route flag
283- o: On Mesh flag
284- s: Stable flag
285- n: Nd Dns flag
286- D: Domain Prefix flag (only available for Thread 1.2).
287- prf: Preference, which may be 'high', 'med', or 'low'.
288
289```bash
290> netdata publish prefix fd00:1234:5678::/64 paos med
291Done
292```
293
294### publish route \<prefix\> [sn][prf]
295
296Publish an external route entry.
297
298- s: Stable flag
299- n: NAT64 flag
300- a: Advertising PIO (AP) flag
301- prf: Preference, which may be: 'high', 'med', or 'low'.
302
303```bash
304> netdata publish route fd00:1234:5678::/64 s high
305Done
306```
307
308### publish replace \<old prefix\> \<prefix\> [sn][prf]
309
310Replace a previously published external route entry.
311
312If there is no previously published external route matching old prefix, this command behaves similarly to `netdata publish route`. If there is a previously published route entry, it will be replaced with the new prefix. In particular, if the old prefix was already added in the Network Data, the change to the new prefix is immediately reflected in the Network Data (i.e., old prefix is removed and the new prefix is added in the same Network Data registration request to leader). This ensures that route entries in the Network Data are not abruptly removed.
313
314- s: Stable flag
315- n: NAT64 flag
316- a: Advertising PIO (AP) flag
317- prf: Preference, which may be: 'high', 'med', or 'low'.
318
319```bash
320> netdata publish replace ::/0 fd00:1234:5678::/64 s high
321Done
322```
323
324### register
325
326Usage: `netdata register`
327
328Register configured prefixes, routes, and services with the Leader.
329
330```bash
331> netdata register
332Done
333```
334
335### show
336
337Usage: `netdata show [local] [-x] [\<rloc16\>]`
338
339Print entries in Network Data, on-mesh prefixes, external routes, services, and 6LoWPAN context information.
340
341If the optional `rloc16` input is specified, prints the entries associated with the given RLOC16 only. The RLOC16 filtering can be used when `-x` or `local` are not used.
342
343On-mesh prefixes are listed under `Prefixes` header:
344
345- The on-mesh prefix
346- Flags
347 - p: Preferred flag
348 - a: Stateless IPv6 Address Autoconfiguration flag
349 - d: DHCPv6 IPv6 Address Configuration flag
350 - c: DHCPv6 Other Configuration flag
351 - r: Default Route flag
352 - o: On Mesh flag
353 - s: Stable flag
354 - n: Nd Dns flag
355 - D: Domain Prefix flag (only available for Thread 1.2).
356- Preference `high`, `med`, or `low`
357- RLOC16 of device which added the on-mesh prefix
358
359External Routes are listed under `Routes` header:
360
361- The route prefix
362- Flags
363 - s: Stable flag
364 - n: NAT64 flag
365 - a: Advertising PIO (AP) flag
366- Preference `high`, `med`, or `low`
367- RLOC16 of device which added the route prefix
368
369Service entries are listed under `Services` header:
370
371- Enterprise number
372- Service data (as hex bytes)
373- Server data (as hex bytes)
374- Flags
375 - s: Stable flag
376- RLOC16 of devices which added the service entry
377- Service ID
378
3796LoWPAN Context IDs are listed under `Contexts` header:
380
381- The prefix
382- Context ID
383- Compress flag (`c` if marked or `-` otherwise).
384
385Commissioning Dataset information is printed under `Commissioning` header:
386
387- Session ID if present in Dataset or `-` otherwise
388- Border Agent RLOC16 (in hex) if present in Dataset or `-` otherwise
389- Joiner UDP port number if present in Dataset or `-` otherwise
390- Steering Data (as hex bytes) if present in Dataset or `-` otherwise
391- Flags:
392 - e: if Dataset contains any extra unknown TLV
393
394Print Network Data received from the Leader.
395
396```bash
397> netdata show
398Prefixes:
399fd00:dead:beef:cafe::/64 paros med a000
400Routes:
401fd00:1234:0:0::/64 s med a000
402fd00:4567:0:0::/64 s med 8000
403Services:
40444970 5d fddead00beef00007bad0069ce45948504d2 s a000 0
405Contexts:
406fd00:dead:beef:cafe::/64 1 c
407Commissioning:
4081248 dc00 9988 00000000000120000000000000000000 e
409Done
410```
411
412Print Network Data entries from the Leader associated with `0xa00` RLOC16.
413
414```bash
415> netdata show 0xa00
416Prefixes:
417fd00:dead:beef:cafe::/64 paros med a000
418Routes:
419fd00:1234:0:0::/64 s med a000
420Services:
42144970 5d fddead00beef00007bad0069ce45948504d2 s a000 0
422Done
423```
424
425Print Network Data received from the Leader as hex-encoded TLVs.
426
427```bash
428> netdata show -x
42908040b02174703140040fd00deadbeefcafe0504dc00330007021140
430Done
431```
432
433Print local Network Data to sync with Leader.
434
435```bash
436> netdata show local
437Prefixes:
438fd00:dead:beef:cafe::/64 paros med dc00
439Routes:
440Services:
441Done
442```
443
444Print local Network Data to sync with Leader as hex-encoded TLVs.
445
446```bash
447> netdata show local -x
44808040b02174703140040fd00deadbeefcafe0504dc00330007021140
449Done
450```
451
452### netdata steeringdata check \<eui64\>|\<discerner\>
453
454Check whether the steering data includes a joiner.
455
456- eui64: The IEEE EUI-64 of the Joiner.
457- discerner: The Joiner discerner in format `number/length`.
458
459```bash
460> netdata steeringdata check d45e64fa83f81cf7
461Done
462> netdata steeringdata check 0xabc/12
463Done
464> netdata steeringdata check 0xdef/12
465Error 23: NotFound
466```
467
468### unpublish
469
470This command unpublishes a previously published Network Data entry.
471
472This command requires `OPENTHREAD_CONFIG_NETDATA_PUBLISHER_ENABLE`.
473
474### unpublish dnssrp
475
476Unpublishes DNS/SRP Service entry (available when `OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE` is enabled):
477
478- `netdata unpublish dnssrp` to unpublish "DNS/SRP Service" entry (anycast or unciast).
479
480```bash
481> netdata unpublish dnssrp
482Done
483```
484
485### unpublish \<prefix\>
486
487Unpublishes a previously published on-mesh prefix or external route entry.
488
489```bash
490> netdata unpublish fd00:1234:5678::/64
491Done
492```
493
README_SRP.md
1# OpenThread CLI - SRP (Service Registration Protocol)
2
3## Quick Start
4
5### Start SRP Server
6
7Start the SRP Server node:
8
9```bash
10./output/simulation/bin/ot-cli-ftd 1
11```
12
13Setup a Thread network and start the SRP Server:
14
15```bash
16> dataset init new
17Done
18> dataset
19Active Timestamp: 1
20Channel: 22
21Channel Mask: 0x07fff800
22Ext PAN ID: 8d6ed7a05a28fb3b
23Mesh Local Prefix: fded:5114:8263:1fe1::/64
24Network Key: 7fcbae4153cc2955c28440c15d4d4219
25Network Name: OpenThread-f7af
26PAN ID: 0xf7af
27PSKc: b658e40f174e3a11be149b302ef07a0f
28Security Policy: 672, onrc
29Done
30> dataset commit active
31Done
32> ifconfig up
33Done
34> thread start
35Done
36> state
37leader
38Done
39>ipaddr
40fded:5114:8263:1fe1:0:ff:fe00:fc00
41fded:5114:8263:1fe1:0:ff:fe00:c000
42fded:5114:8263:1fe1:68bc:ec03:c1ad:9325
43fe80:0:0:0:a8cd:6e23:df3d:4193
44Done
45> srp server enable
46Done
47```
48
49### Start SRP Client
50
51Start the SRP Client node:
52
53```bash
54./output/simulation/bin/ot-cli-ftd 2
55```
56
57Join the Thread Network and register a `_ipps._tcp` service:
58
59```bash
60> dataset networkkey 7fcbae4153cc2955c28440c15d4d4219
61Done
62> dataset commit active
63Done
64> ifconfig up
65Done
66> thread start
67Done
68> state
69child
70Done
71> ipaddr
72fded:5114:8263:1fe1:0:ff:fe00:c001
73fded:5114:8263:1fe1:44f9:cc06:4a2d:534
74fe80:0:0:0:38dd:fdf7:5fd:24e
75Done
76> srp client host name my-host
77Done
78> srp client host address fded:5114:8263:1fe1:44f9:cc06:4a2d:534
79Done
80> srp client service add my-service _ipps._tcp 12345
81Done
82> srp client autostart enable
83Done
84```
85
86The last command enables the auto-start mode on the client which then monitors the network data to discover available SRP servers within the Thread network and automatically starts the client.
87
88Alternatively, the client can be started manually using the `srp client start`.
89
90The SRP Server listening UDP port (which is `c002`(`49154`) in the example below) can be found from the Server Data (listed by the `netdata show` command).
91
92Make sure the SRP Server address & port are used for the `srp client start` command.
93
94```bash
95> netdata show
96Prefixes:
97Routes:
98Services:
9944970 5d c002 s 8400
100Done
101> srp client start fded:5114:8263:1fe1:68bc:ec03:c1ad:9325 49154
102Done
103```
104
105### Verify the service status
106
107Check if the host and service has been successfully registered on the client node:
108
109```bash
110> srp client host
111name:"my-host", state:Registered, addrs:[fded:5114:8263:1fe1:44f9:cc06:4a2d:534]
112Done
113> srp client service
114instance:"my-service", name:"_ipps._tcp", state:Registered, port:12345, priority:0, weight:0
115Done
116```
117
118Make sure it shows `state:Registered` for both host and service commands.
119
120Check the host & service on the server node:
121
122```bash
123> srp server host
124my-host.default.service.arpa.
125 deleted: false
126 addresses: [fded:5114:8263:1fe1:44f9:cc06:4a2d:534]
127Done
128> srp server service
129my-service._ipps._tcp.default.service.arpa.
130 deleted: false
131 port: 12345
132 priority: 0
133 weight: 0
134 ttl: 7200
135 lease: 7200
136 key-lease: 1209600
137 TXT: []
138 host: my-host.default.service.arpa.
139 addresses: [fded:5114:8263:1fe1:44f9:cc06:4a2d:534]
140Done
141```
142
143Make sure it shows `deleted: false` for both host and service commands.
144
145### Remove the service
146
147A service can be removed through the client node:
148
149```bash
150> srp client service remove my-service _ipps._tcp
151Done
152```
153
154Confirm on the server node that the service has been removed:
155
156```bash
157> srp server service
158my-service._ipps._tcp.default.service.arpa.
159 deleted: true
160Done
161```
162
163The service entry is listed because the name of service is not removed.
164
165### Remove the host and service names
166
167A host and service, along with their names, can be removed through the client node:
168
169```bash
170> srp client host remove 1
171Done
172```
173
174Confirm on the server node that no host or service entries are listed:
175
176```bash
177> srp server host
178Done
179> srp server service
180Done
181>
182```
183
184## CLI Reference
185
186- [SRP Client CLI Reference](README_SRP_CLIENT.md)
187- [SRP Server CLI Reference](README_SRP_SERVER.md)
188
README_SRP_CLIENT.md
1# OpenThread CLI - SRP Client
2
3## Command List
4
5Usage : `srp client [command] ...`
6
7- [help](#help)
8- [autostart](#autostart)
9- [callback](#callback)
10- [host](#host)
11- [keyleaseinterval](#keyleaseinterval)
12- [leaseinterval](#leaseinterval)
13- [server](#server)
14- [service](#service)
15- [start](#start)
16- [state](#state)
17- [stop](#stop)
18- [ttl](#ttl)
19
20## Command Details
21
22### help
23
24Usage: `srp client help`
25
26Print SRP client help menu.
27
28```bash
29> srp client help
30autostart
31callback
32help
33host
34keyleaseinterval
35leaseinterval
36service
37start
38state
39stop
40ttl
41Done
42```
43
44### autostart
45
46Usage `srp client autostart [enable|disable]`
47
48Enable/Disable auto start mode in SRP client. This command requires `OPENTHREAD_CONFIG_SRP_CLIENT_AUTO_START_API_ENABLE` feature to be enabled.
49
50Get the current autostart mode.
51
52```bash
53> srp client autostart
54Disabled
55Done
56```
57
58Set the autostart mode.
59
60```bash
61> srp client autostart enable
62Done
63
64> srp client autostart
65Enabled
66Done
67```
68
69### callback
70
71Usage `srp client callback [enable|disable]`
72
73Enable/Disable printing callback events from SRP client.
74
75Get current callback mode
76
77```bash
78> srp client callback
79Disabled
80Done
81```
82
83Set callback mode
84
85```bash
86> srp client callback enable
87Done
88
89> srp client callback
90Enabled
91Done
92```
93
94#### Example
95
96When two services are successfully registered:
97
98```bash
99SRP client callback - error:OK
100Host info:
101 name:"dev4312", state:Registered, addrs:[fd00:0:0:0:0:0:0:1]
102Service list:
103 instance:"ins2", name:"_test2._udp", state:Registered, port:111, priority:1, weight:1
104 instance:"ins1", name:"_test1._udp,_sub1,_sub2", state:Registered, port:777, priority:0, weight:0
105```
106
107When service `ins2` is removed:
108
109```bash
110SRP client callback - error:OK
111Host info:
112 name:"dev4312", state:Registered, addrs:[fd00:0:0:0:0:0:0:1]
113Service list:
114 instance:"ins1", name:"_test1._udp", state:Registered, port:777, priority:0, weight:0
115Removed service list:
116 instance:"ins2", name:"_test2._udp,_sub1,_sub2", state:Removed, port:111, priority:1, weight:1
117```
118
119When host info (and all services) is removed:
120
121```bash
122SRP client callback - error:OK
123Host info:
124 name:"dev4312", state:Removed, addrs:[fd00:0:0:0:0:0:0:1]
125Service list:
126Removed service list:
127 instance:"ins1", name:"_test1._udp", state:Removed, port:777, priority:0, weight:0
128```
129
130### host
131
132Usage: `srp client host`
133
134Print the full host info (host name, state, list of host addresses).
135
136```bash
137> srp client host
138name:"dev4312", state:Registered, addrs:[fd00:0:0:0:0:0:0:1234, fd00:0:0:0:0:0:0:beef]
139Done
140```
141
142When auto host address mode is enabled.
143
144```bash
145srp client host
146name:"dev1234", state:Registered, addrs:auto
147Done
148```
149
150### host name
151
152Usage: `srp client host name [name]`
153
154Get the host name.
155
156```bash
157> srp client host name
158dev4312
159Done
160```
161
162Set host name (can be set when the host is removed or not yet registered with server).
163
164```bash
165srp client host name dev4312
166Done
167```
168
169### host address
170
171Usage : `srp client host address [auto | <address> ...]`
172
173Indicate auto address mode is enabled.
174
175```bash
176> srp client host address
177auto
178Done
179```
180
181Get the list of host addresses (when auto host address is not enabled).
182
183```bash
184> srp client host address
185fd00:0:0:0:0:0:0:1234
186fd00:0:0:0:0:0:0:beef
187Done
188```
189
190Enable auto host address mode. When enabled client will automatically use all preferred Thread netif unicast addresses excluding all link-local and mesh-local addresses. If there is no preferred address, then Mesh Local EID address is added. SRP client will automatically re-register if/when addresses on Thread netif get changed (e.g., new address is added or existing address is removed or marked as non-preferred).
191
192```bash
193> srp client host address auto
194Done
195```
196
197Explicitly set the list of host addresses (can be set while client is running to update the host addresses), also disabled auto host address mode.
198
199```bash
200> srp client host address fd00::cafe
201Done
202```
203
204### host state
205
206Usage: `srp client host state`
207
208Get the host state.
209
210```bash
211> srp client host state
212Registered
213Done
214```
215
216The possible states are (same value for service state):
217
218- `ToAdd`: item to be added/registered.
219- `Adding`: item is being added/registered.
220- `ToRefresh`: item to be refreshed (renew lease).
221- `Refreshing`: item is being refreshed.
222- `ToRemove`: item to be removed.
223- `Removing`: item is being removed.
224- `Registered`: item is registered with server.
225- `Removed`: item is removed.
226
227### host remove
228
229Usage: `srp client host remove [removekeylease] [sendunregtoserver]`
230
231Remove host info and all services from server.
232
233- `removekeylease` is an optional boolean value indicating whether or not the host key lease should also be removed (default is false).
234- `sendunregtoserver` is a another optional boolean value indicating whether or not to send an update message to the server when host info is not yet registered (default is false).
235
236```bash
237> srp client host remove 1
238Done
239```
240
241### host clear
242
243Usage: `srp client host clear`
244
245Clear host info and all services on client (unlike `host remove`, with `host clear` no update is sent to server).
246
247```bash
248> srp client host clear
249Done
250```
251
252### keyleaseinterval
253
254Usage: `srp client keyleaseinterval [interval]`
255
256Get the key lease interval (in seconds).
257
258```bash
259> srp client keyleaseinterval
2601209600
261Done
262>
263```
264
265Set the key lease interval.
266
267```bash
268> srp client keyleaseinterval 864000
269Done
270```
271
272### leaseinterval
273
274Usage: `srp client leaseinterval [interval]`
275
276Get the lease interval (in seconds).
277
278```bash
279> srp client leaseinterval
2807200
281Done
282>
283```
284
285Set the lease interval.
286
287```bash
288> srp client leaseinterval 3600
289Done
290```
291
292### server
293
294Usage: `srp client server`
295
296Print the server socket address (IPv6 address and port number).
297
298```bash
299> srp client server
300[fd00:0:0:0:d88a:618b:384d:e760]:4724
301Done
302```
303
304### server address
305
306Print the server IPv6 address.
307
308```bash
309> srp client server address
310fd00:0:0:0:d88a:618b:384d:e760
311Done
312```
313
314### server port
315
316Print the server port number
317
318```bash
319> srp client server port
3204724
321Done
322```
323
324### service
325
326Usage: `srp client service`
327
328Print the list of services.
329
330```bash
331> srp client service
332instance:"ins2", name:"_test2._udp,_sub1,_sub2", state:Registered, port:111, priority:1, weight:1
333instance:"ins1", name:"_test1._udp", state:Registered, port:777, priority:0, weight:0
334Done
335```
336
337### service add
338
339Usage: `srp client service add <instancename> <servicename> <port> [priority] [weight] [txt]`
340
341Add a service with a given instance name, service name, port number, priority, weight and txt values.
342
343The `<servicename>` can optionally include a list of service subtype labels separated by comma.
344
345The priority and weight are optional and if not provided zero will be used. The txt should follow hex-string format and is treated as an already encoded TXT data byte sequence. It is also optional and if not provided it is considered empty.
346
347```bash
348> srp client service add ins1 _test1._udp 777
349Done
350
351> srp client service add ins2 _test2._udp,_sub1,_sub2 111 1 1
352Done
353```
354
355### service remove
356
357Usage: `srp client service remove <instancename> <servicename>`
358
359Remove a service with a give instance name and service name.
360
361```bash
362> srp client service remove ins2 _test2._udp
363Done
364```
365
366### service clear
367
368Usage: `srp client service clear <instancename> <servicename>`
369
370Clear a service with a give instance name and service name (unlike `service remove`, with `service clear` no update is sent to server and the entry is immediately removed from client list).
371
372```bash
373> srp client service clear ins2 _test2._udp
374Done
375```
376
377### service key
378
379Usage `srp client service key [enable|disable]`
380
381Enable/Disable "service key record inclusion" mode in SRP client. This command requires `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` feature to be enabled.
382
383KEY record is optional in Service Description Instruction (it is required and always included in the Host Description Instruction). The default behavior of SRP client is to not include it. This command is intended to override the default behavior for testing only (in a `REFERENCE_DEVICE` build).
384
385Get the current "service key record inclusion" mode.
386
387```bash
388> srp client service key
389Disabled
390Done
391```
392
393Set the "service key record inclusion" mode.
394
395```bash
396> srp client service key enable
397Done
398
399> srp client service key
400Enabled
401Done
402```
403
404### start
405
406Usage: `srp client start <serveraddr> <serverport>`
407
408Start the SRP client with a given server IPv6 address and port number.
409
410```bash
411> srp client start fd00::d88a:618b:384d:e760 4724
412Done
413```
414
415### state
416
417Usage: `srp client state`
418
419Indicates the state of SRP client, i.e., whether it is enabled or disabled.
420
421```bash
422> srp client state
423Enabled
424Done
425```
426
427### stop
428
429Usage: `srp client stop`
430
431Stop the SRP client.
432
433```bash
434> srp client stop
435Done
436```
437
438### ttl
439
440Usage: `srp client ttl [value]`
441
442Get the TTL (in seconds).
443
444```bash
445> srp client ttl
4467200
447Done
448>
449```
450
451Set the TTL.
452
453```bash
454> srp client ttl 3600
455Done
456```
457
README_SRP_SERVER.md
1# OpenThread CLI - SRP Server
2
3## Quick Start
4
5See [README_SRP.md](README_SRP.md).
6
7## Command List
8
9- [help](#help)
10- [addrmode](#addrmode)
11- [auto](#auto)
12- [disable](#disable)
13- [domain](#domain)
14- [enable](#enable)
15- [host](#host)
16- [lease](#lease)
17- [seqnum](#seqnum)
18- [service](#service)
19- [state](#state)
20
21## Command Details
22
23### help
24
25Usage: `srp server help`
26
27Print SRP server help menu.
28
29```bash
30> srp server help
31addrmode
32auto
33disable
34domain
35enable
36help
37host
38lease
39seqnum
40service
41state
42Done
43```
44
45### addrmode
46
47Usage: `srp server addrmode [unicast|anycast]`
48
49Get or set the address mode used by the SRP server.
50
51Address mode specifies how the address and port number are determined by the SRP server and this is published in the Thread Network Data.
52
53Get the address mode.
54
55```bash
56> srp server addrmode
57unicast
58Done
59```
60
61Set the address mode.
62
63```bash
64> srp server addrmode anycast
65Done
66
67> srp server addrmode
68anycast
69Done
70```
71
72### auto
73
74Usage: `srp server auto [enable|disable]`
75
76Enables or disables the auto-enable mode on the SRP server.
77
78When this mode is enabled, the Border Routing Manager controls if and when to enable or disable the SRP server.
79
80This command requires that `OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE` be enabled.
81
82```bash
83> srp server auto enable
84Done
85
86> srp server auto
87Enabled
88Done
89```
90
91### disable
92
93Usage: `srp server disable`
94
95Disable the SRP server.
96
97```bash
98> srp server disable
99Done
100```
101
102### domain
103
104Usage: `srp server domain [domain-name]`
105
106Get the domain.
107
108```bash
109> srp server domain
110default.service.arpa.
111Done
112```
113
114Set the domain.
115
116```bash
117> srp server domain thread.service.arpa.
118Done
119```
120
121### enable
122
123Usage: `srp server enable`
124
125Enable the SRP server.
126
127```bash
128> srp server enable
129Done
130```
131
132### host
133
134Usage: `srp server host`
135
136Print information of all registered hosts.
137
138```bash
139> srp server host
140srp-api-test-1.default.service.arpa.
141 deleted: false
142 addresses: [fdde:ad00:beef:0:0:ff:fe00:fc10]
143srp-api-test-0.default.service.arpa.
144 deleted: false
145 addresses: [fdde:ad00:beef:0:0:ff:fe00:fc10]
146Done
147```
148
149### lease
150
151Usage: `srp server lease [<min-lease>] [<max-lease>] [<min-key-lease>] [<max-key-lease>]`
152
153Get LEASE and KEY-LEASE values.
154
155```bash
156> srp server lease
157min lease: 1800
158max lease: 7200
159min key-lease: 86400
160max key-lease: 1209600
161Done
162```
163
164Set LEASE and KEY-LEASE values.
165
166```bash
167> srp server lease 1800 7200 86400 1209600
168Done
169```
170
171### seqnum
172
173Usage: `srp server seqnum [<seqnum>]`
174
175Get or set the sequence number used with anycast address mode.
176
177The sequence number is included in "DNS/SRP Service Anycast Address" entry published in the Network Data.
178
179```bash
180> srp server seqnum 20
181Done
182
183> srp server seqnum
18420
185Done
186```
187
188### service
189
190Usage: `srp server service`
191
192Print information of all registered services.
193
194The TXT record is displayed as an array of entries. If an entry has a key, the key will be printed in ASCII format. The value portion will always be printed as hex bytes.
195
196```bash
197> srp server service
198srp-api-test-1._ipps._tcp.default.service.arpa.
199 deleted: false
200 subtypes: (null)
201 port: 49152
202 priority: 0
203 weight: 0
204 ttl: 7200
205 lease: 7200
206 key-lease: 1209600
207 TXT: [616263, xyz=585960]
208 host: srp-api-test-1.default.service.arpa.
209 addresses: [fdde:ad00:beef:0:0:ff:fe00:fc10]
210srp-api-test-0._ipps._tcp.default.service.arpa.
211 deleted: false
212 subtypes: _sub1,_sub2
213 port: 49152
214 priority: 0
215 weight: 0
216 ttl: 3600
217 lease: 3600
218 key-lease: 1209600
219 TXT: [616263, xyz=585960]
220 host: srp-api-test-0.default.service.arpa.
221 addresses: [fdde:ad00:beef:0:0:ff:fe00:fc10]
222Done
223```
224
225### state
226
227Usage: `srp server state`
228
229Print the state of the SRP server. It could be `disabled`, `stopped` or `running`.
230
231- disabled: The SRP server is not enabled.
232- stopped: The SRP server is enabled but not active due to existing SRP servers already active in the Thread network. The SRP server may become active when existing SRP servers are no longer active within the Thread network.
233- running: The SRP server is active and will handle service registrations.
234
235```bash
236> srp server state
237running
238Done
239```
240
README_TCAT.md
1# OpenThread CLI - TCAT Example
2
3## Command List
4
5- advid [#advid]
6- devid [#devid]
7- help [#help]
8- start [#start]
9- stop [#stop]
10
11### advid
12
13Displays currently set TCAT advertised ids.
14
15```bash
16tcat advid
17type oui24, value: f378aa
18Done
19```
20
21### advid ianapen \<id\>
22
23Sets TCAT advertised ianapen id.
24
25```bash
26tcat advid ianapen f378aabb
27Done
28```
29
30### advid oui24 \<id\>
31
32Sets TCAT advertised oui24 id.
33
34```bash
35tcat advid oui24 f378aa
36Done
37```
38
39### advid oui36 \<id\>
40
41Sets TCAT advertised oui36 id.
42
43```bash
44tcat advid oui36 f378aabbcc
45Done
46```
47
48### advid discriminator \<id\>
49
50Sets TCAT advertised discriminator id.
51
52```bash
53tcat advid discriminator f378aabbdd
54Done
55```
56
57### advid clear
58
59Clears TCAT advertised id.
60
61```bash
62tcat advid clear
63Done
64```
65
66### devid
67
68Displays currently set TCAT device id.
69
70```bash
71tcat devid
72abcd
73Done
74```
75
76### devid \<id\>
77
78Sets TCAT device id.
79
80```bash
81tcat devid abcd
82Done
83```
84
85### devid clear
86
87Clears TCAT device id.
88
89```bash
90tcat devid clear
91Done
92```
93
94### help
95
96print help
97
98```bash
99tcat help
100advid
101devid
102help
103start
104stop
105Done
106```
107
108### start
109
110Start tcat server and ble advertisement.
111
112```bash
113tcat start
114Done
115```
116
117### stop
118
119Stop tcat server and ble advertisement.
120
121```bash
122tcat stop
123Done
124```
125
README_TCP.md
1# OpenThread CLI - TCP Example
2
3The OpenThread TCP APIs may be invoked via the OpenThread CLI.
4
5## Quick Start
6
7### Form Network
8
9Form a network with at least two devices.
10
11### Node 1
12
13On node 1, initialize the TCP CLI module and listen for incoming connections using the example TCP listener.
14
15```bash
16> tcp init
17> tcp listen :: 30000
18```
19
20The `::` specifies the IPv6 Unspecified Address.
21
22### Node 2
23
24On node 2, initialize the TCP CLI module, connect to node 1, and send a simple message.
25
26```bash
27> tcp init
28> tcp connect fe80:0:0:0:a8df:580a:860:ffa4 30000
29> tcp send hello
30```
31
32### Result
33
34After running the `tcp connect` command on node 2, you should see a printout on node 2 similar to below:
35
36```bash
37TCP: Connection established
38```
39
40In addition, you should also see a printout on node 1 similar to below:
41
42```bash
43Accepted connection from [fe80:0:0:0:8f3:f602:bf9b:52f2]:49152
44TCP: Connection established
45```
46
47After running the `tcp send` command on node 2, you should see a printout on node 1 similar to below:
48
49```bash
50TCP: Received 5 bytes: hello
51```
52
53For a more in-depth example, see [this video](https://youtu.be/ppZ784YUKlI).
54
55## Command List
56
57- [help](#help)
58- [init](#init-size)
59- [deinit](#deinit)
60- [bind](#bind-ip-port)
61- [connect](#connect-ip-port-fastopen)
62- [send](#send-message)
63- [benchmark](#benchmark-run-size)
64- [sendend](#sendend)
65- [abort](#abort)
66- [listen](#listen-ip-port)
67- [stoplistening](#stoplistening)
68
69## Command Details
70
71### abort
72
73Unceremoniously ends the TCP connection, if one exists, associated with the example TCP endpoint, transitioning the TCP endpoint to the closed state.
74
75```bash
76> tcp abort
77TCP: Connection reset
78Done
79```
80
81### benchmark run [\<size\>]
82
83Transfers the specified number of bytes using the TCP connection currently associated with the example TCP endpoint (this TCP connection must be established before using this command).
84
85- size: the number of bytes to send for the benchmark. If it is left unspecified, the default size is used.
86
87```bash
88> tcp benchmark run
89Done
90TCP Benchmark Complete: Transferred 73728 bytes in 7233 milliseconds
91TCP Goodput: 81.546 kb/s
92```
93
94### benchmark result
95
96Get the last result of TCP benchmark. If the benchmark is ongoing, it will show that benchmark is ongoing. This command is used for test scripts which automate the tcp benchmark test.
97
98```
99> tcp benchmark result
100TCP Benchmark Status: Ongoing
101Done
102
103> tcp benchmark result
104TCP Benchmark Status: Completed
105TCP Benchmark Complete: Transferred 73728 bytes in 7056 milliseconds
106TCP Goodput: 83.592 kb/s
107```
108
109### bind \<ip\> \<port\>
110
111Associates a name (i.e. IPv6 address and port) to the example TCP endpoint.
112
113- ip: the IPv6 address or the unspecified IPv6 address (`::`).
114- port: the TCP port.
115
116```bash
117> tcp bind :: 30000
118Done
119```
120
121### connect \<ip\> \<port\> [\<fastopen\>]
122
123Establishes a connection with the specified peer.
124
125If the connection establishment is successful, the resulting TCP connection is associated with the example TCP endpoint.
126
127- ip: the peer's IP address.
128- port: the peer's TCP port.
129- fastopen: if "fast", TCP Fast Open is enabled for this connection; if "slow", it is not. Defaults to "slow".
130
131```bash
132> tcp connect fe80:0:0:0:a8df:580a:860:ffa4 30000
133Done
134TCP: Connection established
135```
136
137The address can be an IPv4 address, which will be synthesized to an IPv6 address using the preferred NAT64 prefix from the network data.
138
139> Note: The command will return `InvalidState` when the preferred NAT64 prefix is unavailable.
140
141```bash
142> tcp connect 172.17.0.1 1234
143Connecting to synthesized IPv6 address: fdde:ad00:beef:2:0:0:ac11:1
144Done
145```
146
147### deinit
148
149Deinitializes the example TCP listener and the example TCP endpoint.
150
151```bash
152> tcp deinit
153Done
154```
155
156### help
157
158List the TCP CLI commands.
159
160```bash
161> tcp help
162abort
163benchmark
164bind
165connect
166deinit
167help
168init
169listen
170send-message
171sendend
172stoplistening
173Done
174```
175
176### init [\<mode\>] [\<size\>]
177
178Initializes the example TCP listener and the example TCP endpoint.
179
180- mode: this specifies the buffering strategy and whether to use TLS. The possible values are "linked", "circular" (default), and "tls".
181- size: the size of the receive buffer to associate with the example TCP endpoint. If left unspecified, the maximum size is used.
182
183If "tls" is used, then the TLS protocol will be used for the connection (on top of TCP). When communicating over TCP between two nodes, either both should use TLS or neither should (a non-TLS endpoint cannot communicate with a TLS endpoint). The first two options, "linked" and "circular", specify that TLS should not be used and specify a buffering strategy to use with TCP; two endpoints of a TCP connection may use different buffering strategies.
184
185The behaviors of "linked" and "circular" buffering are identical, but the option is provided so that users of TCP can inspect the code to see an example of using the two buffering strategies.
186
187```bash
188> tcp init tls
189Done
190```
191
192### listen \<ip\> \<port\>
193
194Uses the example TCP listener to listen for incoming connections on the specified name (i.e. IPv6 address and port).
195
196If no TCP connection is associated with the example TCP endpoint, then any incoming connections matching the specified name are accepted and associated with the example TCP endpoint.
197
198- ip: the IPv6 address or the unspecified IPv6 address (`::`).
199- port: the TCP port.
200
201```bash
202> tcp listen :: 30000
203Done
204```
205
206### send \<message\>
207
208Send data over the TCP connection associated with the example TCP endpoint.
209
210- message: the message to send.
211
212```bash
213> tcp send hello
214Done
215```
216
217### sendend
218
219Sends the "end of stream" signal (i.e., FIN segment) over the TCP connection associated with the example TCP endpoint. This promises the peer that no more data will be sent to it over this TCP connection.
220
221```bash
222> tcp sendend
223Done
224```
225
226### stoplistening
227
228Stops listening for incoming TCP connections using the example TCP listener.
229
230```bash
231> tcp stoplistening
232Done
233```
234
README_UDP.md
1# OpenThread CLI - UDP Example
2
3The OpenThread UDP APIs may be invoked via the OpenThread CLI.
4
5## Quick Start
6
7### Form Network
8
9Form a network with at least two devices.
10
11### Node 1
12
13On node 1, open and bind the example UDP socket.
14
15```bash
16> udp open
17> udp bind :: 1234
18```
19
20The `::` specifies the IPv6 Unspecified Address.
21
22### Node 2
23
24On node 2, open the example UDP socket and send a simple message.
25
26```bash
27> udp open
28> udp send fdde:ad00:beef:0:bb1:ebd6:ad10:f33 1234 hello
29```
30
31### Result
32
33On node 1, you should see a print out similar to below:
34
35```bash
365 bytes from fdde:ad00:beef:0:dac3:6792:e2e:90d8 49153 hello
37```
38
39## Command List
40
41- [help](#help)
42- [bind](#bind-netif-ip-port)
43- [close](#close)
44- [connect](#connect-ip-port)
45- [linksecurity](#linksecurity)
46- [open](#open)
47- [send](#send-ip-port-message)
48
49## Command Details
50
51### help
52
53List the UDP CLI commands.
54
55```bash
56> udp help
57help
58bind
59close
60connect
61open
62send
63Done
64```
65
66### bind [netif] \<ip\> \<port\>
67
68Assigns a name (i.e. IPv6 address and port) to the example socket.
69
70- netif: the network interface to bind to.
71 - not specified: Thread network interface.
72 - `-u`: unspecified network interface.
73 - `-b`: Backbone network interface.
74- ip: the unicast IPv6 address or the unspecified IPv6 address (`::`).
75- port: the UDP port
76
77```bash
78> udp bind :: 1234
79Done
80> udp bind -u :: 1234
81Done
82> udp bind -b :: 1234
83Done
84```
85
86> Note: to receive datagrams sent to a multicast IPv6 address, the unspecified IPv6 address must be used. Using a multicast address for the \<ip\> argument is not supported. Also, the node must subscribe to the multicast group using `ipmaddr add` before it can receive UDP multicast.
87
88### close
89
90Closes the example socket.
91
92```bash
93> udp close
94Done
95```
96
97### connect \<ip\> \<port\>
98
99Specifies the peer with which the socket is to be associated.
100
101- ip: the peer's IP address.
102- port: the peer's UDP port.
103
104```bash
105> udp connect fdde:ad00:beef:0:bb1:ebd6:ad10:f33 1234
106Done
107```
108
109The address can be an IPv4 address, which will be synthesized to an IPv6 address using the preferred NAT64 prefix from the network data.
110
111> Note: The command will return `InvalidState` when the preferred NAT64 prefix is unavailable.
112
113```bash
114> udp connect 172.17.0.1 1234
115Connecting to synthesized IPv6 address: fdde:ad00:beef:2:0:0:ac11:1
116Done
117```
118
119### linksecurity
120
121Indicates whether the link security is enabled or disabled.
122
123```bash
124> udp linksecurity
125Enabled
126Done
127```
128
129### linksecurity enable
130
131Enable link security.
132
133```bash
134> udp linksecurity enable
135Done
136```
137
138### linksecurity disable
139
140Disable link security.
141
142```bash
143> udp linksecurity disable
144Done
145```
146
147### open
148
149Opens the example socket.
150
151```bash
152> udp open
153Done
154```
155
156### send \<ip\> \<port\> \<message\>
157
158Send a UDP message.
159
160- ip: the destination address.
161- port: the UDP destination port.
162- message: the message to send.
163
164```bash
165> udp send fdde:ad00:beef:0:bb1:ebd6:ad10:f33 1234 hello
166Done
167```
168
169The address can be an IPv4 address, which will be synthesized to an IPv6 address using the preferred NAT64 prefix from the network data.
170
171> Note: The command will return `InvalidState` when the preferred NAT64 prefix is unavailable.
172
173```bash
174> udp send 172.17.0.1 1234 hello
175Sending to synthesized IPv6 address: fdde:ad00:beef:2:0:0:ac11:1
176Done
177```
178
179### send \<ip\> \<port\> \<type\> \<value\>
180
181Send a few bytes over UDP.
182
183- ip: the IPv6 destination address.
184- port: the UDP destination port.
185- type: the type of the message:
186 - `-t`: text payload in the `value`, same as without specifying the type.
187 - `-s`: autogenerated payload with specified length indicated in the `value`.
188 - `-x`: binary data in hexadecimal representation in the `value`.
189
190```bash
191> udp send fdde:ad00:beef:0:bb1:ebd6:ad10:f33 1234 -t hello
192Done
193
194> udp send fdde:ad00:beef:0:bb1:ebd6:ad10:f33 1234 -x 68656c6c6f
195Done
196
197> udp send fdde:ad00:beef:0:bb1:ebd6:ad10:f33 1234 -s 800
198Done
199
200```
201
202### send \<message\>
203
204Send a UDP message on a connected socket.
205
206- message: the message to send.
207
208```bash
209> udp send hello
210Done
211```
212
213### send \<type\> \<value\>
214
215Send a few bytes over UDP.
216
217- type: the type of the message:
218 - `-t`: text payload in the `value`, same as without specifying the type.
219 - `-s`: autogenerated payload with specified length indicated in the `value`.
220 - `-x`: binary data in hexadecimal representation in the `value`.
221
222```bash
223> udp send -t hello
224Done
225
226> udp send -x 68656c6c6f
227Done
228
229> udp send -s 800
230Done
231```
232