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