|
Name |
|
Date |
Size |
#Lines |
LOC |
| .. | | - | - |
| BUILD.gn | D | 06-Sep-2024 | 2.8 KiB | 90 | 84 |
| CMakeLists.txt | D | 06-Sep-2024 | 2.7 KiB | 79 | 71 |
| README.md | D | 06-Sep-2024 | 88.7 KiB | 4,188 | 3,061 |
| README_BR.md | D | 06-Sep-2024 | 6.8 KiB | 348 | 245 |
| README_COAP.md | D | 06-Sep-2024 | 5.8 KiB | 243 | 180 |
| README_COAPS.md | D | 06-Sep-2024 | 6.2 KiB | 304 | 222 |
| README_COMMISSIONER.md | D | 06-Sep-2024 | 5.2 KiB | 265 | 184 |
| README_COMMISSIONING.md | D | 06-Sep-2024 | 2.1 KiB | 118 | 89 |
| README_DATASET.md | D | 06-Sep-2024 | 18.3 KiB | 822 | 612 |
| README_HISTORY.md | D | 06-Sep-2024 | 34.4 KiB | 653 | 549 |
| README_JOINER.md | D | 06-Sep-2024 | 1.3 KiB | 109 | 75 |
| README_NETDATA.md | D | 06-Sep-2024 | 12.3 KiB | 492 | 361 |
| README_SRP.md | D | 06-Sep-2024 | 3.8 KiB | 188 | 151 |
| README_SRP_CLIENT.md | D | 06-Sep-2024 | 8.7 KiB | 457 | 320 |
| README_SRP_SERVER.md | D | 06-Sep-2024 | 4 KiB | 240 | 174 |
| README_TCAT.md | D | 06-Sep-2024 | 324 | 38 | 26 |
| README_TCP.md | D | 06-Sep-2024 | 5.8 KiB | 234 | 161 |
| README_UDP.md | D | 06-Sep-2024 | 4 KiB | 230 | 159 |
| cli.cpp | D | 06-Sep-2024 | 253.4 KiB | 8,742 | 4,563 |
| cli.hpp | D | 06-Sep-2024 | 18.7 KiB | 508 | 295 |
| cli_bbr.cpp | D | 06-Sep-2024 | 13.8 KiB | 499 | 208 |
| cli_bbr.hpp | D | 06-Sep-2024 | 3.2 KiB | 97 | 27 |
| cli_br.cpp | D | 06-Sep-2024 | 20.6 KiB | 778 | 342 |
| cli_br.hpp | D | 06-Sep-2024 | 3.4 KiB | 104 | 33 |
| cli_coap.cpp | D | 06-Sep-2024 | 38.6 KiB | 1,168 | 748 |
| cli_coap.hpp | D | 06-Sep-2024 | 6.9 KiB | 188 | 104 |
| cli_coap_secure.cpp | D | 06-Sep-2024 | 32.5 KiB | 1,060 | 631 |
| cli_coap_secure.hpp | D | 06-Sep-2024 | 6.2 KiB | 168 | 84 |
| cli_commissioner.cpp | D | 06-Sep-2024 | 23.6 KiB | 738 | 381 |
| cli_commissioner.hpp | D | 06-Sep-2024 | 4.5 KiB | 117 | 42 |
| cli_config.h | D | 06-Sep-2024 | 6.5 KiB | 210 | 56 |
| cli_dataset.cpp | D | 06-Sep-2024 | 35.8 KiB | 1,330 | 680 |
| cli_dataset.hpp | D | 06-Sep-2024 | 5.7 KiB | 143 | 71 |
| cli_dns.cpp | D | 06-Sep-2024 | 25.2 KiB | 753 | 372 |
| cli_dns.hpp | D | 06-Sep-2024 | 5.2 KiB | 136 | 61 |
| cli_extension_example.c | D | 06-Sep-2024 | 2.3 KiB | 58 | 20 |
| cli_extension_example.cmake | D | 06-Sep-2024 | 2 KiB | 40 | 33 |
| cli_history.cpp | D | 06-Sep-2024 | 72.1 KiB | 1,478 | 569 |
| cli_history.hpp | D | 06-Sep-2024 | 4 KiB | 114 | 41 |
| cli_joiner.cpp | D | 06-Sep-2024 | 7.6 KiB | 284 | 115 |
| cli_joiner.hpp | D | 06-Sep-2024 | 3.2 KiB | 96 | 26 |
| cli_link_metrics.cpp | D | 06-Sep-2024 | 18.4 KiB | 531 | 305 |
| cli_link_metrics.hpp | D | 06-Sep-2024 | 4.9 KiB | 127 | 45 |
| cli_mac_filter.cpp | D | 06-Sep-2024 | 16.4 KiB | 510 | 217 |
| cli_mac_filter.hpp | D | 06-Sep-2024 | 3.6 KiB | 105 | 32 |
| cli_network_data.cpp | D | 06-Sep-2024 | 26.8 KiB | 975 | 486 |
| cli_network_data.hpp | D | 06-Sep-2024 | 5.4 KiB | 156 | 37 |
| cli_ping.cpp | D | 06-Sep-2024 | 7.6 KiB | 257 | 163 |
| cli_ping.hpp | D | 06-Sep-2024 | 3.4 KiB | 98 | 26 |
| cli_srp_client.cpp | D | 06-Sep-2024 | 30.8 KiB | 1,014 | 455 |
| cli_srp_client.hpp | D | 06-Sep-2024 | 4.2 KiB | 113 | 39 |
| cli_srp_server.cpp | D | 06-Sep-2024 | 16.7 KiB | 579 | 280 |
| cli_srp_server.hpp | D | 06-Sep-2024 | 3.2 KiB | 97 | 26 |
| cli_tcat.cpp | D | 06-Sep-2024 | 7.4 KiB | 180 | 113 |
| cli_tcat.hpp | D | 06-Sep-2024 | 3.1 KiB | 92 | 25 |
| cli_tcp.cpp | D | 06-Sep-2024 | 38.7 KiB | 1,216 | 799 |
| cli_tcp.hpp | D | 06-Sep-2024 | 11.9 KiB | 229 | 143 |
| cli_udp.cpp | D | 06-Sep-2024 | 13.3 KiB | 477 | 216 |
| cli_udp.hpp | D | 06-Sep-2024 | 3.4 KiB | 95 | 25 |
| cli_utils.cpp | D | 06-Sep-2024 | 13.5 KiB | 522 | 352 |
| cli_utils.hpp | D | 06-Sep-2024 | 24.2 KiB | 711 | 239 |
| ftd.cmake | D | 06-Sep-2024 | 2.2 KiB | 58 | 50 |
| mtd.cmake | D | 06-Sep-2024 | 2.2 KiB | 58 | 50 |
| radio.cmake | D | 06-Sep-2024 | 2.4 KiB | 67 | 58 |
| x509_cert_key.hpp | D | 06-Sep-2024 | 5.3 KiB | 118 | 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- [ba](#ba)
25- [bbr](#bbr)
26- [br](README_BR.md)
27- [bufferinfo](#bufferinfo)
28- [ccathreshold](#ccathreshold)
29- [channel](#channel)
30- [child](#child-list)
31- [childip](#childip)
32- [childmax](#childmax)
33- [childsupervision](#childsupervision-interval)
34- [childtimeout](#childtimeout)
35- [coap](README_COAP.md)
36- [coaps](README_COAPS.md)
37- [coex](#coex)
38- [commissioner](README_COMMISSIONER.md)
39- [contextreusedelay](#contextreusedelay)
40- [counters](#counters)
41- [csl](#csl)
42- [dataset](README_DATASET.md)
43- [debug](#debug)
44- [delaytimermin](#delaytimermin)
45- [detach](#detach)
46- [deviceprops](#deviceprops)
47- [diag](#diag)
48- [discover](#discover-channel)
49- [dns](#dns-config)
50- [domainname](#domainname)
51- [dua](#dua-iid)
52- [eidcache](#eidcache)
53- [eui64](#eui64)
54- [extaddr](#extaddr)
55- [extpanid](#extpanid)
56- [factoryreset](#factoryreset)
57- [fake](#fake)
58- [fem](#fem)
59- [history](README_HISTORY.md)
60- [ifconfig](#ifconfig)
61- [instanceid](#instanceid)
62- [ipaddr](#ipaddr)
63- [ipmaddr](#ipmaddr)
64- [joiner](README_JOINER.md)
65- [joinerport](#joinerport-port)
66- [keysequence](#keysequence-counter)
67- [leaderdata](#leaderdata)
68- [leaderweight](#leaderweight)
69- [linkmetrics](#linkmetrics-mgmt-ipaddr-enhanced-ack-clear)
70- [linkmetricsmgr](#linkmetricsmgr-disable)
71- [locate](#locate)
72- [log](#log-filename-filename)
73- [mac](#mac-retries-direct)
74- [macfilter](#macfilter)
75- [meshdiag](#meshdiag-topology)
76- [mliid](#mliid-iid)
77- [mlr](#mlr-reg-ipaddr--timeout)
78- [mode](#mode)
79- [multiradio](#multiradio)
80- [nat64](#nat64-cidr)
81- [neighbor](#neighbor-list)
82- [netdata](README_NETDATA.md)
83- [netstat](#netstat)
84- [networkdiagnostic](#networkdiagnostic-get-addr-type-)
85- [networkidtimeout](#networkidtimeout)
86- [networkkey](#networkkey)
87- [networkname](#networkname)
88- [networktime](#networktime)
89- [nexthop](#nexthop)
90- [panid](#panid)
91- [parent](#parent)
92- [parentpriority](#parentpriority)
93- [partitionid](#partitionid)
94- [ping](#ping-async--i-source--m-ipaddr-size-count-interval-hoplimit-timeout)
95- [platform](#platform)
96- [pollperiod](#pollperiod-pollperiod)
97- [preferrouterid](#preferrouterid-routerid)
98- [prefix](#prefix)
99- [promiscuous](#promiscuous)
100- [pskc](#pskc)
101- [pskcref](#pskcref)
102- [radio](#radio-enable)
103- [radiofilter](#radiofilter)
104- [rcp](#rcp)
105- [region](#region)
106- [releaserouterid](#releaserouterid-routerid)
107- [reset](#reset)
108- [rloc16](#rloc16)
109- [route](#route)
110- [router](#router-list)
111- [routerdowngradethreshold](#routerdowngradethreshold)
112- [routereligible](#routereligible)
113- [routerselectionjitter](#routerselectionjitter)
114- [routerupgradethreshold](#routerupgradethreshold)
115- [childrouterlinks](#childrouterlinks)
116- [scan](#scan-channel)
117- [service](#service)
118- [singleton](#singleton)
119- [sntp](#sntp-query-sntp-server-ip-sntp-server-port)
120- [state](#state)
121- [srp](README_SRP.md)
122- [tcat](README_TCAT.md)
123- [tcp](README_TCP.md)
124- [thread](#thread-start)
125- [timeinqueue](#timeinqueue)
126- [trel](#trel)
127- [tvcheck](#tvcheck-enable)
128- [txpower](#txpower)
129- [udp](README_UDP.md)
130- [unsecureport](#unsecureport-add-port)
131- [uptime](#uptime)
132- [vendor](#vendor-name)
133- [version](#version)
134
135## OpenThread Command Details
136
137### bbr
138
139Show current Primary Backbone Router information for Thread 1.2 device.
140
141```bash
142> bbr
143BBR Primary:
144server16: 0xE400
145seqno: 10
146delay: 120 secs
147timeout: 300 secs
148Done
149```
150
151```bash
152> bbr
153BBR Primary: None
154Done
155```
156
157### bbr mgmt dua \<status\|coap-code\> [meshLocalIid]
158
159Configure 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.
160
161Only for testing/reference device.
162
163known status value:
164
165- 0: ST_DUA_SUCCESS
166- 1: ST_DUA_REREGISTER
167- 2: ST_DUA_INVALID
168- 3: ST_DUA_DUPLICATE
169- 4: ST_DUA_NO_RESOURCES
170- 5: ST_DUA_BBR_NOT_PRIMARY
171- 6: ST_DUA_GENERAL_FAILURE
172- 160: COAP code 5.00
173
174```bash
175> bbr mgmt dua 1 2f7c235e5025a2fd
176Done
177> bbr mgmt dua 160
178Done
179```
180
181### bbr mgmt mlr listener
182
183Show the Multicast Listeners.
184
185Only for testing/reference Backbone Router device.
186
187```bash
188> bbr mgmt mlr listener
189ff04:0:0:0:0:0:0:abcd 3534000
190ff04:0:0:0:0:0:0:eeee 3537610
191Done
192```
193
194### bbr mgmt mlr listener add \<ipaddr\> \[\<timeout\>\]
195
196Add a Multicast Listener with a given IPv6 multicast address and timeout (in seconds).
197
198Only for testing/reference Backbone Router device.
199
200```bash
201> bbr mgmt mlr listener add ff04::1
202Done
203> bbr mgmt mlr listener add ff04::2 300
204Done
205> bbr mgmt mlr listener
206ff04:0:0:0:0:0:0:2 261
207ff04:0:0:0:0:0:0:1 3522
208Done
209```
210
211### bbr mgmt mlr listener clear
212
213Removes all the Multicast Listeners.
214
215Only for testing/reference Backbone Router device.
216
217```bash
218> bbr mgmt mlr listener clear
219Done
220> bbr mgmt mlr listener
221Done
222```
223
224### bbr mgmt mlr response \<status\>
225
226Configure the response status for the next MLR.req.
227
228Only for testing/reference device.
229
230Known status values:
231
232- 0: ST_MLR_SUCCESS
233- 2: ST_MLR_INVALID
234- 3: ST_MLR_NO_PERSISTENT
235- 4: ST_MLR_NO_RESOURCES
236- 5: ST_MLR_BBR_NOT_PRIMARY
237- 6: ST_MLR_GENERAL_FAILURE
238
239```bash
240> bbr mgmt mlr response 2
241Done
242```
243
244### bbr state
245
246Show local Backbone state ([`Disabled`,`Primary`, `Secondary`]) for Thread 1.2 FTD.
247
248`OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is required.
249
250```bash
251> bbr state
252Disabled
253Done
254
255> bbr state
256Primary
257Done
258
259> bbr state
260Secondary
261Done
262```
263
264### bbr enable
265
266Enable 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.
267
268`OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is required.
269
270```bash
271> bbr enable
272Done
273```
274
275### bbr disable
276
277Disable 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.
278
279```bash
280> bbr disable
281Done
282```
283
284### bbr register
285
286Register Backbone Router Service for Thread 1.2 FTD. `SRV_DATA.ntf` would be triggered for attached device.
287
288`OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is required.
289
290```bash
291> bbr register
292Done
293```
294
295### bbr config
296
297Show local Backbone Router configuration for Thread 1.2 FTD.
298
299`OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is required.
300
301```bash
302> bbr config
303seqno: 10
304delay: 120 secs
305timeout: 300 secs
306Done
307```
308
309### bbr config \[seqno \<seqno\>\] \[delay \<delay\>\] \[timeout \<timeout\>\]
310
311Configure 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.
312
313`OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is required.
314
315```bash
316> bbr config seqno 20 delay 30
317Done
318```
319
320### bbr jitter
321
322Show jitter (in seconds) for Backbone Router registration for Thread 1.2 FTD.
323
324`OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is required.
325
326```bash
327> bbr jitter
32820
329Done
330```
331
332### bbr jitter \<jitter\>
333
334Set jitter (in seconds) for Backbone Router registration for Thread 1.2 FTD.
335
336`OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is required.
337
338```bash
339> bbr jitter 10
340Done
341```
342
343### ba
344
345Show current Border Agent information.
346
347### ba port
348
349Print border agent service port.
350
351```bash
352> ba port
35349152
354Done
355```
356
357### ba state
358
359Print border agent state.
360
361Possible states are
362
363- `Stopped` : Border Agent is stopped.
364- `Started` : Border Agent is running with no active connection with external commissioner.
365- `Active` : Border Agent is running and is connected with an external commissioner.
366
367```bash
368> ba state
369Started
370Done
371```
372
373### ba ephemeralkey
374
375Indicates if an ephemeral key is active.
376
377Requires `OPENTHREAD_CONFIG_BORDER_AGENT_EPHEMERAL_KEY_ENABLE`.
378
379```bash
380> ba ephemeralkey
381inactive
382Done
383
384> ba ephemeralkey set Z10X20g3J15w1000P60m16 1000
385Done
386
387> ba ephemeralkey
388active
389Done
390```
391
392### ba ephemeralkey set \<keystring\> \[timeout\] \[port\]
393
394Sets the ephemeral key for a given timeout duration.
395
396Requires `OPENTHREAD_CONFIG_BORDER_AGENT_EPHEMERAL_KEY_ENABLE`.
397
398The 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`).
399
400The `keystring` string is directly used as the ephemeral PSK (excluding the trailing null `\0` character). Its length MUST be between 6 and 32, inclusive.
401
402The `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.
403
404The `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.
405
406Setting the ephemeral key again before a previously set one is timed out, will replace the previous one.
407
408While the timeout interval is in effect, the ephemeral key can be used only once by an external commissioner to connect. Once the commissioner disconnects, the ephemeral key is cleared, and Border Agent reverts to using PSKc.
409
410```bash
411> ba ephemeralkey set Z10X20g3J15w1000P60m16 5000 1234
412Done
413```
414
415### ba ephemeralkey clear
416
417Cancels the ephemeral key in use if any.
418
419Requires `OPENTHREAD_CONFIG_BORDER_AGENT_EPHEMERAL_KEY_ENABLE`.
420
421Can 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.
422
423If 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.
424
425```bash
426> ba ephemeralkey clear
427Done
428```
429
430### ba ephemeralkey callback enable
431
432Enables callback from Border Agent for ephemeral key state changes.
433
434```bash
435> ba ephemeralkey callback enable
436Done
437
438> ba ephemeralkey set W10X12 5000 49155
439Done
440
441BorderAgent callback: Ephemeral key active, port:49155
442BorderAgent callback: Ephemeral key inactive
443```
444
445### ba ephemeralkey callback disable
446
447Disables callback from Border Agent for ephemeral key state changes.
448
449```bash
450> ba ephemeralkey callback disable
451Done
452```
453
454### bufferinfo
455
456Show the current message buffer information.
457
458- The `total` shows total number of message buffers in pool.
459- The `free` shows the number of free message buffers.
460- The `max-used` shows the maximum number of used buffers at the same time since OT stack initialization or last `bufferinfo reset`.
461- This is then followed by info about different queues used by OpenThread stack, each line representing info about a queue.
462 - The first number shows number messages in the queue.
463 - The second number shows number of buffers used by all messages in the queue.
464 - The third number shows total number of bytes of all messages in the queue.
465
466```bash
467> bufferinfo
468total: 40
469free: 40
470max-used: 5
4716lo send: 0 0 0
4726lo reas: 0 0 0
473ip6: 0 0 0
474mpl: 0 0 0
475mle: 0 0 0
476coap: 0 0 0
477coap secure: 0 0 0
478application coap: 0 0 0
479Done
480```
481
482### bufferinfo reset
483
484Reset the message buffer counter tracking maximum number buffers in use at the same time.
485
486```bash
487> bufferinfo reset
488Done
489```
490
491### ccathreshold
492
493Get the CCA threshold in dBm measured at antenna connector per IEEE 802.15.4 - 2015 section 10.1.4.
494
495```bash
496> ccathreshold
497-75 dBm
498Done
499```
500
501### ccathreshold \<ccathreshold\>
502
503Set the CCA threshold measured at antenna connector per IEEE 802.15.4 - 2015 section 10.1.4.
504
505```bash
506> ccathreshold -62
507Done
508```
509
510### channel
511
512Get the IEEE 802.15.4 Channel value.
513
514```bash
515> channel
51611
517Done
518```
519
520### channel \<channel\>
521
522Set the IEEE 802.15.4 Channel value.
523
524```bash
525> channel 11
526Done
527```
528
529### channel manager
530
531Get channel manager state.
532
533`OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` is required.
534
535```bash
536channel: 11
537auto: 1
538delay: 120
539interval: 10800
540supported: { 11-26}
541favored: { 11-26}
542Done
543```
544
545### channel manager change \<channel\>
546
547Initiate a channel change with the channel manager.
548
549`OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` is required.
550
551```bash
552> channel manager change 11
553channel manager change 11
554Done
555```
556
557### channel manager select \<skip quality check (boolean)\>
558
559Request a channel selection with the channel manager.
560
561`OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` and `OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE` are required.
562
563```bash
564> channel manager select 1
565channel manager select 1
566Done
567```
568
569### channel manager auto \<enable (boolean)\>
570
571Enable/disable the auto-channel-selection functionality.
572
573`OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` and `OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE` are required.
574
575```bash
576> channel manager auto 1
577channel manager auto 1
578Done
579```
580
581### channel manager delay \<delay\>
582
583Set the channel change delay (in seconds).
584
585`OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` and `OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE` are required.
586
587```bash
588> channel manager delay 120
589channel manager delay 120
590Done
591```
592
593### channel manager interval \<interval\>
594
595Set the auto-channel-selection interval (in seconds).
596
597`OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` and `OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE` are required.
598
599```bash
600> channel manager interval 10800
601channel manager interval 10800
602Done
603```
604
605### channel manager supported \<mask\>
606
607Set the supported channel mask for the auto-channel-selection.
608
609`OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` and `OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE` are required.
610
611```bash
612> channel manager supported 0x7fffc00
613channel manager supported 0x7fffc00
614Done
615```
616
617### channel manager favored \<mask\>
618
619Set the favored channel mask for the auto-channel-selection.
620
621`OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` and `OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE` are required.
622
623```bash
624> channel manager favored 0x7fffc00
625channel manager favored 0x7fffc00
626Done
627```
628
629### channel monitor
630
631Get current channel monitor state and channel occupancy.
632
633`OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE` is required.
634
635```bash
636> channel monitor
637channel monitor
638enabled: 1
639interval: 41000
640threshold: -75
641window: 960
642count: 10552
643occupancies:
644ch 11 (0x0cb7) 4.96% busy
645ch 12 (0x2e2b) 18.03% busy
646ch 13 (0x2f54) 18.48% busy
647ch 14 (0x0fef) 6.22% busy
648ch 15 (0x1536) 8.28% busy
649ch 16 (0x1746) 9.09% busy
650ch 17 (0x0b8b) 4.50% busy
651ch 18 (0x60a7) 37.75% busy
652ch 19 (0x0810) 3.14% busy
653ch 20 (0x0c2a) 4.75% busy
654ch 21 (0x08dc) 3.46% busy
655ch 22 (0x101d) 6.29% busy
656ch 23 (0x0092) 0.22% busy
657ch 24 (0x0028) 0.06% busy
658ch 25 (0x0063) 0.15% busy
659ch 26 (0x058c) 2.16% busy
660
661Done
662```
663
664### channel monitor start
665
666Start the channel monitor.
667
668`OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE` is required.
669
670```bash
671> channel monitor start
672channel monitor start
673Done
674```
675
676### channel monitor stop
677
678Stop the channel monitor.
679
680`OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE` is required.
681
682```bash
683> channel monitor stop
684channel monitor stop
685Done
686```
687
688### channel preferred
689
690Get preferred channel mask.
691
692```bash
693> channel preferred
6940x7fff800
695Done
696```
697
698### channel supported
699
700Get supported channel mask.
701
702```bash
703> channel supported
7040x7fff800
705Done
706```
707
708### child list
709
710List attached Child IDs.
711
712```bash
713> child list
7141 2 3 6 7 8
715Done
716```
717
718### child table
719
720Print table of attached children.
721
722```bash
723> child table
724| ID | RLOC16 | Timeout | Age | LQ In | C_VN |R|D|N|Ver|CSL|QMsgCnt|Suprvsn| Extended MAC |
725+-----+--------+------------+------------+-------+------+-+-+-+---+---+-------+-------+------------------+
726| 1 | 0xc801 | 240 | 24 | 3 | 131 |1|0|0| 3| 0 | 0 | 129 | 4ecede68435358ac |
727| 2 | 0xc802 | 240 | 2 | 3 | 131 |0|0|0| 3| 1 | 0 | 0 | a672a601d2ce37d8 |
728Done
729```
730
731### child \<id\>
732
733Print diagnostic information for an attached Thread Child. The `id` may be a Child ID or an RLOC16.
734
735```bash
736> child 1
737Child ID: 1
738Rloc: 9c01
739Ext Addr: e2b3540590b0fd87
740Mode: rn
741CSL Synchronized: 1
742Net Data: 184
743Timeout: 100
744Age: 0
745Link Quality In: 3
746RSSI: -20
747Supervision Interval: 129
748Done
749```
750
751### childip
752
753Get the list of IP addresses stored for MTD children.
754
755```bash
756> childip
7573401: fdde:ad00:beef:0:3037:3e03:8c5f:bc0c
758Done
759```
760
761### childip max
762
763Get the maximum number of IP addresses that each MTD child may register with this device as parent.
764
765```bash
766> childip max
7674
768Done
769```
770
771### childip max \<count\>
772
773Set 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.
774
775`OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is required.
776
777```bash
778> childip max 2
779Done
780```
781
782### childmax
783
784Get the Thread maximum number of allowed children.
785
786```bash
787> childmax
7885
789Done
790```
791
792### childmax \<count\>
793
794Set the Thread maximum number of allowed children.
795
796```bash
797> childmax 2
798Done
799```
800
801### childsupervision interval
802
803Get the Child Supervision interval value on the child.
804
805Child 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.
806
807```bash
808> childsupervision interval
80930
810Done
811```
812
813### childsupervision interval \<interval\>
814
815Set the Child Supervision interval value on the child.
816
817```bash
818> childsupervision interval 30
819Done
820```
821
822### childsupervision checktimeout
823
824Get the Child Supervision Check Timeout value on the child.
825
826If 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).
827
828```bash
829> childsupervision checktimeout
83030
831Done
832```
833
834### childsupervision checktimeout \<timeout\>
835
836Set the Child Supervision Check Timeout value on the child.
837
838```bash
839> childsupervision checktimeout 30
840Done
841```
842
843### childsupervision failcounter
844
845Get the current value of supervision check timeout failure counter.
846
847The 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.
848
849```bash
850> childsupervision failcounter
8510
852Done
853```
854
855### childsupervision failcounter reset
856
857Reset the supervision check timeout failure counter to zero.
858
859```bash
860> childsupervision failcounter reset
861Done
862```
863
864### childtimeout
865
866Get the Thread Child Timeout value.
867
868```bash
869> childtimeout
870300
871Done
872```
873
874### childtimeout \<timeout\>
875
876Set the Thread Child Timeout value.
877
878```bash
879> childtimeout 300
880Done
881```
882
883### coex
884
885Get the coex status.
886
887`OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE` is required.
888
889```bash
890> coex
891Enabled
892Done
893```
894
895### coex disable
896
897Disable coex.
898
899`OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE` is required.
900
901```bash
902> coex disable
903Done
904```
905
906### coex enable
907
908Enable coex.
909
910`OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE` is required.
911
912```bash
913> coex enable
914Done
915```
916
917### coex metrics
918
919Show coex metrics.
920
921`OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE` is required.
922
923```bash
924> coex metrics
925Stopped: false
926Grant Glitch: 0
927Transmit metrics
928 Request: 0
929 Grant Immediate: 0
930 Grant Wait: 0
931 Grant Wait Activated: 0
932 Grant Wait Timeout: 0
933 Grant Deactivated During Request: 0
934 Delayed Grant: 0
935 Average Request To Grant Time: 0
936Receive metrics
937 Request: 0
938 Grant Immediate: 0
939 Grant Wait: 0
940 Grant Wait Activated: 0
941 Grant Wait Timeout: 0
942 Grant Deactivated During Request: 0
943 Delayed Grant: 0
944 Average Request To Grant Time: 0
945 Grant None: 0
946Done
947```
948
949### contextreusedelay
950
951Get the CONTEXT_ID_REUSE_DELAY value.
952
953```bash
954> contextreusedelay
95511
956Done
957```
958
959### contextreusedelay \<delay\>
960
961Set the CONTEXT_ID_REUSE_DELAY value.
962
963```bash
964> contextreusedelay 11
965Done
966```
967
968### counters
969
970Get the supported counter names.
971
972```bash
973> counters
974br
975ip
976mac
977mle
978Done
979```
980
981### counters \<countername\>
982
983Get the counter value.
984
985Note:
986
987- `OPENTHREAD_CONFIG_UPTIME_ENABLE` is required for MLE role time tracking in `counters mle`
988- `OPENTHREAD_CONFIG_IP6_BR_COUNTERS_ENABLE` is required for `counters br`
989
990```bash
991> counters mac
992TxTotal: 10
993 TxUnicast: 3
994 TxBroadcast: 7
995 TxAckRequested: 3
996 TxAcked: 3
997 TxNoAckRequested: 7
998 TxData: 10
999 TxDataPoll: 0
1000 TxBeacon: 0
1001 TxBeaconRequest: 0
1002 TxOther: 0
1003 TxRetry: 0
1004 TxErrCca: 0
1005 TxErrBusyChannel: 0
1006RxTotal: 2
1007 RxUnicast: 1
1008 RxBroadcast: 1
1009 RxData: 2
1010 RxDataPoll: 0
1011 RxBeacon: 0
1012 RxBeaconRequest: 0
1013 RxOther: 0
1014 RxAddressFiltered: 0
1015 RxDestAddrFiltered: 0
1016 RxDuplicated: 0
1017 RxErrNoFrame: 0
1018 RxErrNoUnknownNeighbor: 0
1019 RxErrInvalidSrcAddr: 0
1020 RxErrSec: 0
1021 RxErrFcs: 0
1022 RxErrOther: 0
1023Done
1024> counters mle
1025Role Disabled: 0
1026Role Detached: 1
1027Role Child: 0
1028Role Router: 0
1029Role Leader: 1
1030Attach Attempts: 1
1031Partition Id Changes: 1
1032Better Partition Attach Attempts: 0
1033Parent Changes: 0
1034Time Disabled Milli: 10026
1035Time Detached Milli: 6852
1036Time Child Milli: 0
1037Time Router Milli: 0
1038Time Leader Milli: 16195
1039Time Tracked Milli: 33073
1040Done
1041> counters ip
1042TxSuccess: 10
1043TxFailed: 0
1044RxSuccess: 5
1045RxFailed: 0
1046Done
1047> counters br
1048Inbound Unicast: Packets 4 Bytes 320
1049Inbound Multicast: Packets 0 Bytes 0
1050Outbound Unicast: Packets 2 Bytes 160
1051Outbound Multicast: Packets 0 Bytes 0
1052RA Rx: 4
1053RA TxSuccess: 2
1054RA TxFailed: 0
1055RS Rx: 0
1056RS TxSuccess: 2
1057RS TxFailed: 0
1058Done
1059```
1060
1061### counters \<countername\> reset
1062
1063Reset the counter value.
1064
1065```bash
1066> counters mac reset
1067Done
1068> counters mle reset
1069Done
1070> counters ip reset
1071Done
1072```
1073
1074### csl
1075
1076Get the CSL configuration.
1077
1078CSL period is shown in microseconds.
1079
1080```bash
1081> csl
1082Channel: 11
1083Period: 160000us
1084Timeout: 1000s
1085Done
1086```
1087
1088### csl channel \<channel\>
1089
1090Set CSL channel.
1091
1092```bash
1093> csl channel 20
1094Done
1095```
1096
1097### csl period \<period\>
1098
1099Set CSL period in microseconds. Disable CSL by setting this parameter to `0`.
1100
1101The CSL period MUST be a multiple 160 microseconds which is 802.15.4 "ten symbols time".
1102
1103```bash
1104> csl period 30000000
1105Done
1106```
1107
1108### csl timeout \<timeout\>
1109
1110Set the CSL timeout in seconds.
1111
1112```bash
1113> csl timeout 10
1114Done
1115```
1116
1117### debug
1118
1119Executes a series of CLI commands to gather information about the device and thread network. This is intended for debugging.
1120
1121The output will display each executed CLI command preceded by "\$", followed by the corresponding command's generated output.
1122
1123The generated output encompasses the following information:
1124
1125- Version
1126- Current state
1127- RLOC16, extended MAC address
1128- Unicast and multicast IPv6 address list
1129- Channel
1130- PAN ID and extended PAN ID
1131- Network Data
1132- Partition ID
1133- Leader Data
1134
1135If the device is operating as FTD:
1136
1137- Child and neighbor table
1138- Router table and next hop Info
1139- Address cache table
1140- Registered MTD child IPv6 address
1141- Device properties
1142
1143If the device supports and acts as an SRP client:
1144
1145- SRP client state
1146- SRP client services and host info
1147
1148If the device supports and acts as an SRP sever:
1149
1150- SRP server state and address mode
1151- SRP server registered hosts and services
1152
1153If the device supports TREL:
1154
1155- TREL status and peer table
1156
1157If the device supports and acts as a border router:
1158
1159- BR state
1160- BR prefixes (OMR, on-link, NAT64)
1161- Discovered prefix table
1162
1163### delaytimermin
1164
1165Get the minimal delay timer (in seconds).
1166
1167```bash
1168> delaytimermin
116930
1170Done
1171```
1172
1173### delaytimermin \<delaytimermin\>
1174
1175Set the minimal delay timer (in seconds).
1176
1177```bash
1178> delaytimermin 60
1179Done
1180```
1181
1182### detach
1183
1184Start 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.
1185
1186```bash
1187> detach
1188Finished detaching
1189Done
1190```
1191
1192### detach async
1193
1194Start the graceful detach process similar to the `detach` command without blocking and waiting for the callback indicating that detach is finished.
1195
1196```bash
1197> detach async
1198Done
1199```
1200
1201### deviceprops
1202
1203Get the current device properties.
1204
1205```bash
1206> deviceprops
1207PowerSupply : external
1208IsBorderRouter : yes
1209SupportsCcm : no
1210IsUnstable : no
1211WeightAdjustment : 0
1212Done
1213```
1214
1215### deviceprops \<power-supply\> \<is-br\> \<supports-ccm\> \<is-unstable\> \<weight-adjustment\>
1216
1217Set the device properties which are then used to determine and set the Leader Weight.
1218
1219- power-supply: `battery`, `external`, `external-stable`, or `external-unstable`.
1220- weight-adjustment: Valid range is from -16 to +16. Clamped if not within the range.
1221
1222```bash
1223> deviceprops battery 0 0 0 -5
1224Done
1225
1226> deviceprops
1227PowerSupply : battery
1228IsBorderRouter : no
1229SupportsCcm : no
1230IsUnstable : no
1231WeightAdjustment : -5
1232Done
1233
1234> leaderweight
123551
1236Done
1237```
1238
1239### discover \[channel\]
1240
1241Perform an MLE Discovery operation.
1242
1243- channel: The channel to discover on. If no channel is provided, the discovery will cover all valid channels.
1244
1245```bash
1246> discover
1247| J | Network Name | Extended PAN | PAN | MAC Address | Ch | dBm | LQI |
1248+---+------------------+------------------+------+------------------+----+-----+-----+
1249| 0 | OpenThread | dead00beef00cafe | ffff | f1d92a82c8d8fe43 | 11 | -20 | 0 |
1250Done
1251```
1252
1253### dns config
1254
1255Get the default query config used by DNS client.
1256
1257The config includes
1258
1259- Server IPv6 address and port
1260- Response timeout in msec (wait time to rx response)
1261- Maximum tx attempts before reporting failure
1262- Boolean flag to indicate whether the server can resolve the query recursively or not.
1263- Service resolution mode which specifies which records to query. Possible options are:
1264 - `srv` : Query for SRV record only.
1265 - `txt` : Query for TXT record only.
1266 - `srv_txt` : Query for both SRV and TXT records in the same message.
1267 - `srv_txt_sep`: Query in parallel for SRV and TXT using separate messages.
1268 - `srv_txt_opt`: Query for TXT/SRV together first, if it fails then query separately.
1269- Whether to allow/disallow NAT64 address translation during address resolution (requires `OPENTHREAD_CONFIG_DNS_CLIENT_NAT64_ENABLE`)
1270- Transport protocol UDP or TCP (requires `OPENTHREAD_CONFIG_DNS_CLIENT_OVER_TCP_ENABLE`)
1271
1272```bash
1273> dns config
1274Server: [fd00:0:0:0:0:0:0:1]:1234
1275ResponseTimeout: 5000 ms
1276MaxTxAttempts: 2
1277RecursionDesired: no
1278ServiceMode: srv_txt_opt
1279Nat64Mode: allow
1280TransportProtocol: udp
1281Done
1282>
1283```
1284
1285### dns config \[DNS server IP\] \[DNS server port\] \[response timeout (ms)\] \[max tx attempts\] \[recursion desired (boolean)\] \[service mode]
1286
1287Set the default query config.
1288
1289Service mode specifies which records to query. Possible options are:
1290
1291- `def` : Use default option.
1292- `srv` : Query for SRV record only.
1293- `txt` : Query for TXT record only.
1294- `srv_txt` : Query for both SRV and TXT records in the same message.
1295- `srv_txt_sep`: Query in parallel for SRV and TXT using separate messages.
1296- `srv_txt_opt`: Query for TXT/SRV together first, if it fails then query separately.
1297
1298To set protocol effectively to tcp `OPENTHREAD_CONFIG_DNS_CLIENT_OVER_TCP_ENABLE` is required.
1299
1300```bash
1301> dns config fd00::1 1234 5000 2 0 srv_txt_sep tcp
1302Done
1303
1304> dns config
1305Server: [fd00:0:0:0:0:0:0:1]:1234
1306ResponseTimeout: 5000 ms
1307MaxTxAttempts: 2
1308RecursionDesired: no
1309ServiceMode: srv_txt_sep
1310Nat64Mode: allow
1311TransportProtocol: tcp
1312Done
1313```
1314
1315We 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.
1316
1317```bash
1318> dns config fd00::2
1319Done
1320
1321> dns config
1322Server: [fd00:0:0:0:0:0:0:2]:53
1323ResponseTimeout: 3000 ms
1324MaxTxAttempts: 3
1325RecursionDesired: yes
1326Done
1327```
1328
1329### dns resolve \<hostname\> \[DNS server IP\] \[DNS server port\] \[response timeout (ms)\] \[max tx attempts\] \[recursion desired (boolean)\] \[transport protocol\]
1330
1331Send DNS Query to obtain IPv6 address for given hostname.
1332
1333The 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`).
1334
1335To use tcp, `OPENTHREAD_CONFIG_DNS_CLIENT_OVER_TCP_ENABLE` is required.
1336
1337```bash
1338> dns resolve ipv6.google.com
1339> DNS response for ipv6.google.com - 2a00:1450:401b:801:0:0:0:200e TTL: 300
1340```
1341
1342The 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.
1343
1344> Note: The command will return `InvalidState` when the DNS server IP is an IPv4 address but the preferred NAT64 prefix is unavailable.
1345
1346```bash
1347> dns resolve example.com 8.8.8.8
1348Synthesized IPv6 DNS server address: fdde:ad00:beef:2:0:0:808:808
1349DNS response for example.com. - fd4c:9574:3720:2:0:0:5db8:d822 TTL:20456
1350Done
1351```
1352
1353### dns resolve4 \<hostname\> \[DNS server IP\] \[DNS server port\] \[response timeout (ms)\] \[max tx attempts\] \[recursion desired (boolean)\]
1354
1355Send 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.
1356
1357Requires `OPENTHREAD_CONFIG_DNS_CLIENT_NAT64_ENABLE`.
1358
1359The 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`).
1360
1361This command requires a NAT64 prefix to be configured and present in Thread Network Data.
1362
1363For 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:
1364
1365```bash
1366> dns resolve4 ipv4.google.com
1367> DNS response for ipv4.google.com - 2001:db8:122:344:0:0:8efa:bf4e TTL: 20456
1368```
1369
1370### dns browse \<service-name\> \[DNS server IP\] \[DNS server port\] \[response timeout (ms)\] \[max tx attempts\] \[recursion desired (boolean)\]
1371
1372Send a browse (service instance enumeration) DNS query to get the list of services for given service-name.
1373
1374The 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`).
1375
1376```bash
1377> dns browse _service._udp.example.com
1378DNS browse response for _service._udp.example.com.
1379inst1
1380inst2
1381inst3
1382Done
1383```
1384
1385The 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.
1386
1387The 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.
1388
1389```bash
1390> dns browse _service._udp.example.com
1391DNS browse response for _service._udp.example.com.
1392inst1
1393 Port:1234, Priority:1, Weight:2, TTL:7200
1394 Host:host.example.com.
1395 HostAddress:fd00:0:0:0:0:0:0:abcd TTL:7200
1396 TXT:[a=6531, b=6c12] TTL:7300
1397Done
1398```
1399
1400```bash
1401> dns browse _airplay._tcp.default.service.arpa
1402DNS browse response for _airplay._tcp.default.service.arpa.
1403Gabe's Mac mini
1404 Port:7000, Priority:0, Weight:0, TTL:10
1405 Host:Gabes-Mac-mini.default.service.arpa.
1406 HostAddress:fd97:739d:386a:1:1c2e:d83c:fcbe:9cf4 TTL:10
1407Done
1408```
1409
1410> 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`.
1411
1412### dns service \<service-instance-label\> \<service-name\> \[DNS server IP\] \[DNS server port\] \[response timeout (ms)\] \[max tx attempts\] \[recursion desired (boolean)\]
1413
1414Send 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).
1415
1416The 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`).
1417
1418> 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.
1419
1420### dns servicehost \<service-instance-label\> \<service-name\> \[DNS server IP\] \[DNS server port\] \[response timeout (ms)\] \[max tx attempts\] \[recursion desired (boolean)\]
1421
1422Send 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).
1423
1424Service instance label is provided first, followed by the service name (note that service instance label can contain dot '.' character).
1425
1426The 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`).
1427
1428### dns compression \[enable|disable\]
1429
1430Enable/Disable the "DNS name compression" mode.
1431
1432By 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.
1433
1434This is intended for testing only and available under `REFERENCE_DEVICE` config.
1435
1436Get the current "DNS name compression" mode.
1437
1438```
1439> dns compression
1440Enabled
1441```
1442
1443Set the "DNS name compression" mode.
1444
1445```
1446> dns compression disable
1447Done
1448>
1449>
1450> dns compression
1451Disabled
1452Done
1453```
1454
1455### domainname
1456
1457Get the Thread Domain Name for Thread 1.2 device.
1458
1459```bash
1460> domainname
1461Thread
1462Done
1463```
1464
1465### domainname \<name\>
1466
1467Set the Thread Domain Name for Thread 1.2 device.
1468
1469```bash
1470> domainname Test\ Thread
1471Done
1472```
1473
1474### dua iid
1475
1476Get the Interface Identifier manually specified for Thread Domain Unicast Address on Thread 1.2 device.
1477
1478```bash
1479> dua iid
14800004000300020001
1481Done
1482```
1483
1484### dua iid \<iid\>
1485
1486Set the Interface Identifier manually specified for Thread Domain Unicast Address on Thread 1.2 device.
1487
1488```bash
1489> dua iid 0004000300020001
1490Done
1491```
1492
1493### dua iid clear
1494
1495Clear the Interface Identifier manually specified for Thread Domain Unicast Address on Thread 1.2 device.
1496
1497```bash
1498> dua iid clear
1499Done
1500```
1501
1502### eidcache
1503
1504Print the EID-to-RLOC cache entries.
1505
1506```bash
1507> eidcache
1508fd49:caf4:a29f:dc0e:97fc:69dd:3c16:df7d 2000 cache canEvict=1 transTime=0 eid=fd49:caf4:a29f:dc0e:97fc:69dd:3c16:df7d
1509fd49:caf4:a29f:dc0e:97fc:69dd:3c16:df7f fffe retry canEvict=1 timeout=10 retryDelay=30
1510Done
1511```
1512
1513### eui64
1514
1515Get the factory-assigned IEEE EUI-64.
1516
1517```bash
1518> eui64
15190615aae900124b00
1520Done
1521```
1522
1523### extaddr
1524
1525Get the IEEE 802.15.4 Extended Address.
1526
1527```bash
1528> extaddr
1529dead00beef00cafe
1530Done
1531```
1532
1533### extaddr \<extaddr\>
1534
1535Set the IEEE 802.15.4 Extended Address.
1536
1537```bash
1538> extaddr dead00beef00cafe
1539dead00beef00cafe
1540Done
1541```
1542
1543### extpanid
1544
1545Get the Thread Extended PAN ID value.
1546
1547**NOTE** The current commissioning credential becomes stale after changing this value. Use [pskc](#pskc--p-keypassphrase) to reset.
1548
1549```bash
1550> extpanid
1551dead00beef00cafe
1552Done
1553```
1554
1555### extpanid \<extpanid\>
1556
1557Set the Thread Extended PAN ID value.
1558
1559```bash
1560> extpanid dead00beef00cafe
1561Done
1562```
1563
1564### factoryreset
1565
1566Delete all stored settings, and signal a platform reset.
1567
1568```bash
1569> factoryreset
1570```
1571
1572### fake
1573
1574Send fake Thread messages.
1575
1576Note: Only for certification test.
1577
1578#### fake /a/an \<dst-ipaddr\> \<target\> \<meshLocalIid\>
1579
1580```bash
1581> fake /a/an fdde:ad00:beef:0:0:ff:fe00:a800 fd00:7d03:7d03:7d03:55f2:bb6a:7a43:a03b 1111222233334444
1582Done
1583```
1584
1585### fem
1586
1587Get external FEM parameters.
1588
1589```bash
1590> fem
1591LNA gain 11 dBm
1592Done
1593```
1594
1595### fem lnagain
1596
1597Get the Rx LNA gain in dBm of the external FEM.
1598
1599```bash
1600> fem lnagain
160111
1602Done
1603```
1604
1605### fem lnagain \<LNA gain\>
1606
1607Set the Rx LNA gain in dBm of the external FEM.
1608
1609```bash
1610> fem lnagain 8
1611Done
1612```
1613
1614### ifconfig
1615
1616Show the status of the IPv6 interface.
1617
1618```bash
1619> ifconfig
1620down
1621Done
1622```
1623
1624### ifconfig up
1625
1626Bring up the IPv6 interface.
1627
1628```bash
1629> ifconfig up
1630Done
1631```
1632
1633### ifconfig down
1634
1635Bring down the IPv6 interface.
1636
1637```bash
1638> ifconfig down
1639Done
1640```
1641
1642### instanceid
1643
1644Show OpenThread instance identifier.
1645
1646```bash
1647> instanceid
1648468697314
1649Done
1650```
1651
1652### ipaddr
1653
1654List all IPv6 addresses assigned to the Thread interface.
1655
1656```bash
1657> ipaddr
1658fdde:ad00:beef:0:0:ff:fe00:0
1659fdde:ad00:beef:0:558:f56b:d688:799
1660fe80:0:0:0:f3d9:2a82:c8d8:fe43
1661Done
1662```
1663
1664Use `-v` to get more verbose information about the address:
1665
1666- `origin`: can be `thread`, `slaac`, `dhcp6`, or `manual`, and indicates the origin of the address
1667- `plen`: prefix length (in bits)
1668- `preferred`: preferred flag (boolean)
1669- `valid`: valid flag (boolean)
1670
1671```bash
1672> ipaddr -v
1673fd5e:18fa:f4a5:b8:0:ff:fe00:fc00 origin:thread plen:64 preferred:0 valid:1
1674fd5e:18fa:f4a5:b8:0:ff:fe00:dc00 origin:thread plen:64 preferred:0 valid:1
1675fd5e:18fa:f4a5:b8:f8e:5d95:87a0:e82c origin:thread plen:64 preferred:0 valid:1
1676fe80:0:0:0:4891:b191:e277:8826 origin:thread plen:64 preferred:1 valid:1
1677Done
1678```
1679
1680### ipaddr add \<ipaddr\>
1681
1682Add an IPv6 address to the Thread interface.
1683
1684```bash
1685> ipaddr add 2001::dead:beef:cafe
1686Done
1687```
1688
1689### ipaddr del \<ipaddr\>
1690
1691Delete an IPv6 address from the Thread interface.
1692
1693```bash
1694> ipaddr del 2001::dead:beef:cafe
1695Done
1696```
1697
1698### ipaddr linklocal
1699
1700Print Thread link-local IPv6 address.
1701
1702```bash
1703> ipaddr linklocal
1704fe80:0:0:0:f3d9:2a82:c8d8:fe43
1705Done
1706```
1707
1708### ipaddr mleid
1709
1710Print Thread Mesh Local EID address.
1711
1712```bash
1713> ipaddr mleid
1714fdde:ad00:beef:0:558:f56b:d688:799
1715Done
1716```
1717
1718### ipaddr rloc
1719
1720Print Thread Routing Locator (RLOC) address.
1721
1722```bash
1723> ipaddr rloc
1724fdde:ad00:beef:0:0:ff:fe00:0
1725Done
1726```
1727
1728### ipmaddr
1729
1730List all IPv6 multicast addresses subscribed to the Thread interface.
1731
1732```bash
1733> ipmaddr
1734ff05:0:0:0:0:0:0:1
1735ff33:40:fdde:ad00:beef:0:0:1
1736ff32:40:fdde:ad00:beef:0:0:1
1737Done
1738```
1739
1740### ipmaddr add \<ipaddr\>
1741
1742Subscribe the Thread interface to the IPv6 multicast address.
1743
1744```bash
1745> ipmaddr add ff05::1
1746Done
1747```
1748
1749### ipmaddr del \<ipaddr\>
1750
1751Unsubscribe the Thread interface to the IPv6 multicast address.
1752
1753```bash
1754> ipmaddr del ff05::1
1755Done
1756```
1757
1758### ipmaddr llatn
1759
1760Get the Link-Local All Thread Nodes multicast address.
1761
1762```
1763> ipmaddr llatn
1764ff32:40:fdde:ad00:beef:0:0:1
1765Done
1766```
1767
1768### ipmaddr promiscuous
1769
1770Get multicast promiscuous mode.
1771
1772```bash
1773> ipmaddr promiscuous
1774Disabled
1775Done
1776```
1777
1778### ipmaddr promiscuous enable
1779
1780Enable multicast promiscuous mode.
1781
1782```bash
1783> ipmaddr promiscuous enable
1784Done
1785```
1786
1787### ipmaddr promiscuous disable
1788
1789Disable multicast promiscuous mode.
1790
1791```bash
1792> ipmaddr promiscuous disable
1793Done
1794```
1795
1796### ipmaddr rlatn
1797
1798Get the Realm-Local All Thread Nodes multicast address.
1799
1800```
1801> ipmaddr rlatn
1802ff33:40:fdde:ad00:beef:0:0:1
1803Done
1804```
1805
1806### joinerport \<port\>
1807
1808Set the Joiner port.
1809
1810```bash
1811> joinerport 1000
1812Done
1813```
1814
1815### keysequence counter
1816
1817Get the Thread Key Sequence Counter.
1818
1819```bash
1820> keysequence counter
182110
1822Done
1823```
1824
1825### keysequence counter \<counter\>
1826
1827Set the Thread Key Sequence Counter.
1828
1829```bash
1830> keysequence counter 10
1831Done
1832```
1833
1834### keysequence guardtime
1835
1836Get Thread Key Switch Guard Time (in hours)
1837
1838```bash
1839> keysequence guardtime
18400
1841Done
1842```
1843
1844### keysequence guardtime \<guardtime\>
1845
1846Set Thread Key Switch Guard Time (in hours) 0 means Thread Key Switch immediately if key index match
1847
1848```bash
1849> keysequence guardtime 0
1850Done
1851```
1852
1853### leaderdata
1854
1855Show the Thread Leader Data.
1856
1857```bash
1858> leaderdata
1859Partition ID: 1077744240
1860Weighting: 64
1861Data Version: 109
1862Stable Data Version: 211
1863Leader Router ID: 60
1864Done
1865```
1866
1867### leaderweight
1868
1869Get the Thread Leader Weight.
1870
1871```bash
1872> leaderweight
1873128
1874Done
1875```
1876
1877### leaderweight \<weight\>
1878
1879Set the Thread Leader Weight.
1880
1881```bash
1882> leaderweight 128
1883Done
1884```
1885
1886### linkmetrics mgmt \<ipaddr\> enhanced-ack clear
1887
1888Send a Link Metrics Management Request to clear an Enhanced-ACK Based Probing.
1889
1890- ipaddr: Peer address (SHOULD be link local address of the neighboring device).
1891
1892```bash
1893> linkmetrics mgmt fe80:0:0:0:3092:f334:1455:1ad2 enhanced-ack clear
1894Done
1895> Received Link Metrics Management Response from: fe80:0:0:0:3092:f334:1455:1ad2
1896Status: Success
1897```
1898
1899### linkmetrics mgmt \<ipaddr\> enhanced-ack register [qmr][r]
1900
1901Send a Link Metrics Management Request to register an Enhanced-ACK Based Probing.
1902
1903- ipaddr: Peer address.
1904- qmr: This specifies what metrics to query. At most two options are allowed to select (per spec 4.11.3.4.4.6).
1905 - q: Layer 2 LQI.
1906 - m: Link Margin.
1907 - r: RSSI.
1908- 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.
1909
1910```bash
1911> linkmetrics mgmt fe80:0:0:0:3092:f334:1455:1ad2 enhanced-ack register qm
1912Done
1913> Received Link Metrics Management Response from: fe80:0:0:0:3092:f334:1455:1ad2
1914Status: Success
1915
1916> linkmetrics mgmt fe80:0:0:0:3092:f334:1455:1ad2 enhanced-ack register qm r
1917Done
1918> Received Link Metrics Management Response from: fe80:0:0:0:3092:f334:1455:1ad2
1919Status: Cannot support new series
1920```
1921
1922### linkmetrics mgmt \<ipaddr\> forward \<seriesid\> [ldraX][pqmr]
1923
1924Send a Link Metrics Management Request to configure a Forward Tracking Series.
1925
1926- ipaddr: Peer address.
1927- seriesid: The Series ID.
1928- ldraX: This specifies which frames are to be accounted.
1929 - l: MLE Link Probe.
1930 - d: MAC Data.
1931 - r: MAC Data Request.
1932 - a: MAC Ack.
1933 - 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.
1934- pqmr: This specifies what metrics to query.
1935 - p: Layer 2 Number of PDUs received.
1936 - q: Layer 2 LQI.
1937 - m: Link Margin.
1938 - r: RSSI.
1939
1940```bash
1941> linkmetrics mgmt fe80:0:0:0:3092:f334:1455:1ad2 forward 1 dra pqmr
1942Done
1943> Received Link Metrics Management Response from: fe80:0:0:0:3092:f334:1455:1ad2
1944Status: SUCCESS
1945```
1946
1947### linkmetrics probe \<ipaddr\> \<seriesid\> \<length\>
1948
1949Send a MLE Link Probe message to the peer.
1950
1951- ipaddr: Peer address.
1952- seriesid: The Series ID for which this Probe message targets at.
1953- length: The length of the Probe message, valid range: [0, 64].
1954
1955```bash
1956> linkmetrics probe fe80:0:0:0:3092:f334:1455:1ad2 1 10
1957Done
1958```
1959
1960### linkmetrics query \<ipaddr\> single [pqmr]
1961
1962Perform a Link Metrics query (Single Probe).
1963
1964- ipaddr: Peer address.
1965- pqmr: This specifies what metrics to query.
1966- p: Layer 2 Number of PDUs received.
1967- q: Layer 2 LQI.
1968- m: Link Margin.
1969- r: RSSI.
1970
1971```bash
1972> linkmetrics query fe80:0:0:0:3092:f334:1455:1ad2 single qmr
1973Done
1974> Received Link Metrics Report from: fe80:0:0:0:3092:f334:1455:1ad2
1975
1976 - LQI: 76 (Exponential Moving Average)
1977 - Margin: 82 (dB) (Exponential Moving Average)
1978 - RSSI: -18 (dBm) (Exponential Moving Average)
1979```
1980
1981### linkmetrics query \<ipaddr\> forward \<seriesid\>
1982
1983Perform a Link Metrics query (Forward Tracking Series).
1984
1985- ipaddr: Peer address.
1986- seriesid: The Series ID.
1987
1988```bash
1989> linkmetrics query fe80:0:0:0:3092:f334:1455:1ad2 forward 1
1990Done
1991> Received Link Metrics Report from: fe80:0:0:0:3092:f334:1455:1ad2
1992
1993 - PDU Counter: 2 (Count/Summation)
1994 - LQI: 76 (Exponential Moving Average)
1995 - Margin: 82 (dB) (Exponential Moving Average)
1996 - RSSI: -18 (dBm) (Exponential Moving Average)
1997```
1998
1999### linkmetricsmgr disable
2000
2001Disable the Link Metrics Manager.
2002
2003`OPENTHREAD_CONFIG_LINK_METRICS_MANAGER_ENABLE` is required.
2004
2005```bash
2006> linkmetricsmgr disable
2007Done
2008```
2009
2010### linkmetricsmgr enable
2011
2012Enable the Link Metrics Manager.
2013
2014`OPENTHREAD_CONFIG_LINK_METRICS_MANAGER_ENABLE` is required.
2015
2016```bash
2017> linkmetricsmgr enable
2018Done
2019```
2020
2021### linkmetricsmgr show
2022
2023Display the Link Metrics data of all subjects. The subjects are identified by its extended address.
2024
2025`OPENTHREAD_CONFIG_LINK_METRICS_MANAGER_ENABLE` is required.
2026
2027```bash
2028
2029> linkmetricsmgr show
2030ExtAddr:827aa7f7f63e1234, LinkMargin:80, Rssi:-20
2031Done
2032```
2033
2034### locate
2035
2036Gets the current state (`In Progress` or `Idle`) of anycast locator.
2037
2038`OPENTHREAD_CONFIG_TMF_ANYCAST_LOCATOR_ENABLE` is required.
2039
2040```bash
2041> locate
2042Idle
2043Done
2044
2045> locate fdde:ad00:beef:0:0:ff:fe00:fc10
2046
2047> locate
2048In Progress
2049Done
2050```
2051
2052### locate \<anycastaddr\>
2053
2054Locate the closest destination of an anycast address (i.e., find the destination's mesh local EID and RLOC16).
2055
2056`OPENTHREAD_CONFIG_TMF_ANYCAST_LOCATOR_ENABLE` is required.
2057
2058The closest destination is determined based on the the current routing table and path costs within the Thread mesh.
2059
2060Locate the leader using its anycast address:
2061
2062```bash
2063> locate fdde:ad00:beef:0:0:ff:fe00:fc00
2064fdde:ad00:beef:0:d9d3:9000:16b:d03b 0xc800
2065Done
2066```
2067
2068Locate the closest destination of a service anycast address:
2069
2070```bash
2071
2072> srp server enable
2073Done
2074
2075> netdata show
2076Prefixes:
2077Routes:
2078Services:
207944970 5d c002 s c800
208044970 5d c002 s cc00
2081Done
2082
2083> locate fdde:ad00:beef:0:0:ff:fe00:fc10
2084fdde:ad00:beef:0:a477:dc98:a4e4:71ea 0xcc00
2085done
2086```
2087
2088### log filename \<filename\>
2089
2090- Note: Simulation Only, ie: `OPENTHREAD_EXAMPLES_SIMULATION`
2091- Requires `OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_DEBUG_UART`
2092
2093Specifies filename to capture otPlatLog() messages, useful when debugging automated test scripts on Linux when logging disrupts the automated test scripts.
2094
2095### log level
2096
2097Get the log level.
2098
2099```bash
2100> log level
21011
2102Done
2103```
2104
2105### log level \<level\>
2106
2107Set the log level.
2108
2109```bash
2110> log level 4
2111Done
2112```
2113
2114### meshdiag topology [ip6-addrs][children]
2115
2116Discover network topology (list of routers and their connections).
2117
2118This command requires `OPENTHREAD_CONFIG_MESH_DIAG_ENABLE` and `OPENTHREAD_FTD`.
2119
2120Parameters are optional and indicate additional items to discover. Can be added in any order.
2121
2122- `ip6-addrs` to discover the list of IPv6 addresses of every router.
2123- `children` to discover the child table of every router.
2124
2125Output lists all discovered routers. Information per router:
2126
2127- Router ID
2128- RLOC16
2129- Extended MAC address
2130- Thread Version (if known).
2131- Whether the router is this device is itself (`me`)
2132- Whether the router is the parent of this device when device is a child (`parent`)
2133- Whether the router is `leader`
2134- Whether the router acts as a border router providing external connectivity (`br`)
2135- List of routers to which this router has a link:
2136 - `3-links`: Router IDs to which this router has a incoming link with link quality 3
2137 - `2-links`: Router IDs to which this router has a incoming link with link quality 2
2138 - `1-links`: Router IDs to which this router has a incoming link with link quality 1
2139 - If a list if empty, it is omitted in the out.
2140- If `ip6-addrs`, list of IPv6 addresses of the router
2141- If `children`, list of all children of the router. Information per child:
2142 - RLOC16
2143 - Incoming Link Quality from perspective of parent to child (zero indicates unknown)
2144 - Child Device mode (`r` rx-on-when-idle, `d` Full Thread Device, `n` Full Network Data, `-` no flags set)
2145 - Whether the child is this device itself (`me`)
2146 - Whether the child acts as a border router providing external connectivity (`br`)
2147
2148Discover network topology:
2149
2150```bash
2151> meshdiag topology
2152id:02 rloc16:0x0800 ext-addr:8aa57d2c603fe16c ver:4 - me - leader
2153 3-links:{ 46 }
2154id:46 rloc16:0xb800 ext-addr:fe109d277e0175cc ver:4
2155 3-links:{ 02 51 57 }
2156id:33 rloc16:0x8400 ext-addr:d2e511a146b9e54d ver:4
2157 3-links:{ 51 57 }
2158id:51 rloc16:0xcc00 ext-addr:9aab43ababf05352 ver:4
2159 3-links:{ 33 57 }
2160 2-links:{ 46 }
2161id:57 rloc16:0xe400 ext-addr:dae9c4c0e9da55ff ver:4
2162 3-links:{ 46 51 }
2163 1-links:{ 33 }
2164Done
2165```
2166
2167Discover network topology with router's IPv6 addresses and children:
2168
2169```bash
2170> meshdiag topology children ip6-addrs
2171id:62 rloc16:0xf800 ext-addr:ce349873897233a5 ver:4 - me - br
2172 3-links:{ 46 }
2173 ip6-addrs:
2174 fdde:ad00:beef:0:0:ff:fe00:f800
2175 fdde:ad00:beef:0:211d:39e9:6b2e:4ad1
2176 fe80:0:0:0:cc34:9873:8972:33a5
2177 children: none
2178id:02 rloc16:0x0800 ext-addr:8aa57d2c603fe16c ver:4 - leader - br
2179 3-links:{ 46 51 }
2180 ip6-addrs:
2181 fdde:ad00:beef:0:0:ff:fe00:fc00
2182 fdde:ad00:beef:0:0:ff:fe00:800
2183 fdde:ad00:beef:0:8a36:a3eb:47ae:a9b0
2184 fe80:0:0:0:88a5:7d2c:603f:e16c
2185 children:
2186 rloc16:0x0803 lq:3, mode:rn
2187 rloc16:0x0804 lq:3, mode:rdn
2188id:33 rloc16:0x8400 ext-addr:d2e511a146b9e54d ver:4
2189 3-links:{ 57 }
2190 ip6-addrs:
2191 fdde:ad00:beef:0:0:ff:fe00:8400
2192 fdde:ad00:beef:0:824:a126:cf19:a9f4
2193 fe80:0:0:0:d0e5:11a1:46b9:e54d
2194 children: none
2195id:51 rloc16:0xcc00 ext-addr:9aab43ababf05352 ver:4
2196 3-links:{ 02 46 57 }
2197 ip6-addrs:
2198 fdde:ad00:beef:0:0:ff:fe00:cc00
2199 fdde:ad00:beef:0:2986:bba3:12d0:1dd2
2200 fe80:0:0:0:98ab:43ab:abf0:5352
2201 children: none
2202id:57 rloc16:0xe400 ext-addr:dae9c4c0e9da55ff ver:4
2203 3-links:{ 33 51 }
2204 ip6-addrs:
2205 fdde:ad00:beef:0:0:ff:fe00:e400
2206 fdde:ad00:beef:0:87d0:550:bc18:9920
2207 fe80:0:0:0:d8e9:c4c0:e9da:55ff
2208 children:
2209 rloc16:0xe402 lq:3, mode:rn - br
2210 rloc16:0xe403 lq:3, mode:rn
2211id:46 rloc16:0xb800 ext-addr:fe109d277e0175cc ver:4
2212 3-links:{ 02 51 62 }
2213 ip6-addrs:
2214 fdde:ad00:beef:0:0:ff:fe00:b800
2215 fdde:ad00:beef:0:df4d:2994:d85c:c337
2216 fe80:0:0:0:fc10:9d27:7e01:75cc
2217 children: none
2218Done
2219```
2220
2221Discover network topology with children:
2222
2223```bash
2224> meshdiag topology children
2225id:02 rloc16:0x0800 ext-addr:8aa57d2c603fe16c ver:4 - parent - leader - br
2226 3-links:{ 46 51 }
2227 children:
2228 rloc16:0x0803 lq:0, mode:rn
2229 rloc16:0x0804 lq:0, mode:rdn - me
2230id:46 rloc16:0xb800 ext-addr:fe109d277e0175cc ver:4
2231 3-links:{ 02 51 62 }
2232 children: none
2233id:33 rloc16:0x8400 ext-addr:d2e511a146b9e54d ver:4
2234 3-links:{ 57 }
2235 children: none
2236id:51 rloc16:0xcc00 ext-addr:9aab43ababf05352 ver:4
2237 3-links:{ 02 46 57 }
2238 children: none
2239id:57 rloc16:0xe400 ext-addr:dae9c4c0e9da55ff ver:4
2240 3-links:{ 33 51 }
2241 children:
2242 rloc16:0xe402 lq:3, mode:rn - br
2243 rloc16:0xe403 lq:3, mode:rn
2244id:62 rloc16:0xf800 ext-addr:ce349873897233a5 ver:4 - br
2245 3-links:{ 46 }
2246 children: none
2247```
2248
2249### meshdiag childtable \<router-rloc16\>
2250
2251Start a query for child table of a router with a given RLOC16.
2252
2253Output lists all child entries. Information per child:
2254
2255- RLOC16
2256- Extended MAC address
2257- Thread Version
2258- Timeout (in seconds)
2259- Age (seconds since last heard)
2260- Supervision interval (in seconds)
2261- Number of queued messages (in case the child is sleepy)
2262- Device Mode
2263- RSS (average and last) and link margin
2264- Error rates, frame tx (at MAC layer), IPv6 message tx (above MAC)
2265- Connection time (seconds since link establishment {dd}d.{hh}:{mm}:{ss} format)
2266- CSL info
2267 - If synchronized
2268 - Period (in unit of 10-symbols-time)
2269 - Timeout (in seconds)
2270 - Channel
2271
2272```bash
2273> meshdiag childtable 0x6400
2274rloc16:0x6402 ext-addr:8e6f4d323bbed1fe ver:4
2275 timeout:120 age:36 supvn:129 q-msg:0
2276 rx-on:yes type:ftd full-net:yes
2277 rss - ave:-20 last:-20 margin:80
2278 err-rate - frame:11.51% msg:0.76%
2279 conn-time:00:11:07
2280 csl - sync:no period:0 timeout:0 channel:0
2281rloc16:0x6403 ext-addr:ee24e64ecf8c079a ver:4
2282 timeout:120 age:19 supvn:129 q-msg:0
2283 rx-on:no type:mtd full-net:no
2284 rss - ave:-20 last:-20 margin:80
2285 err-rate - frame:0.73% msg:0.00%
2286 conn-time:01:08:53
2287 csl - sync:no period:0 timeout:0 channel:0
2288Done
2289```
2290
2291### meshdiag childip6 \<parent-rloc16\>
2292
2293Send a query to a parent to retrieve the IPv6 addresses of all its MTD children.
2294
2295```bash
2296> meshdiag childip6 0xdc00
2297child-rloc16: 0xdc02
2298 fdde:ad00:beef:0:ded8:cd58:b73:2c21
2299 fd00:2:0:0:c24a:456:3b6b:c597
2300 fd00:1:0:0:120b:95fe:3ecc:d238
2301child-rloc16: 0xdc03
2302 fdde:ad00:beef:0:3aa6:b8bf:e7d6:eefe
2303 fd00:2:0:0:8ff8:a188:7436:6720
2304 fd00:1:0:0:1fcf:5495:790a:370f
2305Done
2306```
2307
2308### meshdiag routerneighbortable \<router-rloc16\>
2309
2310Start a query for router neighbor table of a router with a given RLOC16.
2311
2312Output lists all router neighbor entries. Information per entry:
2313
2314- RLOC16
2315- Extended MAC address
2316- Thread Version
2317- RSS (average and last) and link margin
2318- Error rates, frame tx (at MAC layer), IPv6 message tx (above MAC)
2319- Connection time (seconds since link establishment {dd}d.{hh}:{mm}:{ss} format)
2320
2321```bash
2322> meshdiag routerneighbortable 0x7400
2323rloc16:0x9c00 ext-addr:764788cf6e57a4d2 ver:4
2324 rss - ave:-20 last:-20 margin:80
2325 err-rate - frame:1.38% msg:0.00%
2326 conn-time:01:54:02
2327rloc16:0x7c00 ext-addr:4ed24fceec9bf6d3 ver:4
2328 rss - ave:-20 last:-20 margin:80
2329 err-rate - frame:0.72% msg:0.00%
2330 conn-time:00:11:27
2331Done
2332```
2333
2334### mliid \<iid\>
2335
2336Set the Mesh Local IID.
2337
2338It must be used before Thread stack is enabled.
2339
2340Only for testing/reference device.
2341
2342```bash
2343> mliid 1122334455667788
2344Done
2345```
2346
2347### mlr reg \<ipaddr\> ... [timeout]
2348
2349Register Multicast Listeners to Primary Backbone Router, with an optional `timeout` (in seconds).
2350
2351Omit `timeout` to use the default MLR timeout on the Primary Backbone Router.
2352
2353Use `timeout = 0` to deregister Multicast Listeners.
2354
2355NOTE: Only for Thread 1.2 Commissioner FTD device.
2356
2357```bash
2358> mlr reg ff04::1
2359status 0, 0 failed
2360Done
2361> mlr reg ff04::1 ff04::2 ff02::1
2362status 2, 1 failed
2363ff02:0:0:0:0:0:0:1
2364Done
2365> mlr reg ff04::1 ff04::2 1000
2366status 0, 0 failed
2367Done
2368> mlr reg ff04::1 ff04::2 0
2369status 0, 0 failed
2370Done
2371```
2372
2373### mode
2374
2375Get the Thread Device Mode value.
2376
2377- -: no flags set (rx-off-when-idle, minimal Thread device, stable network data)
2378- r: rx-on-when-idle
2379- d: Full Thread Device
2380- n: Full Network Data
2381
2382```bash
2383> mode
2384rdn
2385Done
2386```
2387
2388### mode [rdn]
2389
2390Set the Thread Device Mode value.
2391
2392- -: no flags set (rx-off-when-idle, minimal Thread device, stable network data)
2393- r: rx-on-when-idle
2394- d: Full Thread Device
2395- n: Full Network Data
2396
2397```bash
2398> mode rdn
2399Done
2400```
2401
2402```bash
2403> mode -
2404Done
2405```
2406
2407### multiradio
2408
2409Get the list of supported radio links by the device.
2410
2411This command is always available, even when only a single radio is supported by the device.
2412
2413```bash
2414> multiradio
2415[15.4, TREL]
2416Done
2417```
2418
2419### multiradio neighbor list
2420
2421Get the list of neighbors and their supported radios and their preference.
2422
2423This command is only available when device supports more than one radio link.
2424
2425```bash
2426> multiradio neighbor list
2427ExtAddr:3a65bc38dbe4a5be, RLOC16:0xcc00, Radios:[15.4(255), TREL(255)]
2428ExtAddr:17df23452ee4a4be, RLOC16:0x1300, Radios:[15.4(255)]
2429Done
2430```
2431
2432### multiradio neighbor \<ext address\>
2433
2434Get the radio info for specific neighbor with a given extended address.
2435
2436This command is only available when device supports more than one radio link.
2437
2438```bash
2439> multiradio neighbor 3a65bc38dbe4a5be
2440[15.4(255), TREL(255)]
2441Done
2442```
2443
2444### nat64 cidr
2445
2446Gets the IPv4 configured CIDR in the NAT64 translator.
2447
2448`OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE` is required.
2449
2450```bash
2451> nat64 cidr
2452192.168.255.0/24
2453Done
2454```
2455
2456### nat64 cidr \<IPv4 address\>
2457
2458Sets the IPv4 CIDR in the NAT64 translator.
2459
2460Note:
2461
2462- `OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE` is required.
2463- A valid CIDR must have a non-zero prefix length.
2464- When updating the CIDR, NAT64 translator will be reset and all existing sessions will be expired.
2465
2466```bash
2467> nat64 cidr 192.168.100.0/24
2468Done
2469```
2470
2471### nat64 disable
2472
2473Disable NAT64 functions, including the translator and the prefix publishing.
2474
2475This command will reset the mapping table in the translator (if NAT64 translator is enabled in the build).
2476
2477`OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE` or `OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE` are required.
2478
2479```bash
2480> nat64 disable
2481Done
2482```
2483
2484### nat64 enable
2485
2486Enable NAT64 functions, including the translator and the prefix publishing.
2487
2488This command can be called anytime.
2489
2490`OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE` or `OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE` are required.
2491
2492```bash
2493> nat64 enable
2494Done
2495```
2496
2497### nat64 state
2498
2499Gets the state of NAT64 functions.
2500
2501Possible results for prefix manager are (`OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE` is required):
2502
2503- `Disabled`: NAT64 prefix manager is disabled.
2504- `NotRunning`: NAT64 prefix manager is enabled, but is not running, probably because the routing manager is disabled.
2505- `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.
2506- `Active`: NAT64 prefix manager is enabled, running and publishing a NAT64 prefix.
2507
2508Possible results for NAT64 translator are (`OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE` is required):
2509
2510- `Disabled`: NAT64 translator is disabled.
2511- `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.
2512- `Active`: NAT64 translator is enabled and is translating packets.
2513
2514`OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE` or `OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE` are required.
2515
2516```bash
2517> nat64 state
2518PrefixManager: NotRunning
2519Translator: NotRunning
2520Done
2521
2522> nat64 state
2523PrefixManager: Idle
2524Translator: NotRunning
2525Done
2526
2527> nat64 state
2528PrefixManager: Active
2529Translator: Active
2530Done
2531```
2532
2533### nat64 mappings
2534
2535Get the NAT64 translator mappings.
2536
2537`OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE` is required.
2538
2539```bash
2540> nat64 mappings
2541| | Address | | 4 to 6 | 6 to 4 |
2542+----------+---------------------------+--------+--------------+--------------+
2543| ID | IPv6 | IPv4 | Expiry | Pkts | Bytes | Pkts | Bytes |
2544+----------+------------+--------------+--------+------+-------+------+-------+
2545| 00021cb9 | fdc7::df79 | 192.168.64.2 | 7196s | 6 | 456 | 11 | 1928 |
2546| | TCP | 0 | 0 | 0 | 0 |
2547| | UDP | 1 | 136 | 16 | 1608 |
2548| | ICMP | 5 | 320 | 5 | 320 |
2549```
2550
2551### nat64 counters
2552
2553Get the NAT64 translator packet and error counters.
2554
2555`OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE` is required.
2556
2557```bash
2558> nat64 counters
2559| | 4 to 6 | 6 to 4 |
2560+---------------+-------------------------+-------------------------+
2561| Protocol | Pkts | Bytes | Pkts | Bytes |
2562+---------------+----------+--------------+----------+--------------+
2563| Total | 11 | 704 | 11 | 704 |
2564| TCP | 0 | 0 | 0 | 0 |
2565| UDP | 0 | 0 | 0 | 0 |
2566| ICMP | 11 | 704 | 11 | 704 |
2567| Errors | Pkts | Pkts |
2568+---------------+-------------------------+-------------------------+
2569| Total | 8 | 4 |
2570| Illegal Pkt | 0 | 0 |
2571| Unsup Proto | 0 | 0 |
2572| No Mapping | 2 | 0 |
2573Done
2574```
2575
2576### neighbor linkquality
2577
2578Print link quality info for all neighbors.
2579
2580```bash
2581> neighbor linkquality
2582| RLOC16 | Extended MAC | Frame Error | Msg Error | Avg RSS | Last RSS | Age |
2583+--------+------------------+-------------+-----------+---------+----------+-------+
2584| 0xe800 | 9e2fa4e1b84f92db | 0.00 % | 0.00 % | -46 | -48 | 1 |
2585| 0xc001 | 0ad7ed6beaa6016d | 4.67 % | 0.08 % | -68 | -72 | 10 |
2586Done
2587```
2588
2589### neighbor list
2590
2591List RLOC16 of neighbors.
2592
2593```bash
2594> neighbor list
25950xcc01 0xc800 0xf000
2596Done
2597```
2598
2599### neighbor table
2600
2601Print table of neighbors.
2602
2603```bash
2604> neighbor table
2605| Role | RLOC16 | Age | Avg RSSI | Last RSSI |R|D|N| Extended MAC |
2606+------+--------+-----+----------+-----------+-+-+-+------------------+
2607| C | 0xcc01 | 96 | -46 | -46 |1|1|1| 1eb9ba8a6522636b |
2608| R | 0xc800 | 2 | -29 | -29 |1|1|1| 9a91556102c39ddb |
2609| R | 0xf000 | 3 | -28 | -28 |1|1|1| 0ad7ed6beaa6016d |
2610Done
2611```
2612
2613### neighbor conntime
2614
2615Print connection time and age of neighbors.
2616
2617The table provides the following info per neighbor:
2618
2619- RLOC16
2620- Extended MAC address
2621- Age (seconds since last heard from neighbor)
2622- Connection time (seconds since link establishment with neighbor)
2623
2624Duration 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>`.
2625
2626```bash
2627> neighbor conntime
2628| RLOC16 | Extended MAC | Last Heard (Age) | Connection Time |
2629+--------+------------------+------------------+------------------+
2630| 0x8401 | 1a28be396a14a318 | 00:00:13 | 00:07:59 |
2631| 0x5c00 | 723ebf0d9eba3264 | 00:00:03 | 00:11:27 |
2632| 0xe800 | ce53628a1e3f5b3c | 00:00:02 | 00:00:15 |
2633Done
2634```
2635
2636### neighbor conntime list
2637
2638Print connection time and age of neighbors.
2639
2640This 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.
2641
2642```bash
2643> neighbor conntime list
26440x8401 1a28be396a14a318 age:63 conn-time:644
26450x5c00 723ebf0d9eba3264 age:23 conn-time:852
26460xe800 ce53628a1e3f5b3c age:23 conn-time:180
2647Done
2648```
2649
2650### netstat
2651
2652List all UDP sockets.
2653
2654```bash
2655> netstat
2656| Local Address | Peer Address |
2657+-------------------------------------------------+-------------------------------------------------+
2658| [0:0:0:0:0:0:0:0]:49153 | [0:0:0:0:0:0:0:0]:0 |
2659| [0:0:0:0:0:0:0:0]:49152 | [0:0:0:0:0:0:0:0]:0 |
2660| [0:0:0:0:0:0:0:0]:61631 | [0:0:0:0:0:0:0:0]:0 |
2661| [0:0:0:0:0:0:0:0]:19788 | [0:0:0:0:0:0:0:0]:0 |
2662Done
2663```
2664
2665### networkdiagnostic get \<addr\> \<type\> ..
2666
2667Send network diagnostic request to retrieve tlv of \<type\>s.
2668
2669If \<addr\> is unicast address, `Diagnostic Get` will be sent. if \<addr\> is multicast address, `Diagnostic Query` will be sent.
2670
2671```bash
2672> networkdiagnostic get fdde:ad00:beef:0:0:ff:fe00:fc00 0 1 6
2673> DIAG_GET.rsp/ans: 00080e336e1c41494e1c01020c000608640b0f674074c503
2674Ext Address: '0e336e1c41494e1c'
2675Rloc16: 0x0c00
2676Leader Data:
2677 PartitionId: 0x640b0f67
2678 Weighting: 64
2679 DataVersion: 116
2680 StableDataVersion: 197
2681 LeaderRouterId: 0x03
2682Done
2683
2684> networkdiagnostic get ff02::1 0 1
2685> DIAG_GET.rsp/ans: 00080e336e1c41494e1c01020c00
2686Ext Address: '0e336e1c41494e1c'
2687Rloc16: 0x0c00
2688Done
2689DIAG_GET.rsp/ans: 00083efcdb7e3f9eb0f201021800
2690Ext Address: '3efcdb7e3f9eb0f2'
2691Rloc16: 0x1800
2692Done
2693```
2694
2695### networkdiagnostic reset \<addr\> \<type\> ..
2696
2697Send network diagnostic request to reset \<addr\>'s tlv of \<type\>s. Currently only `MAC Counters`(9) is supported.
2698
2699```bash
2700> diagnostic reset fd00:db8::ff:fe00:0 9
2701Done
2702```
2703
2704### networkidtimeout
2705
2706Get the NETWORK_ID_TIMEOUT parameter used in the Router role.
2707
2708```bash
2709> networkidtimeout
2710120
2711Done
2712```
2713
2714### networkidtimeout \<timeout\>
2715
2716Set the NETWORK_ID_TIMEOUT parameter used in the Router role.
2717
2718```bash
2719> networkidtimeout 120
2720Done
2721```
2722
2723### networkkey
2724
2725Get the Thread Network Key value.
2726
2727```bash
2728> networkkey
272900112233445566778899aabbccddeeff
2730Done
2731```
2732
2733### networkkey \<key\>
2734
2735Set the Thread Network Key value.
2736
2737```bash
2738> networkkey 00112233445566778899aabbccddeeff
2739Done
2740```
2741
2742### networkname
2743
2744Get the Thread Network Name.
2745
2746```bash
2747> networkname
2748OpenThread
2749Done
2750```
2751
2752### networkname \<name\>
2753
2754Set the Thread Network Name.
2755
2756**NOTE** The current commissioning credential becomes stale after changing this value. Use [pskc](#pskc--p-keypassphrase) to reset.
2757
2758```bash
2759> networkname OpenThread
2760Done
2761```
2762
2763### networktime
2764
2765Get the Thread network time and the time sync parameters.
2766
2767```bash
2768> networktime
2769Network Time: 21084154us (synchronized)
2770Time Sync Period: 100s
2771XTAL Threshold: 300ppm
2772Done
2773```
2774
2775### networktime \<timesyncperiod\> \<xtalthreshold\>
2776
2777Set time sync parameters
2778
2779- timesyncperiod: The time synchronization period, in seconds.
2780- xtalthreshold: The XTAL accuracy threshold for a device to become Router-Capable device, in PPM.
2781
2782```bash
2783> networktime 100 300
2784Done
2785```
2786
2787### nexthop
2788
2789Output the table of allocated Router IDs and the current next hop (as Router ID) and path cost for each ID.
2790
2791```bash
2792> nexthop
2793| ID |NxtHop| Cost |
2794+------+------+------+
2795| 9 | 9 | 1 |
2796| 25 | 25 | 0 |
2797| 30 | 30 | 1 |
2798| 46 | - | - |
2799| 50 | 30 | 3 |
2800| 60 | 30 | 2 |
2801Done
2802```
2803
2804### nexthop \<rloc16\>
2805
2806Get the next hop (as RLOC16) and path cost towards a given RLOC16 destination.
2807
2808```bash
2809> nexthop 0xc000
28100xc000 cost:0
2811Done
2812
2813nexthop 0x8001
28140x2000 cost:3
2815Done
2816```
2817
2818### panid
2819
2820Get the IEEE 802.15.4 PAN ID value.
2821
2822```bash
2823> panid
28240xdead
2825Done
2826```
2827
2828### panid \<panid\>
2829
2830Set the IEEE 802.15.4 PAN ID value.
2831
2832```bash
2833> panid 0xdead
2834Done
2835```
2836
2837### parent
2838
2839Get the diagnostic information for a Thread Router as parent.
2840
2841Note: 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.
2842
2843```bash
2844> parent
2845Ext Addr: be1857c6c21dce55
2846Rloc: 5c00
2847Link Quality In: 3
2848Link Quality Out: 3
2849Age: 20
2850Version: 4
2851Done
2852```
2853
2854Note: When `OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE` is enabled, this command will return two extra lines with information relevant for CSL Receiver operation.
2855
2856```bash
2857CSL clock accuracy: 20
2858CSL uncertainty: 5
2859```
2860
2861### parentpriority
2862
2863Get the assigned parent priority value, -2 means not assigned.
2864
2865```bash
2866> parentpriority
28671
2868Done
2869```
2870
2871### parentpriority \<parentpriority\>
2872
2873Set the assigned parent priority value: 1, 0, -1 or -2.
2874
2875```bash
2876> parentpriority 1
2877Done
2878```
2879
2880### partitionid
2881
2882Get the Thread Network Partition ID.
2883
2884```bash
2885> partitionid
28864294967295
2887Done
2888```
2889
2890### partitionid preferred
2891
2892Get the preferred Thread Leader Partition ID.
2893
2894`OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is required.
2895
2896```bash
2897> partitionid preferred
28984294967295
2899Done
2900```
2901
2902### partitionid preferred \<partitionid\>
2903
2904Set the preferred Thread Leader Partition ID.
2905
2906`OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is required.
2907
2908```bash
2909> partitionid preferred 0xffffffff
2910Done
2911```
2912
2913### ping \[async\] \[-I source\] \[-m] \<ipaddr\> \[size\] \[count\] \[interval\] \[hoplimit\] \[timeout\]
2914
2915Send an ICMPv6 Echo Request.
2916
2917- async: Use the non-blocking mode. New commands are allowed before the ping process terminates.
2918- source: The source IPv6 address of the echo request.
2919- -m: multicast loop, which allows looping back pings to multicast addresses that the device itself is subscribed to.
2920- size: The number of data bytes to be sent.
2921- count: The number of ICMPv6 Echo Requests to be sent.
2922- interval: The interval between two consecutive ICMPv6 Echo Requests in seconds. The value may have fractional form, for example `0.5`.
2923- hoplimit: The hoplimit of ICMPv6 Echo Request to be sent.
2924- 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`.
2925
2926```bash
2927> ping fd00:db8:0:0:76b:6a05:3ae9:a61a
2928> 16 bytes from fd00:db8:0:0:76b:6a05:3ae9:a61a: icmp_seq=5 hlim=64 time=0ms
29291 packets transmitted, 1 packets received. Packet loss = 0.0%. Round-trip min/avg/max = 0/0.0/0 ms.
2930Done
2931
2932> ping -I fd00:db8:0:0:76b:6a05:3ae9:a61a ff02::1 100 1 1 1
2933> 108 bytes from fd00:db8:0:0:f605:fb4b:d429:d59a: icmp_seq=4 hlim=64 time=7ms
29341 packets transmitted, 1 packets received. Round-trip min/avg/max = 7/7.0/7 ms.
2935Done
2936```
2937
2938The address can be an IPv4 address, which will be synthesized to an IPv6 address using the preferred NAT64 prefix from the network data.
2939
2940> Note: The command will return `InvalidState` when the preferred NAT64 prefix is unavailable.
2941
2942```bash
2943> ping 172.17.0.1
2944Pinging synthesized IPv6 address: fdde:ad00:beef:2:0:0:ac11:1
2945> 16 bytes from fdde:ad00:beef:2:0:0:ac11:1: icmp_seq=5 hlim=64 time=0ms
29461 packets transmitted, 1 packets received. Packet loss = 0.0%. Round-trip min/avg/max = 0/0.0/0 ms.
2947Done
2948```
2949
2950### ping stop
2951
2952Stop sending ICMPv6 Echo Requests.
2953
2954```bash
2955> ping stop
2956Done
2957```
2958
2959### platform
2960
2961Print the current platform
2962
2963```bash
2964> platform
2965NRF52840
2966Done
2967```
2968
2969### pollperiod
2970
2971Get the customized data poll period of sleepy end device (milliseconds). Only for certification test.
2972
2973```bash
2974> pollperiod
29750
2976Done
2977```
2978
2979### pollperiod \<pollperiod\>
2980
2981Set the customized data poll period for sleepy end device (milliseconds >= 10ms). Only for certification test.
2982
2983```bash
2984> pollperiod 10
2985Done
2986```
2987
2988### pskc
2989
2990Get pskc in hex format.
2991
2992```bash
2993> pskc
299400000000000000000000000000000000
2995Done
2996```
2997
2998### pskc [-p] \<key\>|\<passphrase\>
2999
3000With `-p` generate pskc from \<passphrase\> (UTF-8 encoded) together with **current** network name and extended PAN ID, otherwise set pskc as \<key\> (hex format).
3001
3002```bash
3003> pskc 67c0c203aa0b042bfb5381c47aef4d9e
3004Done
3005> pskc -p 123456
3006Done
3007```
3008
3009### pskcref
3010
3011Get pskc key reference.
3012
3013`OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE` is required.
3014
3015```bash
3016> pskcref
30170x80000000
3018Done
3019```
3020
3021### pskcref \<keyref\>
3022
3023Set pskc key reference as \<keyref\>.
3024
3025`OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE` is required.
3026
3027```bash
3028> pskcref 0x20017
3029Done
3030```
3031
3032### preferrouterid \<routerid\>
3033
3034Prefer a Router ID when solicit router id from Leader.
3035
3036```bash
3037> preferrouterid 16
3038Done
3039```
3040
3041### prefix
3042
3043Get 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.
3044
3045```bash
3046> prefix
30472001:dead:beef:cafe::/64 paros med
3048- fd00:7d03:7d03:7d03::/64 prosD med
3049Done
3050```
3051
3052### prefix add \<prefix\> [padcrosnD][prf]
3053
3054Add a valid prefix to the Network Data.
3055
3056Note: The Domain Prefix flag (`D`) is only available for Thread 1.2.
3057
3058- p: Preferred flag
3059- a: Stateless IPv6 Address Autoconfiguration flag
3060- d: DHCPv6 IPv6 Address Configuration flag
3061- c: DHCPv6 Other Configuration flag
3062- r: Default Route flag
3063- o: On Mesh flag
3064- s: Stable flag
3065- n: Nd Dns flag
3066- D: Domain Prefix flag
3067- prf: Default router preference, which may be 'high', 'med', or 'low'.
3068
3069```bash
3070> prefix add 2001:dead:beef:cafe::/64 paros med
3071Done
3072
3073> prefix add fd00:7d03:7d03:7d03::/64 prosD med
3074Done
3075```
3076
3077### prefix meshlocal
3078
3079Get the mesh local prefix.
3080
3081```bash
3082> prefix meshlocal
3083fdde:ad00:beef:0::/64
3084Done
3085```
3086
3087### prefix meshlocal <prefix>
3088
3089Set the mesh local prefix.
3090
3091```bash
3092> prefix meshlocal fdde:ad00:beef:0::/64
3093Done
3094```
3095
3096### prefix remove \<prefix\>
3097
3098Invalidate a prefix in the Network Data.
3099
3100```bash
3101> prefix remove 2001:dead:beef:cafe::/64
3102Done
3103```
3104
3105### promiscuous
3106
3107Get radio promiscuous property.
3108
3109```bash
3110> promiscuous
3111Disabled
3112Done
3113```
3114
3115### promiscuous enable
3116
3117Enable radio promiscuous operation and print raw packet content.
3118
3119```bash
3120> promiscuous enable
3121Done
3122```
3123
3124### promiscuous disable
3125
3126Disable radio promiscuous operation.
3127
3128```bash
3129> promiscuous disable
3130Done
3131```
3132
3133### radio enable
3134
3135Enable radio.
3136
3137```bash
3138> radio enable
3139Done
3140```
3141
3142### radio disable
3143
3144Disable radio.
3145
3146```bash
3147> radio disable
3148Done
3149```
3150
3151### radio stats
3152
3153`OPENTHREAD_CONFIG_RADIO_STATS_ENABLE` is required. This feature is only available on FTD and MTD.
3154
3155The 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.
3156
3157```bash
3158> radio stats
3159Radio Statistics:
3160Total Time: 67.756s
3161Tx Time: 0.022944s (0.03%)
3162Rx Time: 1.482353s (2.18%)
3163Sleep Time: 66.251128s (97.77%)
3164Disabled Time: 0.000080s (0.00%)
3165Done
3166```
3167
3168### radio stats clear
3169
3170`OPENTHREAD_CONFIG_RADIO_STATS_ENABLE` is required. This feature is only available on FTD and MTD.
3171
3172This command resets the radio statistics. It sets all the time to 0.
3173
3174```bash
3175> radio stats clear
3176Done
3177```
3178
3179### radiofilter
3180
3181`OPENTHREAD_CONFIG_MAC_FILTER_ENABLE` is required.
3182
3183The radio filter is mainly intended for testing. It can be used to temporarily block all tx/rx on the IEEE 802.15.4 radio.
3184
3185When 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).
3186
3187Get radio filter status (enabled or disabled).
3188
3189```bash
3190> radiofilter
3191Disabled
3192Done
3193```
3194
3195### radiofilter enable
3196
3197`OPENTHREAD_CONFIG_MAC_FILTER_ENABLE` is required.
3198
3199Enable radio radio filter.
3200
3201```bash
3202> radiofilter enable
3203Done
3204```
3205
3206### radiofilter disable
3207
3208`OPENTHREAD_CONFIG_MAC_FILTER_ENABLE` is required.
3209
3210Disable radio radio filter.
3211
3212```bash
3213> radiofilter disable
3214Done
3215```
3216
3217### rcp
3218
3219RCP-related commands.
3220
3221### region
3222
3223Set the radio region, this can affect the transmit power limit.
3224
3225```bash
3226> region US
3227Done
3228> region
3229US
3230Done
3231```
3232
3233### rcp version
3234
3235Print RCP version string.
3236
3237```bash
3238> rcp version
3239OPENTHREAD/20191113-00825-g82053cc9d-dirty; SIMULATION; Jun 4 2020 17:53:16
3240Done
3241```
3242
3243### releaserouterid \<routerid\>
3244
3245Release a Router ID that has been allocated by the device in the Leader role.
3246
3247```bash
3248> releaserouterid 16
3249Done
3250```
3251
3252### reset
3253
3254Signal a platform reset.
3255
3256```bash
3257> reset
3258```
3259
3260### reset bootloader
3261
3262Signal a platform reset to bootloader mode, if supported.
3263
3264Requires `OPENTHREAD_CONFIG_PLATFORM_BOOTLOADER_MODE_ENABLE`.
3265
3266```bash
3267> reset bootloader
3268Done
3269```
3270
3271### rloc16
3272
3273Get the Thread RLOC16 value.
3274
3275```bash
3276> rloc16
32770xdead
3278Done
3279```
3280
3281### route
3282
3283Get the external route list in the local Network Data.
3284
3285```bash
3286> route
32872001:dead:beef:cafe::/64 s med
3288Done
3289```
3290
3291### route add \<prefix\> [sna][prf]
3292
3293Add a valid external route to the Network Data.
3294
3295- s: Stable flag
3296- n: NAT64 flag
3297- a: Advertising PIO (AP) flag
3298- prf: Default Router Preference, which may be: 'high', 'med', or 'low'.
3299
3300```bash
3301> route add 2001:dead:beef:cafe::/64 s med
3302Done
3303```
3304
3305### route remove \<prefix\>
3306
3307Invalidate a external route in the Network Data.
3308
3309```bash
3310> route remove 2001:dead:beef:cafe::/64
3311Done
3312```
3313
3314### router list
3315
3316List allocated Router IDs.
3317
3318```bash
3319> router list
33208 24 50
3321Done
3322```
3323
3324### router table
3325
3326Print table of routers.
3327
3328```bash
3329> router table
3330| ID | RLOC16 | Next Hop | Path Cost | LQ In | LQ Out | Age | Extended MAC | Link |
3331+----+--------+----------+-----------+-------+--------+-----+------------------+------+
3332| 22 | 0x5800 | 63 | 0 | 0 | 0 | 0 | 0aeb8196c9f61658 | 0 |
3333| 49 | 0xc400 | 63 | 0 | 3 | 3 | 0 | faa1c03908e2dbf2 | 1 |
3334Done
3335```
3336
3337### router \<id\>
3338
3339Print diagnostic information for a Thread Router. The `id` may be a Router ID or an RLOC16.
3340
3341```bash
3342> router 50
3343Alloc: 1
3344Router ID: 50
3345Rloc: c800
3346Next Hop: c800
3347Link: 1
3348Ext Addr: e2b3540590b0fd87
3349Cost: 0
3350Link Quality In: 3
3351Link Quality Out: 3
3352Age: 3
3353Done
3354```
3355
3356```bash
3357> router 0xc800
3358Alloc: 1
3359Router ID: 50
3360Rloc: c800
3361Next Hop: c800
3362Link: 1
3363Ext Addr: e2b3540590b0fd87
3364Cost: 0
3365Link Quality In: 3
3366Link Quality Out: 3
3367Age: 7
3368Done
3369```
3370
3371### routerdowngradethreshold
3372
3373Get the ROUTER_DOWNGRADE_THRESHOLD value.
3374
3375```bash
3376> routerdowngradethreshold
337723
3378Done
3379```
3380
3381### routerdowngradethreshold \<threshold\>
3382
3383Set the ROUTER_DOWNGRADE_THRESHOLD value.
3384
3385```bash
3386> routerdowngradethreshold 23
3387Done
3388```
3389
3390### routereligible
3391
3392Indicates whether the router role is enabled or disabled.
3393
3394```bash
3395> routereligible
3396Enabled
3397Done
3398```
3399
3400### routereligible enable
3401
3402Enable the router role.
3403
3404```bash
3405> routereligible enable
3406Done
3407```
3408
3409### routereligible disable
3410
3411Disable the router role.
3412
3413```bash
3414> routereligible disable
3415Done
3416```
3417
3418### routerselectionjitter
3419
3420Get the ROUTER_SELECTION_JITTER value.
3421
3422```bash
3423> routerselectionjitter
3424120
3425Done
3426```
3427
3428### routerselectionjitter \<jitter\>
3429
3430Set the ROUTER_SELECTION_JITTER value.
3431
3432```bash
3433> routerselectionjitter 120
3434Done
3435```
3436
3437### routerupgradethreshold
3438
3439Get the ROUTER_UPGRADE_THRESHOLD value.
3440
3441```bash
3442> routerupgradethreshold
344316
3444Done
3445```
3446
3447### routerupgradethreshold \<threshold\>
3448
3449Set the ROUTER_UPGRADE_THRESHOLD value.
3450
3451```bash
3452> routerupgradethreshold 16
3453Done
3454```
3455
3456### childrouterlinks
3457
3458Get the MLE_CHILD_ROUTER_LINKS value.
3459
3460```bash
3461> childrouterlinks
346216
3463Done
3464```
3465
3466### childrouterlinks \<number_of_links\>
3467
3468Set the MLE_CHILD_ROUTER_LINKS value.
3469
3470```bash
3471> childrouterlinks 16
3472Done
3473```
3474
3475### scan \[channel\]
3476
3477Perform an IEEE 802.15.4 Active Scan.
3478
3479- channel: The channel to scan on. If no channel is provided, the active scan will cover all valid channels.
3480
3481```bash
3482> scan
3483| PAN | MAC Address | Ch | dBm | LQI |
3484+------+------------------+----+-----+-----+
3485| ffff | f1d92a82c8d8fe43 | 11 | -20 | 0 |
3486Done
3487```
3488
3489### scan energy \[duration\] \[channel\]
3490
3491Perform an IEEE 802.15.4 Energy Scan.
3492
3493- duration: The time in milliseconds to spend scanning each channel.
3494
3495```bash
3496> scan energy 10
3497| Ch | RSSI |
3498+----+------+
3499| 11 | -59 |
3500| 12 | -62 |
3501| 13 | -67 |
3502| 14 | -61 |
3503| 15 | -87 |
3504| 16 | -86 |
3505| 17 | -86 |
3506| 18 | -52 |
3507| 19 | -58 |
3508| 20 | -82 |
3509| 21 | -76 |
3510| 22 | -82 |
3511| 23 | -74 |
3512| 24 | -81 |
3513| 25 | -88 |
3514| 26 | -71 |
3515Done
3516```
3517
3518```bash
3519> scan energy 10 20
3520| Ch | RSSI |
3521+----+------+
3522| 20 | -82 |
3523Done
3524```
3525
3526### service
3527
3528Module for controlling service registration in Network Data. Each change in service registration must be sent to leader by `netdata register` command before taking effect.
3529
3530### service add \<enterpriseNumber\> \<serviceData\> \<serverData\>
3531
3532Add service to the Network Data.
3533
3534- enterpriseNumber: IANA enterprise number
3535- serviceData: hex-encoded binary service data
3536- serverData: hex-encoded binary server data
3537
3538```bash
3539> service add 44970 112233 aabbcc
3540Done
3541> netdata register
3542Done
3543```
3544
3545### service remove \<enterpriseNumber\> \<serviceData\>
3546
3547Remove service from Network Data.
3548
3549- enterpriseNumber: IANA enterprise number
3550- serviceData: hext-encoded binary service data
3551
3552```bash
3553> service remove 44970 112233
3554Done
3555> netdata register
3556Done
3557```
3558
3559### singleton
3560
3561Return true when there are no other nodes in the network, otherwise return false.
3562
3563```bash
3564> singleton
3565true or false
3566Done
3567```
3568
3569### sntp query \[SNTP server IP\] \[SNTP server port\]
3570
3571Send SNTP Query to obtain current unix epoch time (from 1st January 1970). The latter two parameters have following default values:
3572
3573- NTP server IP: 2001:4860:4806:8:: (Google IPv6 NTP Server)
3574- NTP server port: 123
3575
3576```bash
3577> sntp query
3578> SNTP response - Unix time: 1540894725 (era: 0)
3579```
3580
3581You can use NAT64 of OpenThread Border Router to reach e.g. Google IPv4 NTP Server:
3582
3583```bash
3584> sntp query 64:ff9b::d8ef:2308
3585> SNTP response - Unix time: 1540898611 (era: 0)
3586```
3587
3588### state
3589
3590Return state of current state.
3591
3592```bash
3593> state
3594offline, disabled, detached, child, router or leader
3595Done
3596```
3597
3598### state <state>
3599
3600Try to switch to state `detached`, `child`, `router` or `leader`.
3601
3602```bash
3603> state leader
3604Done
3605```
3606
3607### thread start
3608
3609Enable Thread protocol operation and attach to a Thread network.
3610
3611```bash
3612> thread start
3613Done
3614```
3615
3616### thread stop
3617
3618Disable Thread protocol operation and detach from a Thread network.
3619
3620```bash
3621> thread stop
3622Done
3623```
3624
3625### thread version
3626
3627Get the Thread Version number.
3628
3629```bash
3630> thread version
36312
3632Done
3633```
3634
3635### timeinqueue
3636
3637Print the tx queue time-in-queue histogram.
3638
3639Requires `OPENTHREAD_CONFIG_TX_QUEUE_STATISTICS_ENABLE`.
3640
3641The 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.
3642
3643Each 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.
3644
3645The collected statistics can be reset by `timeinqueue reset`.
3646
3647```bash
3648> timeinqueue
3649| Min | Max |Msg Count|
3650+------+------+---------+
3651| 0 | 9 | 1537 |
3652| 10 | 19 | 156 |
3653| 20 | 29 | 57 |
3654| 30 | 39 | 108 |
3655| 40 | 49 | 60 |
3656| 50 | 59 | 76 |
3657| 60 | 69 | 88 |
3658| 70 | 79 | 51 |
3659| 80 | 89 | 86 |
3660| 90 | 99 | 45 |
3661| 100 | 109 | 43 |
3662| 110 | 119 | 44 |
3663| 120 | 129 | 38 |
3664| 130 | 139 | 44 |
3665| 140 | 149 | 35 |
3666| 150 | 159 | 41 |
3667| 160 | 169 | 34 |
3668| 170 | 179 | 13 |
3669| 180 | 189 | 24 |
3670| 190 | 199 | 3 |
3671| 200 | 209 | 0 |
3672| 210 | 219 | 0 |
3673| 220 | 229 | 2 |
3674| 230 | 239 | 0 |
3675| 240 | 249 | 0 |
3676| 250 | 259 | 0 |
3677| 260 | 269 | 0 |
3678| 270 | 279 | 0 |
3679| 280 | 289 | 0 |
3680| 290 | 299 | 1 |
3681| 300 | 309 | 0 |
3682| 310 | 319 | 0 |
3683| 320 | 329 | 0 |
3684| 330 | 339 | 0 |
3685| 340 | 349 | 0 |
3686| 350 | 359 | 0 |
3687| 360 | 369 | 0 |
3688| 370 | 379 | 0 |
3689| 380 | 389 | 0 |
3690| 390 | 399 | 0 |
3691| 400 | 409 | 0 |
3692| 410 | 419 | 0 |
3693| 420 | 429 | 0 |
3694| 430 | 439 | 0 |
3695| 440 | 449 | 0 |
3696| 450 | 459 | 0 |
3697| 460 | 469 | 0 |
3698| 470 | 479 | 0 |
3699| 480 | 489 | 0 |
3700| 490 | inf | 0 |
3701Done
3702```
3703
3704### timeinqueue max
3705
3706Print the maximum observed time-in-queue in milliseconds.
3707
3708Requires `OPENTHREAD_CONFIG_TX_QUEUE_STATISTICS_ENABLE`.
3709
3710The 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.
3711
3712```bash
3713> timeinqueue max
3714291
3715```
3716
3717### timeinqueue reset
3718
3719Reset the TX queue time-in-queue statistics.
3720
3721```bash
3722> timeinqueue reset
3723Done
3724```
3725
3726### trel
3727
3728Indicate whether TREL radio operation is enabled or not.
3729
3730`OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE` is required for all `trel` sub-commands.
3731
3732```bash
3733> trel
3734Enabled
3735Done
3736```
3737
3738### trel enable
3739
3740Enable TREL operation.
3741
3742```bash
3743> trel enable
3744Done
3745```
3746
3747### trel disable
3748
3749Disable TREL operation.
3750
3751```bash
3752> trel disable
3753Done
3754```
3755
3756### trel filter
3757
3758Indicate whether TREL filter mode is enabled or not
3759
3760When filter mode is enabled, any rx and tx traffic through TREL interface is silently dropped. This is mainly intended for use during testing.
3761
3762```bash
3763> trel filter
3764Disabled
3765Done
3766```
3767
3768### trel filter enable
3769
3770Enable TREL filter mode.
3771
3772```bash
3773> trel filter enable
3774Done
3775```
3776
3777### trel filter disable
3778
3779Disable TREL filter mode.
3780
3781```bash
3782> trel filter disable
3783Done
3784```
3785
3786### trel peers [list]
3787
3788Get the TREL peer table in table format or as a list.
3789
3790```bash
3791> trel peers
3792| No | Ext MAC Address | Ext PAN Id | IPv6 Socket Address |
3793+-----+------------------+------------------+--------------------------------------------------+
3794| 1 | 5e5785ba3a63adb9 | f0d9c001f00d2e43 | [fe80:0:0:0:cc79:2a29:d311:1aea]:9202 |
3795| 2 | ce792a29d3111aea | dead00beef00cafe | [fe80:0:0:0:5c57:85ba:3a63:adb9]:9203 |
3796Done
3797
3798> trel peers list
3799001 ExtAddr:5e5785ba3a63adb9 ExtPanId:f0d9c001f00d2e43 SockAddr:[fe80:0:0:0:cc79:2a29:d311:1aea]:9202
3800002 ExtAddr:ce792a29d3111aea ExtPanId:dead00beef00cafe SockAddr:[fe80:0:0:0:5c57:85ba:3a63:adb9]:9203
3801Done
3802```
3803
3804### tvcheck enable
3805
3806Enable thread version check when upgrading to router or leader.
3807
3808Note: Thread version check is enabled by default.
3809
3810`OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is required.
3811
3812```bash
3813> tvcheck enable
3814Done
3815```
3816
3817### tvcheck disable
3818
3819Enable thread version check when upgrading to router or leader.
3820
3821Note: Thread version check is enabled by default.
3822
3823`OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is required.
3824
3825```bash
3826> tvcheck disable
3827Done
3828```
3829
3830### txpower
3831
3832Get the transmit power in dBm.
3833
3834```bash
3835> txpower
3836-10 dBm
3837Done
3838```
3839
3840### txpower \<txpower\>
3841
3842Set the transmit power in dBm.
3843
3844```bash
3845> txpower -10
3846Done
3847```
3848
3849### unsecureport add \<port\>
3850
3851Add a port to the allowed unsecured port list.
3852
3853```bash
3854> unsecureport add 1234
3855Done
3856```
3857
3858### unsecureport remove \<port\>
3859
3860Remove a port from the allowed unsecured port list.
3861
3862```bash
3863> unsecureport remove 1234
3864Done
3865```
3866
3867### unsecureport remove all
3868
3869Remove all ports from the allowed unsecured port list.
3870
3871```bash
3872> unsecureport remove all
3873Done
3874```
3875
3876### unsecureport get
3877
3878Print all ports from the allowed unsecured port list.
3879
3880```bash
3881> unsecureport get
38821234
3883Done
3884```
3885
3886### uptime
3887
3888This command requires `OPENTHREAD_CONFIG_UPTIME_ENABLE` to be enabled.
3889
3890Print the OpenThread stack uptime (duration since OpenThread stack initialization).
3891
3892```bash
3893> uptime
389412:46:35.469
3895Done
3896>
3897```
3898
3899### uptime ms
3900
3901This command requires `OPENTHREAD_CONFIG_UPTIME_ENABLE` to be enabled.
3902
3903Print the OpenThread stack uptime in msec.
3904
3905```bash
3906> uptime ms
3907426238
3908Done
3909>
3910```
3911
3912### vendor name
3913
3914Get the vendor name.
3915
3916```bash
3917> vendor name
3918nest
3919Done
3920```
3921
3922Set the vendor name (requires `OPENTHREAD_CONFIG_NET_DIAG_VENDOR_INFO_SET_API_ENABLE`).
3923
3924```bash
3925> vendor name nest
3926Done
3927```
3928
3929### vendor model
3930
3931Get the vendor model.
3932
3933```bash
3934> vendor model
3935Hub Max
3936Done
3937```
3938
3939Set the vendor model (requires `OPENTHREAD_CONFIG_NET_DIAG_VENDOR_INFO_SET_API_ENABLE`).
3940
3941```bash
3942> vendor model Hub\ Max
3943Done
3944```
3945
3946### vendor swversion
3947
3948Get the vendor SW version.
3949
3950```bash
3951> vendor swversion
3952Marble3.5.1
3953Done
3954```
3955
3956Set the vendor SW version (requires `OPENTHREAD_CONFIG_NET_DIAG_VENDOR_INFO_SET_API_ENABLE`).
3957
3958```bash
3959> vendor swversion Marble3.5.1
3960Done
3961```
3962
3963### version
3964
3965Print the build version information.
3966
3967```bash
3968> version
3969OPENTHREAD/gf4f2f04; Jul 1 2016 17:00:09
3970Done
3971```
3972
3973### version api
3974
3975Print API version number.
3976
3977```bash
3978> version api
397928
3980Done
3981```
3982
3983### mac retries direct
3984
3985Get the number of direct TX retries on the MAC layer.
3986
3987```bash
3988> mac retries direct
39893
3990Done
3991```
3992
3993### mac retries direct \<number\>
3994
3995Set the number of direct TX retries on the MAC layer.
3996
3997```bash
3998> mac retries direct 5
3999Done
4000```
4001
4002### mac retries indirect
4003
4004Get the number of indirect TX retries on the MAC layer.
4005
4006```bash
4007> mac retries indirect
40083
4009Done
4010```
4011
4012### mac retries indirect \<number\>
4013
4014Set the number of indirect TX retries on the MAC layer.
4015
4016```bash
4017> mac retries indirect 5
4018Done
4019```
4020
4021### mac send \<op\>
4022
4023Instruct 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.
4024
4025```bash
4026> mac send datarequest
4027Done
4028```
4029
4030```bash
4031> mac send emptydata
4032Done
4033```
4034
4035### macfilter
4036
4037List the macfilter status, including address and received signal strength filter settings.
4038
4039```bash
4040> macfilter
4041Address Mode: Allowlist
40420f6127e33af6b403 : rss -95 (lqi 1)
40430f6127e33af6b402
4044RssIn List:
40450f6127e33af6b403 : rss -95 (lqi 1)
4046Default rss: -50 (lqi 3)
4047Done
4048```
4049
4050### macfilter addr
4051
4052List the address filter status.
4053
4054```bash
4055> macfilter addr
4056Allowlist
40570f6127e33af6b403 : rss -95 (lqi 1)
40580f6127e33af6b402
4059Done
4060```
4061
4062### macfilter addr disable
4063
4064Disable address filter mode.
4065
4066```bash
4067> macfilter addr disable
4068Done
4069```
4070
4071### macfilter addr allowlist
4072
4073Enable allowlist address filter mode.
4074
4075```bash
4076> macfilter addr allowlist
4077Done
4078```
4079
4080### macfilter addr denylist
4081
4082Enable denylist address filter mode.
4083
4084```bash
4085> macfilter addr denylist
4086Done
4087```
4088
4089### macfilter addr add \<extaddr\> \[rss\]
4090
4091Add 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.
4092
4093```bash
4094> macfilter addr add 0f6127e33af6b403 -95
4095Done
4096```
4097
4098```bash
4099> macfilter addr add 0f6127e33af6b402
4100Done
4101```
4102
4103### macfilter addr remove \<extaddr\>
4104
4105Remove the IEEE802.15.4 Extended Address from the address filter.
4106
4107```bash
4108> macfilter addr remove 0f6127e33af6b402
4109Done
4110```
4111
4112### macfilter addr clear
4113
4114Clear all the IEEE802.15.4 Extended Addresses from the address filter.
4115
4116```bash
4117> macfilter addr clear
4118Done
4119```
4120
4121### macfilter rss
4122
4123List the rss filter status
4124
4125```bash
4126> macfilter rss
41270f6127e33af6b403 : rss -95 (lqi 1)
4128Default rss: -50 (lqi 3)
4129Done
4130```
4131
4132### macfilter rss add \<extaddr\> \<rss\>
4133
4134Set 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.
4135
4136```bash
4137> macfilter rss add * -50
4138Done
4139```
4140
4141```bash
4142> macfilter rss add 0f6127e33af6b404 -85
4143Done
4144```
4145
4146### macfilter rss add-lqi \<extaddr\> \<lqi\>
4147
4148Set 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
4149
4150```bash
4151> macfilter rss add-lqi * 3
4152Done
4153```
4154
4155```bash
4156> macfilter rss add-lqi 0f6127e33af6b404 2
4157Done
4158```
4159
4160### macfilter rss remove \<extaddr\>
4161
4162Removes 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.
4163
4164```bash
4165> macfilter rss remove *
4166Done
4167```
4168
4169```bash
4170> macfilter rss remove 0f6127e33af6b404
4171Done
4172```
4173
4174### macfilter rss clear
4175
4176Clear all the received signal strength or received link quality settings.
4177
4178```bash
4179> macfilter rss clear
4180Done
4181```
4182
4183### diag
4184
4185Factory Diagnostics module is enabled only when building OpenThread with `OPENTHREAD_CONFIG_DIAG_ENABLE=1` option. Go [diagnostics module][diag] for more information.
4186
4187[diag]: ../../src/core/diags/README.md
4188
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- [prefixtable](#prefixtable)
17- [rioprf](#rioprf)
18- [routeprf](#routeprf)
19- [routers](#routers)
20- [state](#state)
21
22## Command Details
23
24### help
25
26Usage: `br help`
27
28Print BR command help menu.
29
30```bash
31> br help
32counters
33disable
34enable
35omrprefix
36onlinkprefix
37pd
38prefixtable
39raoptions
40rioprf
41routeprf
42routers
43state
44Done
45```
46
47### init
48
49Usage: `br init <interface> <enabled>`
50
51Initializes the Border Routing Manager on given infrastructure interface.
52
53```bash
54> br init 2 1
55Done
56```
57
58### enable
59
60Usage: `br enable`
61
62Enable the Border Routing functionality.
63
64```bash
65> br enable
66Done
67```
68
69### disable
70
71Usage: `br disable`
72
73Disable the Border Routing functionality.
74
75```bash
76> br disable
77Done
78```
79
80### state
81
82Usage: `br state`
83
84Get the Border Routing state:
85
86- `uninitialized`: Routing Manager is uninitialized.
87- `disabled`: Routing Manager is initialized but disabled.
88- `stopped`: Routing Manager in initialized and enabled but currently stopped.
89- `running`: Routing Manager is initialized, enabled, and running.
90
91```bash
92> br state
93running
94```
95
96### counters
97
98Usage : `br counters`
99
100Get the Border Router counter.
101
102```bash
103> br counters
104Inbound Unicast: Packets 4 Bytes 320
105Inbound Multicast: Packets 0 Bytes 0
106Outbound Unicast: Packets 2 Bytes 160
107Outbound Multicast: Packets 0 Bytes 0
108RA Rx: 4
109RA TxSuccess: 2
110RA TxFailed: 0
111RS Rx: 0
112RS TxSuccess: 2
113RS TxFailed: 0
114Done
115```
116
117### omrprefix
118
119Usage: `br omrprefix [local|favored]`
120
121Get local or favored or both off-mesh-routable prefixes of the Border Router.
122
123```bash
124> br omrprefix
125Local: fdfc:1ff5:1512:5622::/64
126Favored: fdfc:1ff5:1512:5622::/64 prf:low
127Done
128
129> br omrprefix favored
130fdfc:1ff5:1512:5622::/64 prf:low
131Done
132
133> br omrprefix local
134fdfc:1ff5:1512:5622::/64
135Done
136```
137
138### onlinkprefix
139
140Usage: `br onlinkprefix [local|favored]`
141
142Get local or favored or both on-link prefixes of the Border Router.
143
144```bash
145> br onlinkprefix
146Local: fd41:2650:a6f5:0::/64
147Favored: 2600::0:1234:da12::/64
148Done
149
150> br onlinkprefix favored
1512600::0:1234:da12::/64
152Done
153
154> br onlinkprefix local
155fd41:2650:a6f5:0::/64
156Done
157```
158
159### nat64prefix
160
161Usage: `br nat64prefix [local|favored]`
162
163Get local or favored or both NAT64 prefixes of the Border Router.
164
165`OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE` is required.
166
167```bash
168> br nat64prefix
169Local: fd14:1078:b3d5:b0b0:0:0::/96
170Favored: fd14:1078:b3d5:b0b0:0:0::/96 prf:low
171Done
172
173> br nat64prefix favored
174fd14:1078:b3d5:b0b0:0:0::/96 prf:low
175Done
176
177> br nat64prefix
178fd14:1078:b3d5:b0b0:0:0::/96
179Done
180```
181
182### pd
183
184Usage: `br pd [enable|disable]`
185
186Enable/Disable the DHCPv6 PD.
187
188```bash
189> br pd enable
190Done
191
192> br pd disable
193Done
194```
195
196Usage: `br pd state`
197
198Get the state of DHCPv6 PD.
199
200`OPENTHREAD_CONFIG_BORDER_ROUTING_DHCP6_PD_ENABLE` is required.
201
202- `disabled`: DHCPv6 PD is disabled on the border router.
203- `stopped`: DHCPv6 PD in enabled but won't try to request and publish a prefix.
204- `running`: DHCPv6 PD is enabled and will try to request and publish a prefix.
205
206```bash
207> br pd state
208running
209Done
210```
211
212### prefixtable
213
214Usage: `br prefixtable`
215
216Get the discovered prefixes by Border Routing Manager on the infrastructure link.
217
218Info per prefix entry:
219
220- The prefix
221- Whether the prefix is on-link or route
222- Milliseconds since last received Router Advertisement containing this prefix
223- Prefix lifetime in seconds
224- Preferred lifetime in seconds only if prefix is on-link
225- Route preference (low, med, high) only if prefix is route (not on-link)
226- The router IPv6 address which advertising this prefix
227- Flags in received Router Advertisement header:
228 - M: Managed Address Config flag
229 - O: Other Config flag
230 - Stub: Stub Router flag (indicates whether the router is a stub router)
231
232```bash
233> br prefixtable
234prefix: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 Stub:1)
235prefix: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 Stub:1)
236Done
237```
238
239### raoptions
240
241Usage: `br raoptions <options>`
242
243Sets additional options to append at the end of emitted Router Advertisement (RA) messages. `<options>` provided as hex bytes.
244
245```bash
246> br raoptions 0400ff00020001
247Done
248```
249
250### raoptions clear
251
252Usage: `br raoptions clear`
253
254Clear any previously set additional options to append at the end of emitted Router Advertisement (RA) messages.
255
256```bash
257> br raoptions clear
258Done
259```
260
261### rioprf
262
263Usage: `br rioprf`
264
265Get the preference used when advertising Route Info Options (e.g., for discovered OMR prefixes) in emitted Router Advertisement message.
266
267```bash
268> br rioprf
269med
270Done
271```
272
273### rioprf \<prf\>
274
275Usage: `br rioprf high|med|low`
276
277Set 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.
278
279```bash
280> br rioprf low
281Done
282```
283
284### rioprf clear
285
286Usage: `br rioprf clear`
287
288Clear 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.
289
290```bash
291> br rioprf clear
292Done
293```
294
295### routeprf
296
297Usage: `br routeprf`
298
299Get 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.
300
301```bash
302> br routeprf
303med
304Done
305```
306
307### routeprf \<prf\>
308
309Usage: `br routeprf high|med|low`
310
311Set 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.
312
313```bash
314> br routeprf low
315Done
316```
317
318### routeprf clear
319
320Usage: `br routeprf clear`
321
322Clear 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).
323
324```bash
325> br routeprf clear
326Done
327```
328
329### routers
330
331Usage: `br routers`
332
333Get the list of discovered routers by Border Routing Manager on the infrastructure link.
334
335Info per router:
336
337- The router IPv6 address
338- Flags in received Router Advertisement header:
339 - M: Managed Address Config flag
340 - O: Other Config flag
341 - Stub: Stub Router flag (indicates whether the router is a stub router)
342
343```bash
344> br routers
345ff02:0:0:0:0:0:0:1 (M:0 O:0 Stub:1)
346Done
347```
348
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## Quick Start
4
5See [README_COMMISSIONING.md](README_COMMISSIONING.md).
6
7## Command List
8
9- [help](#help)
10- [announce](#announce)
11- [energy](#energy)
12- [joiner add](#joiner-add)
13- [joiner remove](#joiner-remove)
14- [joiner table](#joiner-table)
15- [mgmtget](#mgmtget)
16- [mgmtset](#mgmtset)
17- [panid](#panid)
18- [provisioningurl](#provisioningurl)
19- [sessionid](#sessionid)
20- [start](#start)
21- [state](#state)
22- [stop](#stop)
23
24## Command Details
25
26### help
27
28Usage: `commissioner help`
29
30Print commissioner help menu.
31
32```bash
33> commissioner help
34help
35announce
36energy
37joiner
38mgmtget
39mgmtset
40panid
41provisioningurl
42sessionid
43start
44stop
45Done
46```
47
48### announce
49
50Usage: `commissioner announce <mask> <count> <period> <destination>`
51
52Send a `MGMT_ANNOUNCE_BEGIN` message.
53
54- mask: Bitmask identifying channels to send MLE Announce messages.
55- count: Number of MLE Announce transmissions per channel.
56- period: Period between successive MLE Announce transmissions (milliseconds).
57- destination: IPv6 destination for the message (may be multicast).
58
59```bash
60> commissioner announce 0x00050000 2 32 fdde:ad00:beef:0:0:ff:fe00:c00
61Done
62```
63
64### energy
65
66Usage: `commissioner energy <mask> <count> <period> <scanDuration> <destination>`
67
68Send a `MGMT_ED_SCAN` message.
69
70- mask: Bitmask identifying channels to perform IEEE 802.15.4 ED Scans.
71- count: Number of IEEE 802.15.4 ED Scans per channel.
72- period: Period between successive IEEE 802.15.4 ED Scans (milliseconds).
73- scanDuration: IEEE 802.15.4 ScanDuration to use when performing an IEEE 802.15.4 ED Scan (milliseconds).
74- destination: IPv6 destination for the message (may be multicast).
75
76The contents of `MGMT_ED_REPORT` messages (i.e. Channel Mask and Energy List) are printed as they are received.
77
78```bash
79> commissioner energy 0x00050000 2 32 1000 fdde:ad00:beef:0:0:ff:fe00:c00
80Done
81Energy: 00050000 0 0 0 0
82```
83
84### joiner add
85
86Usage: `commissioner joiner add <eui64>|<discerner> <pskd> [timeout]`
87
88Add a Joiner entry.
89
90- eui64: The IEEE EUI-64 of the Joiner or '\*' to match any Joiner.
91- discerner: The Joiner discerner in format `number/length`.
92- pskd: Pre-Shared Key for the Joiner.
93- timeout: joiner timeout in seconds.
94
95```bash
96> commissioner joiner add d45e64fa83f81cf7 J01NME
97Done
98```
99
100```bash
101> commissioner joiner add 0xabc/12 J01NME
102Done
103```
104
105### joiner remove
106
107Usage: `commissioner joiner remove <eui64>|<discerner>`
108
109Remove a Joiner entry.
110
111- eui64: The IEEE EUI-64 of the Joiner or '\*' to match any Joiner.
112- discerner: The Joiner discerner in format `number/length`.
113
114```bash
115> commissioner joiner remove d45e64fa83f81cf7
116Done
117```
118
119```bash
120> commissioner joiner remove 0xabc/12
121Done
122```
123
124### joiner table
125
126Usage: `commissioner joiner table`
127
128List all Joiner entries.
129
130```bash
131> commissioner joiner table
132| ID | PSKd | Expiration |
133+-----------------------+----------------------------------+------------+
134| * | J01NME | 81015 |
135| d45e64fa83f81cf7 | J01NME | 101204 |
136| 0x0000000000000abc/12 | J01NME | 114360 |
137Done
138```
139
140### mgmtget
141
142Usage: `commissioner mgmtget [locator] [sessionid] [steeringdata] [joinerudpport] [-x <TLV Types>]`
143
144Send a `MGMT_GET` message to the Leader.
145
146```bash
147> commissioner mgmtget locator sessionid
148Done
149```
150
151### mgmtset
152
153Usage: `commissioner mgmtset [locator <locator>] [sessionid <sessionid>] [steeringdata <steeringdata>] [joinerudpport <joinerudpport>] [-x <TLVs>]`
154
155Send a `MGMT_SET` message to the Leader.
156
157```bash
158> commissioner mgmtset joinerudpport 9988
159Done
160```
161
162### panid
163
164Usage: `commissioner panid <panid> <mask> <destination>`
165
166Send a `MGMT_PANID_QUERY` message.
167
168- panid: PAN ID to check for conflicts.
169- mask: Bitmask identifying channels to perform IEEE 802.15.4 Active Scans.
170- destination: IPv6 destination for the message (may be multicast).
171
172The contents of `MGMT_PANID_CONFLICT` messages (i.e. PAN ID and Channel Mask) are printed as they are received.
173
174```bash
175> commissioner panid 0xdead 0x7fff800 fdde:ad00:beef:0:0:ff:fe00:c00
176Done
177Conflict: dead, 00000800
178```
179
180### provisioningurl
181
182Usage: `commissioner provisioningurl <provisioningurl>`
183
184Set the Provisioning URL.
185
186```bash
187> commissioner provisioningurl http://github.com/openthread/openthread
188Done
189```
190
191### sessionid
192
193Usage: `commissioner sessionid`
194
195Get current commissioner session id.
196
197```bash
198> commissioner sessionid
1990
200Done
201```
202
203### id
204
205Usage: `commissioner id`
206
207Get the commissioner id.
208
209```bash
210> commissioner id
211OpenThread Commissioner
212Done
213```
214
215### id \<name\>
216
217Set the commissioner id.
218
219```bash
220> commissioner id "Custom Commissioner Id"
221Done
222```
223
224### start
225
226Usage: `commissioner start`
227
228Start the Commissioner role.
229
230This command will cause the device to send `LEAD_PET` and `LEAD_KA` messages.
231
232```bash
233> commissioner start
234Commissioner: petitioning
235Done
236Commissioner: active
237```
238
239### state
240
241Usage: `commissioner state`
242
243Get Commissioner state.
244
245This command will return the current Commissioner state.
246
247```bash
248> commissioner state
249active
250Done
251```
252
253### stop
254
255Usage: `commissioner stop`
256
257Stop the Commissioner role.
258
259This command will cause the device to send `LEAD_KA[Reject]` messages.
260
261```bash
262> commissioner stop
263Done
264```
265
README_COMMISSIONING.md
1# OpenThread CLI - Commissioning
2
3## Quick Start
4
5### Form Network
6
7Form a network with the device that has Commissioner support.
8
91. Generate and view new network configuration.
10
11 ```bash
12 > dataset init new
13 Done
14 > dataset
15 Active Timestamp: 1
16 Channel: 13
17 Channel Mask: 0x07fff800
18 Ext PAN ID: d63e8e3e495ebbc3
19 Mesh Local Prefix: fd3d:b50b:f96d:722d::/64
20 Network Key: dfd34f0f05cad978ec4e32b0413038ff
21 Network Name: OpenThread-8f28
22 PAN ID: 0x8f28
23 PSKc: c23a76e98f1a6483639b1ac1271e2e27
24 Security Policy: 0, onrc
25 Done
26 ```
27
282. Commit new dataset to the Active Operational Dataset in non-volatile storage.
29
30 ```bash
31 dataset commit active
32 Done
33 ```
34
353. Enable Thread interface
36
37 ```bash
38 > ifconfig up
39 Done
40 > thread start
41 Done
42 ```
43
44### Obtain Joiner IEEE EUI-64
45
461. Start the Joiner node and obtain the Joiner's IEEE EUI-64.
47
48 ```bash
49 > eui64
50 18b4300000000002
51 Done
52 ```
53
54### Start Commissioner
55
561. Start the Commissioner Role
57
58 ```bash
59 > commissioner start
60 Commissioner: petitioning
61 Done
62 Commissioner: active
63 ```
64
652. Add the Joiner with the device-specific pre-shared key (PSKd)
66
67 ```bash
68 > commissioner joiner add 18b4300000000002 J01NME
69 Done
70 ```
71
72### Start Joiner
73
741. Factory reset the device.
75
76 ```bash
77 > factoryreset
78 ```
79
802. Start the Joiner process.
81
82 ```bash
83 > ifconfig up
84 Done
85 > joiner start J01NME
86 Done
87 Join success
88 ```
89
903. Attach to Thread network
91
92 ```bash
93 > thread start
94 Done
95 ```
96
974. After successful attach, validate the device has the same Active Operational Dataset as above.
98
99 ```bash
100 > dataset active
101 Active Timestamp: 1
102 Channel: 13
103 Channel Mask: 0x07fff800
104 Ext PAN ID: d63e8e3e495ebbc3
105 Mesh Local Prefix: fd3d:b50b:f96d:722d::/64
106 Network Key: dfd34f0f05cad978ec4e32b0413038ff
107 Network Name: OpenThread-8f28
108 PAN ID: 0x8f28
109 PSKc: c23a76e98f1a6483639b1ac1271e2e27
110 Security Policy: 0, onrc
111 Done
112 ```
113
114## CLI Reference
115
116- [Commissioner CLI Reference](README_COMMISSIONER.md)
117- [Joiner CLI Reference](README_JOINER.md)
118
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### Active Operational Dataset
8
9The Active Operational Dataset includes parameters that are currently in use across an entire Thread network. The Active Operational Dataset contains:
10
11- Active Timestamp
12- Channel
13- Channel Mask
14- Extended PAN ID
15- Mesh-Local Prefix
16- Network Name
17- PAN ID
18- PSKc
19- Security Policy
20
21### Pending Operational Dataset
22
23The Pending Operational Dataset is used to communicate changes to the Active Operational Dataset before they take effect. The Pending Operational Dataset contains all the parameters from the Active Operational Dataset, with the addition of:
24
25- Delay Timer
26- Pending Timestamp
27
28## Quick Start
29
30### Form Network
31
321. Generate and view new network configuration.
33
34 ```bash
35 > dataset init new
36 Done
37 > dataset
38 Active Timestamp: 1
39 Channel: 15
40 Channel Mask: 0x07fff800
41 Ext PAN ID: 39758ec8144b07fb
42 Mesh Local Prefix: fdf1:f1ad:d079:7dc0::/64
43 Network Key: f366cec7a446bab978d90d27abe38f23
44 Network Name: OpenThread-5938
45 PAN ID: 0x5938
46 PSKc: 3ca67c969efb0d0c74a4d8ee923b576c
47 Security Policy: 672 onrc 0
48 Done
49 ```
50
512. Commit new dataset to the Active Operational Dataset in non-volatile storage.
52
53 ```bash
54 dataset commit active
55 Done
56 ```
57
583. Enable Thread interface
59
60 ```bash
61 > ifconfig up
62 Done
63 > thread start
64 Done
65 ```
66
67### Attach to Existing Network
68
69Only the Network Key is required for a device to attach to a Thread network.
70
71While not required, specifying the channel avoids the need to search across multiple channels, improving both latency and efficiency of the attach process.
72
73After the device successfully attaches to a Thread network, the device will retrieve the complete Active Operational Dataset.
74
751. Create a partial Active Operational Dataset.
76
77 ```bash
78 > dataset networkkey dfd34f0f05cad978ec4e32b0413038ff
79 Done
80 > dataset commit active
81 Done
82 ```
83
842. Enable Thread interface.
85
86 ```bash
87 > ifconfig up
88 Done
89 > thread start
90 Done
91 ```
92
933. After attaching, validate that the device received the complete Active Operational Dataset.
94
95 ```bash
96 > dataset active
97 Active Timestamp: 1
98 Channel: 15
99 Channel Mask: 0x07fff800
100 Ext PAN ID: 39758ec8144b07fb
101 Mesh Local Prefix: fdf1:f1ad:d079:7dc0::/64
102 Network Key: f366cec7a446bab978d90d27abe38f23
103 Network Name: OpenThread-5938
104 PAN ID: 0x5938
105 PSKc: 3ca67c969efb0d0c74a4d8ee923b576c
106 Security Policy: 672 onrc 0
107 Done
108 ```
109
110### Using the Dataset Updater to update Operational Dataset
111
112Dataset Updater can be used for a delayed update of network parameters on all devices of a Thread Network.
113
1141. Clear the dataset buffer and add the Dataset fields to update.
115
116 ```bash
117 > dataset clear
118 Done
119
120 > dataset channel 12
121 Done
122 ```
123
1242. 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.
125
126 ```bash
127 > dataset delay 300000
128
129 > dataset
130 Channel: 12
131 Delay: 30000
132 Done
133 ```
134
1353. Start the Dataset Updater, which will prepare a Pending Operation Dataset and inform the Leader to distribute it to other devices.
136
137 ```bash
138 > dataset updater start
139 Done
140
141 > dataset updater
142 Enabled
143 ```
144
1454. 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.
146
147 ```bash
148 > dataset active
149 Active Timestamp: 10
150 Channel: 12
151 Channel Mask: 0x07fff800
152 Ext PAN ID: 324a71d90cdc8345
153 Mesh Local Prefix: fd7d:da74:df5e:80c::/64
154 Network Key: be768535bac1b8d228960038311d6ca2
155 Network Name: OpenThread-bcaf
156 PAN ID: 0xbcaf
157 PSKc: e79b274ab22414a814ed5cce6a30be67
158 Security Policy: 672 onrc 0
159 Done
160 ```
161
162### Using the Pending Operational Dataset for Delayed Dataset Updates
163
164The 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.
165
166The 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.
167
168Normally, 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.
169
1701. The main parameter to change is the channel. We can display the current Active Operational Dataset to see that the current channel is 16.
171
172 ```bash
173 > dataset active
174 Active Timestamp: 1691070443
175 Channel: 16
176 Channel Mask: 0x07fff800
177 Ext PAN ID: 324a71d90cdc8345
178 Mesh Local Prefix: fd7d:da74:df5e:80c::/64
179 Network Key: be768535bac1b8d228960038311d6ca2
180 Network Name: OpenThread-bcaf
181 PAN ID: 0xbcaf
182 PSKc: e79b274ab22414a814ed5cce6a30be67
183 Security Policy: 672 onrc 0
184 Done
185 ```
186
1872. 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.
188
189 ```bash
190 > dataset init active
191 Done
192 > dataset activetimestamp 1696177379
193 Done
194 > dataset pendingtimestamp 1696177379
195 Done
196 > dataset channel 12
197 Done
198 ```
199
2003. Set the delay timer parameter to 5 minutes (300000 ms). Show the resulting Dataset that's ready to be used.
201
202 ```bash
203 > dataset delay 300000
204 Done
205 > dataset
206 Pending Timestamp: 1696177379
207 Active Timestamp: 1696177379
208 Channel: 12
209 Channel Mask: 0x07fff800
210 Delay: 300000
211 Ext PAN ID: 324a71d90cdc8345
212 Mesh Local Prefix: fd7d:da74:df5e:80c::/64
213 Network Key: be768535bac1b8d228960038311d6ca2
214 Network Name: OpenThread-bcaf
215 PAN ID: 0xbcaf
216 PSKc: e79b274ab22414a814ed5cce6a30be67
217 Security Policy: 672 onrc 0
218 Done
219 ```
220
2214. 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.
222
223 ```bash
224 > dataset commit pending
225 Done
226 ```
227
2285. To verify that the delay timer is counting down, display the Pending Operational Dataset after a few seconds.
229
230 ```bash
231 > dataset pending
232 Pending Timestamp: 1696177379
233 Active Timestamp: 1696177379
234 Channel: 12
235 Channel Mask: 0x07fff800
236 Delay: 293051
237 Ext PAN ID: 324a71d90cdc8345
238 Mesh Local Prefix: fd7d:da74:df5e:80c::/64
239 Network Key: be768535bac1b8d228960038311d6ca2
240 Network Name: OpenThread-bcaf
241 PAN ID: 0xbcaf
242 PSKc: e79b274ab22414a814ed5cce6a30be67
243 Security Policy: 672 onrc 0
244 Done
245 ```
246
247 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.
248
2496) 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.
250
251 ```bash
252 > dataset active
253 Active Timestamp: 1696177379
254 Channel: 12
255 Channel Mask: 0x07fff800
256 Ext PAN ID: 324a71d90cdc8345
257 Mesh Local Prefix: fd7d:da74:df5e:80c::/64
258 Network Key: be768535bac1b8d228960038311d6ca2
259 Network Name: OpenThread-bcaf
260 PAN ID: 0xbcaf
261 PSKc: e79b274ab22414a814ed5cce6a30be67
262 Security Policy: 672 onrc 0
263 Done
264 ```
265
266 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:
267
268 ```bash
269 > dataset pending
270 Error 23: NotFound
271 ```
272
273## Command List
274
275- [help](#help)
276- [active](#active)
277- [activetimestamp](#activetimestamp)
278- [channel](#channel)
279- [channelmask](#channelmask)
280- [clear](#clear)
281- [commit](#commit)
282- [delay](#delay)
283- [extpanid](#extpanid)
284- [init](#init)
285- [meshlocalprefix](#meshlocalprefix)
286- [mgmtgetcommand](#mgmtgetcommand)
287- [mgmtsetcommand](#mgmtsetcommand)
288- [networkkey](#networkkey)
289- [networkname](#networkname)
290- [panid](#panid)
291- [pending](#pending)
292- [pendingtimestamp](#pendingtimestamp)
293- [pskc](#pskc)
294- [securitypolicy](#securitypolicy)
295- [tlvs](#tlvs)
296- [updater](#updater)
297
298## Command Details
299
300### help
301
302Usage: `dataset help`
303
304Print dataset help menu.
305
306```bash
307> dataset help
308help
309active
310activetimestamp
311channel
312channelmask
313clear
314commit
315delay
316extpanid
317init
318meshlocalprefix
319mgmtgetcommand
320mgmtsetcommand
321networkkey
322networkname
323panid
324pending
325pendingtimestamp
326pskc
327securitypolicy
328set
329tlvs
330Done
331```
332
333### active
334
335Usage: `dataset active [-x]`
336
337Print Active Operational Dataset in human-readable form.
338
339```bash
340> dataset active
341Active Timestamp: 1
342Channel: 15
343Channel Mask: 0x07fff800
344Ext PAN ID: 39758ec8144b07fb
345Mesh Local Prefix: fdf1:f1ad:d079:7dc0::/64
346Network Key: f366cec7a446bab978d90d27abe38f23
347Network Name: OpenThread-5938
348PAN ID: 0x5938
349PSKc: 3ca67c969efb0d0c74a4d8ee923b576c
350Security Policy: 672 onrc 0
351Done
352```
353
354Print Active Operational Dataset as hex-encoded TLVs.
355
356```bash
357> dataset active -x
3580e080000000000010000000300000f35060004001fffe0020839758ec8144b07fb0708fdf1f1add0797dc00510f366cec7a446bab978d90d27abe38f23030f4f70656e5468726561642d353933380102593804103ca67c969efb0d0c74a4d8ee923b576c0c0402a0f7f8
359Done
360```
361
362### activetimestamp
363
364Usage: `dataset activetimestamp [timestamp]`
365
366Get active timestamp seconds. It represents a "Unix time", in number of seconds since Jan 1st, 1970.
367
368```bash
369> dataset activetimestamp
370123456789
371Done
372```
373
374Set active timestamp seconds.
375
376```bash
377> dataset activetimestamp 123456789
378Done
379```
380
381### channel
382
383Usage: `channel [channel]`
384
385Get channel.
386
387```bash
388> dataset channel
38912
390Done
391```
392
393Set channel.
394
395```bash
396> dataset channel 12
397Done
398```
399
400### channelmask
401
402Usage: `dataset channelmask [channelmask]`
403
404Get channel mask.
405
406```bash
407> dataset channelmask
4080x07fff800
409Done
410```
411
412Set channel mask.
413
414```bash
415> dataset channelmask 0x07fff800
416Done
417```
418
419### clear
420
421Usage: `dataset clear`
422
423Reset operational dataset buffer.
424
425```bash
426> dataset clear
427Done
428```
429
430### commit
431
432Usage: `dataset commit <active|pending>`
433
434Commit operational dataset buffer to active/pending operational dataset.
435
436```bash
437> dataset commit active
438Done
439```
440
441### delay
442
443Usage: `dataset delay [delay]`
444
445Get delay timer value. The timer value is in milliseconds.
446
447```bash
448> dataset delay
4491000
450Done
451```
452
453Set delay timer value.
454
455```bash
456> dataset delay 100000
457Done
458```
459
460### extpanid
461
462Usage: `dataset extpanid [extpanid]`
463
464Get extended panid.
465
466```bash
467> dataset extpanid
468000db80123456789
469Done
470```
471
472Set extended panid.
473
474**NOTE** The commissioning credential in the dataset buffer becomes stale after changing this value. Use [pskc](#pskc) to reset.
475
476```bash
477> dataset extpanid 000db80123456789
478Done
479```
480
481### init
482
483Usage: `dataset init <active|new|pending|tlvs <hex-encoded TLVs>>`
484
485Initialize operational dataset buffer. Use `new` to initialize with randomly selected values:
486
487```bash
488> dataset init new
489Done
490```
491
492Use `active` or `pending` to initialize the dataset buffer with a copy of the current Active Operational Dataset or Pending Operational Dataset, respectively:
493
494```bash
495> dataset init active
496Done
497```
498
499Use the `tlvs` option to initialize the dataset buffer from a string of hex-encoded TLVs:
500
501```bash
502> dataset init tlvs 0e080000000000010000000300001235060004001fffe002088665f03e6e42e7750708fda576e5f9a5bd8c0510506071d8391be671569e080d52870fd5030f4f70656e5468726561642d633538640102c58d04108a926cf8b13275a012ceedeeae40910d0c0402a0f7f8
503Done
504```
505
506### meshlocalprefix
507
508Usage: `dataset meshlocalprefix [prefix]`
509
510Get mesh local prefix.
511
512```bash
513> dataset meshlocalprefix
514fd00:db8:0:0::/64
515Done
516```
517
518Set mesh local prefix.
519
520```bash
521> dataset meshlocalprefix fd00:db8::
522Done
523```
524
525### mgmtgetcommand
526
527Usage: `dataset mgmtgetcommand <active|pending> [address <destination>] [TLV list] [-x]`
528
529Send MGMT_ACTIVE_GET or MGMT_PENDING_GET.
530
531```bash
532> dataset mgmtgetcommand active address fdde:ad00:beef:0:558:f56b:d688:799 activetimestamp securitypolicy
533Done
534```
535
536### mgmtsetcommand
537
538Usage: `dataset mgmtsetcommand <active|pending> [TLV Type list] [-x]`
539
540Send MGMT_ACTIVE_SET or MGMT_PENDING_SET.
541
542```bash
543> dataset mgmtsetcommand active activetimestamp 123 securitypolicy 1 onrc 0
544Done
545```
546
547### networkkey
548
549Usage: `dataset networkkey [key]`
550
551Get network key
552
553```bash
554> dataset networkkey
55500112233445566778899aabbccddeeff
556Done
557```
558
559Set network key.
560
561```bash
562> dataset networkkey 00112233445566778899aabbccddeeff
563Done
564```
565
566### networkname
567
568Usage: `dataset networkname [name]`
569
570Get network name.
571
572```bash
573> dataset networkname
574OpenThread
575Done
576```
577
578Set network name.
579
580**NOTE** The commissioning credential in the dataset buffer becomes stale after changing this value. Use [pskc](#pskc) to reset.
581
582```bash
583> dataset networkname OpenThread
584Done
585```
586
587### panid
588
589Usage: `dataset panid [panid]`
590
591Get panid.
592
593```bash
594> dataset panid
5950x1234
596Done
597```
598
599Set panid.
600
601```bash
602> dataset panid 0x1234
603Done
604```
605
606### pending
607
608Usage: `dataset pending [-x]`
609
610Print Pending Operational Dataset in human-readable form.
611
612```bash
613> dataset pending
614Pending Timestamp: 2
615Active Timestamp: 1
616Channel: 26
617Channel Mask: 0x07fff800
618Delay: 58706
619Ext PAN ID: a74182f4d3f4de41
620Mesh Local Prefix: fd46:c1b9:e159:5574::/64
621Network Key: ed916e454d96fd00184f10a6f5c9e1d3
622Network Name: OpenThread-bff8
623PAN ID: 0xbff8
624PSKc: 264f78414adc683191863d968f72d1b7
625Security Policy: 672 onrc 0
626Done
627```
628
629Print Pending Operational Dataset as hex-encoded TLVs.
630
631```bash
632> dataset pending -x
6330e0800000000000100003308000000000002000034040000b512000300001a35060004001fffe00208a74182f4d3f4de410708fd46c1b9e15955740510ed916e454d96fd00184f10a6f5c9e1d3030f4f70656e5468726561642d626666380102bff80410264f78414adc683191863d968f72d1b70c0402a0f7f8
634Done
635```
636
637### pendingtimestamp
638
639Usage: `dataset pendingtimestamp [timestamp]`
640
641Get pending timestamp seconds. It represents a "Unix time", in number of seconds since Jan 1st, 1970.
642
643```bash
644> dataset pendingtimestamp
645123456789
646Done
647```
648
649Set pending timestamp seconds.
650
651```bash
652> dataset pendingtimestamp 123456789
653Done
654```
655
656### pskc
657
658Usage: `pskc [-p] [<key>|<passphrase>]`
659
660Get PSKc.
661
662```bash
663> dataset pskc
66467c0c203aa0b042bfb5381c47aef4d9e
665Done
666```
667
668Set PSKc.
669
670With `-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).
671
672```bash
673> dataset pskc 67c0c203aa0b042bfb5381c47aef4d9e
674Done
675> dataset pskc -p 123456
676Done
677```
678
679### securitypolicy
680
681Usage: `dataset securitypolicy [<rotationtime> [onrcCepR] [versionthreshold]]`
682
683Get security policy.
684
685```bash
686> dataset securitypolicy
687672 onrc 0
688Done
689```
690
691Set security policy.
692
693- o: Obtaining the Network Key for out-of-band commissioning is enabled.
694- n: Native Commissioning using PSKc is allowed.
695- r: Thread 1.x Routers are enabled.
696- c: External Commissioner authentication is allowed using PSKc.
697- C: Thread 1.2 Commercial Commissioning is enabled.
698- e: Thread 1.2 Autonomous Enrollment is enabled.
699- p: Thread 1.2 Network Key Provisioning is enabled.
700- R: Non-CCM routers are allowed in Thread 1.2 CCM networks.
701
702If the `versionthreshold` parameter is not provided, a default value of zero is assumed.
703
704```bash
705> dataset securitypolicy 672 onrc 0
706Done
707```
708
709### set
710
711Usage: `dataset set <active|pending> <dataset>`
712
713Set the Active Operational Dataset using hex-encoded TLVs.
714
715```bash
716> dataset set active 0e080000000000010000000300000f35060004001fffe0020839758ec8144b07fb0708fdf1f1add0797dc00510f366cec7a446bab978d90d27abe38f23030f4f70656e5468726561642d353933380102593804103ca67c969efb0d0c74a4d8ee923b576c0c0402a0f7f8
717Done
718```
719
720Set the Pending Operational Dataset using hex-encoded TLVs.
721
722```bash
723> dataset set pending 0e0800000000000100003308000000000002000034040000b512000300001a35060004001fffe00208a74182f4d3f4de410708fd46c1b9e15955740510ed916e454d96fd00184f10a6f5c9e1d3030f4f70656e5468726561642d626666380102bff80410264f78414adc683191863d968f72d1b70c0402a0f7f8
724Done
725```
726
727### tlvs
728
729Usage: `dataset tlvs`
730
731Convert the Operational Dataset to hex-encoded TLVs.
732
733```bash
734> dataset
735Active Timestamp: 1
736Channel: 22
737Channel Mask: 0x07fff800
738Ext PAN ID: d196fa2040e973b6
739Mesh Local Prefix: fdbb:c310:c48f:3a39::/64
740Network Key: 9929154dbc363218bcd22f907caf5c15
741Network Name: OpenThread-de2b
742PAN ID: 0xde2b
743PSKc: 15b2c16f7ba92ed4bc7b1ee054f1553f
744Security Policy: 672 onrc 0
745Done
746
747> dataset tlvs
7480e080000000000010000000300001635060004001fffe00208d196fa2040e973b60708fdbbc310c48f3a3905109929154dbc363218bcd22f907caf5c15030f4f70656e5468726561642d646532620102de2b041015b2c16f7ba92ed4bc7b1ee054f1553f0c0402a0f7f8
749Done
750```
751
752### updater
753
754Usage: `dataset updater`
755
756Requires `OPENTHREAD_CONFIG_DATASET_UPDATER_ENABLE`.
757
758Indicate whether there is an ongoing Operation Dataset update request.
759
760```bash
761> dataset updater
762Enabled
763```
764
765### updater start
766
767Usage: `dataset updater start`
768
769Requires `OPENTHREAD_CONFIG_DATASET_UPDATER_ENABLE`.
770
771Request network to update its Operation Dataset to the current operational dataset buffer.
772
773The 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.
774
775```bash
776> channel
77719
778Done
779
780> dataset clear
781Done
782> dataset channel 15
783Done
784> dataset
785Channel: 15
786Done
787
788> dataset updater start
789Done
790> dataset updater
791Enabled
792Done
793
794Dataset update complete: OK
795
796> channel
79715
798Done
799```
800
801### updater cancel
802
803Usage: `dataset updater cancel`
804
805Requires `OPENTHREAD_CONFIG_DATASET_UPDATER_ENABLE`.
806
807Cancels an ongoing (if any) Operational Dataset update request.
808
809```bash
810> dataset updater start
811Done
812> dataset updater
813Enabled
814Done
815>
816> dataset updater cancel
817Done
818> dataset updater
819Disabled
820Done
821```
822
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>` to publish "DNS/SRP Service Anycast Address" with a given sequence number.
258- `netdata publish dnssrp unicast <address> <port>` to publish "DNS/SRP Service Unicast Address" with given address and port number info. The address/port info is included in Service TLV data.
259- `netdata publish dnssrp unicast <port>` to publish "DNS/SRP Service Unicast Address" with given port number and the device's mesh-local EID for the address. The address and port info is included in Server TLV data.
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
265Done
266
267> netdata publish dnssrp unicast fd00::1234 51525
268Done
269
270> netdata publish dnssrp unicast 50152
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
3786LoWPAN Context IDs are listed under `Contexts` header:
379
380- The prefix
381- Context ID
382- Compress flag (`c` if marked or `-` otherwise).
383
384Commissioning Dataset information is printed under `Commissioning` header:
385
386- Session ID if present in Dataset or `-` otherwise
387- Border Agent RLOC16 (in hex) if present in Dataset or `-` otherwise
388- Joiner UDP port number if present in Dataset or `-` otherwise
389- Steering Data (as hex bytes) if present in Dataset or `-` otherwise
390- Flags:
391 - e: if Dataset contains any extra unknown TLV
392
393Print Network Data received from the Leader.
394
395```bash
396> netdata show
397Prefixes:
398fd00:dead:beef:cafe::/64 paros med a000
399Routes:
400fd00:1234:0:0::/64 s med a000
401fd00:4567:0:0::/64 s med 8000
402Services:
40344970 5d fddead00beef00007bad0069ce45948504d2 s a000
404Contexts:
405fd00:dead:beef:cafe::/64 1 c
406Commissioning:
4071248 dc00 9988 00000000000120000000000000000000 e
408Done
409```
410
411Print Network Data entries from the Leader associated with `0xa00` RLOC16.
412
413```bash
414> netdata show 0xa00
415Prefixes:
416fd00:dead:beef:cafe::/64 paros med a000
417Routes:
418fd00:1234:0:0::/64 s med a000
419Services:
42044970 5d fddead00beef00007bad0069ce45948504d2 s a000
421Done
422```
423
424Print Network Data received from the Leader as hex-encoded TLVs.
425
426```bash
427> netdata show -x
42808040b02174703140040fd00deadbeefcafe0504dc00330007021140
429Done
430```
431
432Print local Network Data to sync with Leader.
433
434```bash
435> netdata show local
436Prefixes:
437fd00:dead:beef:cafe::/64 paros med dc00
438Routes:
439Services:
440Done
441```
442
443Print local Network Data to sync with Leader as hex-encoded TLVs.
444
445```bash
446> netdata show local -x
44708040b02174703140040fd00deadbeefcafe0504dc00330007021140
448Done
449```
450
451### netdata steeringdata check \<eui64\>|\<discerner\>
452
453Check whether the steering data includes a joiner.
454
455- eui64: The IEEE EUI-64 of the Joiner.
456- discerner: The Joiner discerner in format `number/length`.
457
458```bash
459> netdata steeringdata check d45e64fa83f81cf7
460Done
461> netdata steeringdata check 0xabc/12
462Done
463> netdata steeringdata check 0xdef/12
464Error 23: NotFound
465```
466
467### unpublish
468
469This command unpublishes a previously published Network Data entry.
470
471This command requires `OPENTHREAD_CONFIG_NETDATA_PUBLISHER_ENABLE`.
472
473### unpublish dnssrp
474
475Unpublishes DNS/SRP Service entry (available when `OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE` is enabled):
476
477- `netdata unpublish dnssrp` to unpublish "DNS/SRP Service" entry (anycast or unciast).
478
479```bash
480> netdata unpublish dnssrp
481Done
482```
483
484### unpublish \<prefix\>
485
486Unpublishes a previously published on-mesh prefix or external route entry.
487
488```bash
489> netdata unpublish fd00:1234:5678::/64
490Done
491```
492
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- help [#help]
6- start [#start]
7- stop [#stop]
8
9### help
10
11print help
12
13```bash
14tcat help
15help
16start
17stop
18Done
19```
20
21### start
22
23Start tcat server and ble advertisement.
24
25```bash
26tcat start
27Done
28```
29
30### stop
31
32Stop tcat server and ble advertisement.
33
34```bash
35tcat stop
36Done
37```
38
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 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### close
87
88Closes the example socket.
89
90```bash
91> udp close
92Done
93```
94
95### connect \<ip\> \<port\>
96
97Specifies the peer with which the socket is to be associated.
98
99- ip: the peer's IP address.
100- port: the peer's UDP port.
101
102```bash
103> udp connect fdde:ad00:beef:0:bb1:ebd6:ad10:f33 1234
104Done
105```
106
107The address can be an IPv4 address, which will be synthesized to an IPv6 address using the preferred NAT64 prefix from the network data.
108
109> Note: The command will return `InvalidState` when the preferred NAT64 prefix is unavailable.
110
111```bash
112> udp connect 172.17.0.1 1234
113Connecting to synthesized IPv6 address: fdde:ad00:beef:2:0:0:ac11:1
114Done
115```
116
117### linksecurity
118
119Indicates whether the link security is enabled or disabled.
120
121```bash
122> udp linksecurity
123Enabled
124Done
125```
126
127### linksecurity enable
128
129Enable link security.
130
131```bash
132> udp linksecurity enable
133Done
134```
135
136### linksecurity disable
137
138Disable link security.
139
140```bash
141> udp linksecurity disable
142Done
143```
144
145### open
146
147Opens the example socket.
148
149```bash
150> udp open
151Done
152```
153
154### send \<ip\> \<port\> \<message\>
155
156Send a UDP message.
157
158- ip: the destination address.
159- port: the UDP destination port.
160- message: the message to send.
161
162```bash
163> udp send fdde:ad00:beef:0:bb1:ebd6:ad10:f33 1234 hello
164Done
165```
166
167The address can be an IPv4 address, which will be synthesized to an IPv6 address using the preferred NAT64 prefix from the network data.
168
169> Note: The command will return `InvalidState` when the preferred NAT64 prefix is unavailable.
170
171```bash
172> udp send 172.17.0.1 1234 hello
173Sending to synthesized IPv6 address: fdde:ad00:beef:2:0:0:ac11:1
174Done
175```
176
177### send \<ip\> \<port\> \<type\> \<value\>
178
179Send a few bytes over UDP.
180
181- ip: the IPv6 destination address.
182- port: the UDP destination port.
183- type: the type of the message:
184 - `-t`: text payload in the `value`, same as without specifying the type.
185 - `-s`: autogenerated payload with specified length indicated in the `value`.
186 - `-x`: binary data in hexadecimal representation in the `value`.
187
188```bash
189> udp send fdde:ad00:beef:0:bb1:ebd6:ad10:f33 1234 -t hello
190Done
191
192> udp send fdde:ad00:beef:0:bb1:ebd6:ad10:f33 1234 -x 68656c6c6f
193Done
194
195> udp send fdde:ad00:beef:0:bb1:ebd6:ad10:f33 1234 -s 800
196Done
197
198```
199
200### send \<message\>
201
202Send a UDP message on a connected socket.
203
204- message: the message to send.
205
206```bash
207> udp send hello
208Done
209```
210
211### send \<type\> \<value\>
212
213Send a few bytes over UDP.
214
215- type: the type of the message:
216 - `-t`: text payload in the `value`, same as without specifying the type.
217 - `-s`: autogenerated payload with specified length indicated in the `value`.
218 - `-x`: binary data in hexadecimal representation in the `value`.
219
220```bash
221> udp send -t hello
222Done
223
224> udp send -x 68656c6c6f
225Done
226
227> udp send -s 800
228Done
229```
230