• Home
Name Date Size #Lines LOC

..--

BUILD.gnD04-Jul-20252.9 KiB9488

CMakeLists.txtD04-Jul-20252.7 KiB8173

README.mdD04-Jul-202598.4 KiB4,5973,353

README_BR.mdD04-Jul-20259.3 KiB409287

README_COAP.mdD04-Jul-20255.8 KiB243180

README_COAPS.mdD04-Jul-20256.2 KiB304222

README_COMMISSIONER.mdD04-Jul-20255.6 KiB269186

README_COMMISSIONING.mdD04-Jul-20252.3 KiB12291

README_DATASET.mdD04-Jul-202519.3 KiB856636

README_HISTORY.mdD04-Jul-202534.4 KiB653549

README_JOINER.mdD04-Jul-20251.3 KiB10975

README_NETDATA.mdD04-Jul-202512.4 KiB493362

README_SRP.mdD04-Jul-20253.8 KiB188151

README_SRP_CLIENT.mdD04-Jul-20258.7 KiB457320

README_SRP_SERVER.mdD04-Jul-20255.2 KiB264189

README_TCAT.mdD04-Jul-20251.2 KiB12586

README_TCP.mdD04-Jul-20255.8 KiB234161

README_UDP.mdD04-Jul-20254.5 KiB237164

cli.cppD04-Jul-2025245.6 KiB8,4914,322

cli.hppD04-Jul-202514.3 KiB425277

cli_bbr.cppD04-Jul-202513.8 KiB499208

cli_bbr.hppD04-Jul-20253.2 KiB9427

cli_br.cppD04-Jul-202525.9 KiB925416

cli_br.hppD04-Jul-20253.5 KiB10435

cli_coap.cppD04-Jul-202539.1 KiB1,182759

cli_coap.hppD04-Jul-20256.9 KiB185104

cli_coap_secure.cppD04-Jul-202532.6 KiB1,060631

cli_coap_secure.hppD04-Jul-20256.2 KiB16584

cli_commissioner.cppD04-Jul-202523.6 KiB738381

cli_commissioner.hppD04-Jul-20254.5 KiB11442

cli_config.hD04-Jul-20256.5 KiB19656

cli_dataset.cppD04-Jul-202535.9 KiB1,345680

cli_dataset.hppD04-Jul-20255.9 KiB14574

cli_dns.cppD04-Jul-202525.4 KiB759371

cli_dns.hppD04-Jul-20255.2 KiB13361

cli_extension_example.cD04-Jul-20252.3 KiB5820

cli_extension_example.cmakeD04-Jul-20252 KiB4033

cli_history.cppD04-Jul-202572.1 KiB1,478569

cli_history.hppD04-Jul-20254 KiB11141

cli_joiner.cppD04-Jul-20257.6 KiB284115

cli_joiner.hppD04-Jul-20253.2 KiB9326

cli_link_metrics.cppD04-Jul-202521 KiB606364

cli_link_metrics.hppD04-Jul-20255.6 KiB13153

cli_mac_filter.cppD04-Jul-202516.4 KiB510217

cli_mac_filter.hppD04-Jul-20253.5 KiB10232

cli_mdns.cppD04-Jul-202529.9 KiB1,157849

cli_mdns.hppD04-Jul-20255.5 KiB14269

cli_mesh_diag.cppD04-Jul-202518.8 KiB540285

cli_mesh_diag.hppD04-Jul-20254.8 KiB11741

cli_network_data.cppD04-Jul-202527.5 KiB1,002505

cli_network_data.hppD04-Jul-20255.3 KiB14737

cli_ping.cppD04-Jul-20257.6 KiB258164

cli_ping.hppD04-Jul-20253.4 KiB9526

cli_srp_client.cppD04-Jul-202530.8 KiB1,014455

cli_srp_client.hppD04-Jul-20254.2 KiB11039

cli_srp_server.cppD04-Jul-202519.1 KiB646309

cli_srp_server.hppD04-Jul-20253.2 KiB9426

cli_tcat.cppD04-Jul-202513.3 KiB380242

cli_tcat.hppD04-Jul-20253.1 KiB8925

cli_tcp.cppD04-Jul-202539.4 KiB1,252825

cli_tcp.hppD04-Jul-202511.9 KiB226143

cli_udp.cppD04-Jul-202513.8 KiB488221

cli_udp.hppD04-Jul-20253.4 KiB9225

cli_utils.cppD04-Jul-202519.8 KiB787560

cli_utils.hppD04-Jul-202528.6 KiB771257

ftd.cmakeD04-Jul-20252.2 KiB5850

mtd.cmakeD04-Jul-20252.2 KiB5850

radio.cmakeD04-Jul-20252.4 KiB6758

x509_cert_key.hppD04-Jul-20255.3 KiB11747

README.md

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

README_BR.md

1# OpenThread CLI - Border Router (BR)
2
3## Command List
4
5Usage : `br [command] ...`
6
7- [counters](#counters)
8- [disable](#disable)
9- [enable](#enable)
10- [help](#help)
11- [init](#init)
12- [nat64prefix](#nat64prefix)
13- [omrprefix](#omrprefix)
14- [onlinkprefix](#onlinkprefix)
15- [pd](#pd)
16- [peers](#peers)
17- [prefixtable](#prefixtable)
18- [rioprf](#rioprf)
19- [routeprf](#routeprf)
20- [routers](#routers)
21- [state](#state)
22
23## Command Details
24
25### help
26
27Usage: `br help`
28
29Print BR command help menu.
30
31```bash
32> br help
33counters
34disable
35enable
36omrprefix
37onlinkprefix
38pd
39peers
40prefixtable
41raoptions
42rioprf
43routeprf
44routers
45state
46Done
47```
48
49### init
50
51Usage: `br init <interface> <enabled>`
52
53Initializes the Border Routing Manager on given infrastructure interface.
54
55```bash
56> br init 2 1
57Done
58```
59
60### enable
61
62Usage: `br enable`
63
64Enable the Border Routing functionality.
65
66```bash
67> br enable
68Done
69```
70
71### disable
72
73Usage: `br disable`
74
75Disable the Border Routing functionality.
76
77```bash
78> br disable
79Done
80```
81
82### state
83
84Usage: `br state`
85
86Get the Border Routing state:
87
88- `uninitialized`: Routing Manager is uninitialized.
89- `disabled`: Routing Manager is initialized but disabled.
90- `stopped`: Routing Manager in initialized and enabled but currently stopped.
91- `running`: Routing Manager is initialized, enabled, and running.
92
93```bash
94> br state
95running
96```
97
98### counters
99
100Usage : `br counters`
101
102Get the Border Router counter.
103
104```bash
105> br counters
106Inbound Unicast: Packets 4 Bytes 320
107Inbound Multicast: Packets 0 Bytes 0
108Outbound Unicast: Packets 2 Bytes 160
109Outbound Multicast: Packets 0 Bytes 0
110RA Rx: 4
111RA TxSuccess: 2
112RA TxFailed: 0
113RS Rx: 0
114RS TxSuccess: 2
115RS TxFailed: 0
116Done
117```
118
119### omrprefix
120
121Usage: `br omrprefix [local|favored]`
122
123Get local or favored or both off-mesh-routable prefixes of the Border Router.
124
125```bash
126> br omrprefix
127Local: fdfc:1ff5:1512:5622::/64
128Favored: fdfc:1ff5:1512:5622::/64 prf:low
129Done
130
131> br omrprefix favored
132fdfc:1ff5:1512:5622::/64 prf:low
133Done
134
135> br omrprefix local
136fdfc:1ff5:1512:5622::/64
137Done
138```
139
140### onlinkprefix
141
142Usage: `br onlinkprefix [local|favored]`
143
144Get local or favored or both on-link prefixes of the Border Router.
145
146```bash
147> br onlinkprefix
148Local: fd41:2650:a6f5:0::/64
149Favored: 2600::0:1234:da12::/64
150Done
151
152> br onlinkprefix favored
1532600::0:1234:da12::/64
154Done
155
156> br onlinkprefix local
157fd41:2650:a6f5:0::/64
158Done
159```
160
161### nat64prefix
162
163Usage: `br nat64prefix [local|favored]`
164
165Get local or favored or both NAT64 prefixes of the Border Router.
166
167`OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE` is required.
168
169```bash
170> br nat64prefix
171Local: fd14:1078:b3d5:b0b0:0:0::/96
172Favored: fd14:1078:b3d5:b0b0:0:0::/96 prf:low
173Done
174
175> br nat64prefix favored
176fd14:1078:b3d5:b0b0:0:0::/96 prf:low
177Done
178
179> br nat64prefix
180fd14:1078:b3d5:b0b0:0:0::/96
181Done
182```
183
184### pd
185
186Usage: `br pd [enable|disable]`
187
188Enable/Disable the DHCPv6 PD.
189
190```bash
191> br pd enable
192Done
193
194> br pd disable
195Done
196```
197
198Usage: `br pd state`
199
200Get the state of DHCPv6 PD.
201
202`OPENTHREAD_CONFIG_BORDER_ROUTING_DHCP6_PD_ENABLE` is required.
203
204- `disabled`: DHCPv6 PD is disabled on the border router.
205- `stopped`: DHCPv6 PD in enabled but won't try to request and publish a prefix.
206- `running`: DHCPv6 PD is enabled and will try to request and publish a prefix.
207
208```bash
209> br pd state
210running
211Done
212```
213
214Usage `br pd omrprefix`
215
216Get the DHCPv6 Prefix Delegation (PD) provided off-mesh-routable (OMR) prefix.
217
218`OPENTHREAD_CONFIG_BORDER_ROUTING_DHCP6_PD_ENABLE` is required.
219
220```bash
221> br pd omrprefix
2222001:db8:cafe:0:0/64 lifetime:1800 preferred:1800
223Done
224```
225
226### peers
227
228Usage: `br peers`
229
230Get the list of peer BRs found in the Network Data.
231
232`OPENTHREAD_CONFIG_BORDER_ROUTING_TRACK_PEER_BR_INFO_ENABLE` is required.
233
234Peer BRs are other devices within the Thread mesh that provide external IP connectivity. A device is considered to provide external IP connectivity if at least one of the following conditions is met regarding its Network Data entries:
235
236- It has added at least one external route entry.
237- It has added at least one prefix entry with both the default-route and on-mesh flags set.
238- It has added at least one domain prefix (with both the domain and on-mesh flags set).
239
240The list of peer BRs specifically excludes the current device, even if it is itself acting as a BR.
241
242Info per BR entry:
243
244- RLOC16 of the BR
245- Age as the duration interval since this BR appeared in Network Data. It is formatted as `{hh}:{mm}:{ss}` for hours, minutes, seconds, if the duration is less than 24 hours. If the duration is 24 hours or more, the format is `{dd}d.{hh}:{mm}:{ss}` for days, hours, minutes, seconds.
246
247```bash
248> br peers
249rloc16:0x5c00 age:00:00:49
250rloc16:0xf800 age:00:01:51
251Done
252```
253
254Usage: `br peers count`
255
256Gets the number of peer BRs found in the Network Data.
257
258The count does not include the current device, even if it is itself acting as a BR.
259
260The output indicates the minimum age among all peer BRs. Age is formatted as `{hh}:{mm}:{ss}` for hours, minutes, seconds, if the duration is less than 24 hours. If the duration is 24 hours or more, the format is `{dd}d.{hh}:{mm}:{ss}` for days, hours, minutes, seconds.
261
262```bash
263> br peer count
2642 min-age:00:00:49
265Done
266```
267
268### prefixtable
269
270Usage: `br prefixtable`
271
272Get the discovered prefixes by Border Routing Manager on the infrastructure link.
273
274Info per prefix entry:
275
276- The prefix
277- Whether the prefix is on-link or route
278- Milliseconds since last received Router Advertisement containing this prefix
279- Prefix lifetime in seconds
280- Preferred lifetime in seconds only if prefix is on-link
281- Route preference (low, med, high) only if prefix is route (not on-link)
282- The router IPv6 address which advertising this prefix
283- Flags in received Router Advertisement header:
284  - M: Managed Address Config flag
285  - O: Other Config flag
286  - S: SNAC Router flag
287
288```bash
289> br prefixtable
290prefix:fd00:1234:5678:0::/64, on-link:no, ms-since-rx:29526, lifetime:1800, route-prf:med, router:ff02:0:0:0:0:0:0:1 (M:0 O:0 S:1)
291prefix:1200:abba:baba:0::/64, on-link:yes, ms-since-rx:29527, lifetime:1800, preferred:1800, router:ff02:0:0:0:0:0:0:1 (M:0 O:0 S:1)
292Done
293```
294
295### raoptions
296
297Usage: `br raoptions <options>`
298
299Sets additional options to append at the end of emitted Router Advertisement (RA) messages. `<options>` provided as hex bytes.
300
301```bash
302> br raoptions 0400ff00020001
303Done
304```
305
306### raoptions clear
307
308Usage: `br raoptions clear`
309
310Clear any previously set additional options to append at the end of emitted Router Advertisement (RA) messages.
311
312```bash
313> br raoptions clear
314Done
315```
316
317### rioprf
318
319Usage: `br rioprf`
320
321Get the preference used when advertising Route Info Options (e.g., for discovered OMR prefixes) in emitted Router Advertisement message.
322
323```bash
324> br rioprf
325med
326Done
327```
328
329### rioprf \<prf\>
330
331Usage: `br rioprf high|med|low`
332
333Set the preference (which may be 'high', 'med', or 'low') to use when advertising Route Info Options (e.g., for discovered OMR prefixes) in emitted Router Advertisement message.
334
335```bash
336> br rioprf low
337Done
338```
339
340### rioprf clear
341
342Usage: `br rioprf clear`
343
344Clear a previously set preference value for advertising Route Info Options (e.g., for discovered OMR prefixes) in emitted Router Advertisement message. When cleared BR will use device's role to determine the RIO preference: Medium preference when in router/leader role and low preference when in child role.
345
346```bash
347> br rioprf clear
348Done
349```
350
351### routeprf
352
353Usage: `br routeprf`
354
355Get the preference used for publishing routes in Thread Network Data. This may be the automatically determined route preference, or an administratively set fixed route preference - if applicable.
356
357```bash
358> br routeprf
359med
360Done
361```
362
363### routeprf \<prf\>
364
365Usage: `br routeprf high|med|low`
366
367Set the preference (which may be 'high', 'med', or 'low') to use publishing routes in Thread Network Data. Setting a preference value overrides the automatic route preference determination. It is used only for an explicit administrative configuration of a Border Router.
368
369```bash
370> br routeprf low
371Done
372```
373
374### routeprf clear
375
376Usage: `br routeprf clear`
377
378Clear a previously set preference value for publishing routes in Thread Network Data. When cleared BR will automatically determine the route preference based on device's role and link quality to parent (when acting as end-device).
379
380```bash
381> br routeprf clear
382Done
383```
384
385### routers
386
387Usage: `br routers`
388
389Get the list of discovered routers by Border Routing Manager on the infrastructure link.
390
391Info per router:
392
393- The router IPv6 address
394- Flags in received Router Advertisement header:
395  - M: Managed Address Config flag
396  - O: Other Config flag
397  - S: SNAC Router flag (indicates whether the router is a stub router)
398- Milliseconds since last received message from this router
399- Reachability flag: A router is marked as unreachable if it fails to respond to multiple Neighbor Solicitation probes.
400- Age: Duration interval since this router was first discovered. It is formatted as `{hh}:{mm}:{ss}` for hours, minutes, seconds, if the duration is less than 24 hours. If the duration is 24 hours or more, the format is `{dd}d.{hh}:{mm}:{ss}` for days, hours, minutes, seconds.
401- `(this BR)` is appended when the router is the local device itself.
402- `(peer BR)` is appended when the router is likely a peer BR connected to the same Thread mesh. This requires `OPENTHREAD_CONFIG_BORDER_ROUTING_TRACK_PEER_BR_INFO_ENABLE`.
403
404```bash
405> br routers
406ff02:0:0:0:0:0:0:1 (M:0 O:0 S:1) ms-since-rx:1505 reachable:yes age:00:18:13
407Done
408```
409

README_COAP.md

1# OpenThread CLI - CoAP Example
2
3The OpenThread CoAP APIs may be invoked via the OpenThread CLI.
4
5## Quick Start
6
7### Form Network
8
9Form a network with at least two devices.
10
11### Node 1
12
13On node 1, setup CoAP server with resource `test-resource`.
14
15```bash
16> coap start
17Done
18> coap resource test-resource
19Done
20```
21
22### Node 2
23
24```bash
25> coap start
26Done
27> coap get fdde:ad00:beef:0:d395:daee:a75:3964 test-resource
28Done
29coap response from [fdde:ad00:beef:0:2780:9423:166c:1aac] with payload: 30
30> coap put fdde:ad00:beef:0:2780:9423:166c:1aac test-resource con payload
31Done
32coap response from [fdde:ad00:beef:0:2780:9423:166c:1aac]
33```
34
35### Result
36
37On node 1, you should see output similar to below:
38
39```bash
40coap request from [fdde:ad00:beef:0:b3:e3f6:2dcc:4b79] GET
41coap response sent
42coap request from [fdde:ad00:beef:0:b3:e3f6:2dcc:4b79] PUT with payload: 7061796c6f6164
43coap response sent
44```
45
46## Command List
47
48- [help](#help)
49- [cancel](#cancel)
50- [delete](#delete-address-uri-path-type-payload)
51- [get](#get-address-uri-path-type)
52- [observe](#observe-address-uri-path-type)
53- [parameters](#parameters)
54- [post](#post-address-uri-path-type-payload)
55- [put](#put-address-uri-path-type-payload)
56- [resource](#resource-uri-path)
57- [set](#set-new-content)
58- [start](#start)
59- [stop](#stop)
60
61## Command Details
62
63### help
64
65```bash
66> coap help
67help
68cancel
69delete
70get
71observe
72parameters
73post
74put
75resource
76set
77start
78stop
79Done
80```
81
82List the CoAP CLI commands.
83
84### cancel
85
86Request the cancellation of an existing observation subscription to a remote resource.
87
88```bash
89> coap cancel
90Done
91```
92
93### delete \<address\> \<uri-path\> \[type\] \[payload\]
94
95- address: IPv6 address of the CoAP server.
96- uri-path: URI path of the resource.
97- type: "con" for Confirmable or "non-con" for Non-confirmable (default).
98- payload: CoAP request payload.
99
100```bash
101> coap delete fdde:ad00:beef:0:2780:9423:166c:1aac test-resource con payload
102Done
103```
104
105### get \<address\> \<uri-path\> \[type\]
106
107- address: IPv6 address of the CoAP server.
108- uri-path: URI path of the resource.
109- type: "con" for Confirmable or "non-con" for Non-confirmable (default). Use "block-<block-size>" if the response should be transferred block-wise. ("block-16","block-32","block-64","block-128","block-256","block-512","block-1024")
110
111```bash
112> coap get fdde:ad00:beef:0:2780:9423:166c:1aac test-resource
113Done
114```
115
116```bash
117> coap get fdde:ad00:beef:0:2780:9423:166c:1aac test-resource block-1024
118Done
119```
120
121### observe \<address\> \<uri-path\> \[type\]
122
123This is the same a `get`, but the `Observe` parameter will be sent, set to 0 triggering a subscription request.
124
125- address: IPv6 address of the CoAP server.
126- uri-path: URI path of the resource.
127- type: "con" for Confirmable or "non-con" for Non-confirmable (default).
128
129```bash
130> coap observe fdde:ad00:beef:0:2780:9423:166c:1aac test-resource
131Done
132```
133
134### parameters \<type\> \["default"|<ack_timeout\> <ack_random_factor_numerator\> <ack_random_factor_denominator\> <max_retransmit\>\]
135
136Sets transmission parameters for the following interactions.
137
138- type: "request" for CoAP requests and "response" for CoAP responses.
139
140If no more parameters are given, the command prints the current configuration:
141
142```bash
143> coap parameters request
144Transmission parameters for request:
145ACK_TIMEOUT=1000 ms, ACK_RANDOM_FACTOR=255/254, MAX_RETRANSMIT=2
146Done
147```
148
149If `"default"` is given, the command sets the default configuration for the transmission parameters.
150
151```bash
152> coap parameters request default
153Transmission parameters for request:
154default
155Done
156```
157
158Also, you can specify the transmission parameters in the command line:
159
160- ack_timeout (0~UINT32_MAX): RFC7252 ACK_TIMEOUT, in milliseconds.
161- ack_random_factor_numerator, ack_random_factor_denominator (0~255): RFC7252 ACK_RANDOM_FACTOR=ack_random_factor_numerator/ack_random_factor_denominator.
162- max_retransmit (0~255): RFC7252 MAX_RETRANSMIT.
163
164```bash
165> coap parameters request 1000 255 254 2
166Transmission parameters for request:
167ACK_TIMEOUT=1000 ms, ACK_RANDOM_FACTOR=255/254, MAX_RETRANSMIT=2
168Done
169```
170
171### post \<address\> \<uri-path\> \[type\] \[payload\]
172
173- address: IPv6 address of the CoAP server.
174- uri-path: URI path of the resource.
175- type: "con" for Confirmable or "non-con" for Non-confirmable (default). Use "block-<block-size>" to send blocks with random payload. ("block-16","block-32","block-64","block-128","block-256","block-512","block-1024")
176- payload: CoAP request payload. If \[type\] is "block-<block-size>", the amount of blocks to be sent can be set here.
177
178```bash
179> coap post fdde:ad00:beef:0:2780:9423:166c:1aac test-resource con payload
180Done
181```
182
183```bash
184> coap post fdde:ad00:beef:0:2780:9423:166c:1aac test-resource block-1024 10
185Done
186```
187
188### put \<address\> \<uri-path\> \[type\] \[payload\]
189
190- address: IPv6 address of the CoAP server.
191- uri-path: URI path of the resource.
192- type: "con" for Confirmable or "non-con" for Non-confirmable (default). Use "block-<block-size>" to send blocks with random payload. ("block-16","block-32","block-64","block-128","block-256","block-512","block-1024")
193- payload: CoAP request payload. If \[type\] is "block-<block-size>", the amount of blocks to be sent can be set here.
194
195```bash
196> coap put fdde:ad00:beef:0:2780:9423:166c:1aac test-resource con payload
197Done
198```
199
200```bash
201> coap put fdde:ad00:beef:0:2780:9423:166c:1aac test-resource block-1024 10
202Done
203```
204
205### resource \[uri-path\]
206
207Sets the URI path for the test resource.
208
209```bash
210> coap resource test-resource
211Done
212> coap resource
213test-resource
214Done
215```
216
217### set \[new-content\]
218
219Sets the content sent by the test resource. If a CoAP client is observing the resource, a notification is sent to that client.
220
221```bash
222> coap set Testing123
223Done
224```
225
226### start
227
228Starts the application coap service.
229
230```bash
231> coap start
232Done
233```
234
235### stop
236
237Stops the application coap service.
238
239```bash
240> coap stop
241Done
242```
243

README_COAPS.md

1# OpenThread CLI - CoAPS Example
2
3The OpenThread CoAPS APIs may be invoked via the OpenThread CLI.
4
5## Quick Start
6
7### Form Network
8
9Form a network with at least two devices.
10
11### Configure DTLS ciphersuite.
12
13CoAPS uses DTLS to establish a secure, end-to-end connection.
14
15This example supports two ciphersuites:
16
17- TLS_PSK_WITH_AES_128_CCM_8
18
19  ```bash
20  > coaps psk <your-psk> <your-psk-id>
21  Done
22  ```
23
24- TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8
25  ```bash
26  > coaps x509
27  Done
28  ```
29  The X.509 certificate stored in `core/cli/x509_cert_key.hpp`.
30
31### Node 1
32
33On node 1, setup CoAPS server with resource `test-resource`.
34
35```bash
36> coaps start
37Done
38> coaps resource test-resource
39Done
40```
41
42### Node 2
43
44```bash
45> coaps start
46Done
47> coaps connect <peer-ip6-address>
48Done
49coaps connected
50> coaps get test-resource
51Done
52coaps response from fdde:ad00:beef:0:9903:14b:27e0:5744 with payload: 68656c6c6f576f726c6400
53> coaps put test-resource con payload
54Done
55coaps response from fdde:ad00:beef:0:9903:14b:27e0:5744
56```
57
58### Result
59
60On node 1, you should see output similar to below:
61
62```bash
63coaps request from fdde:ad00:beef:0:9e68:576f:714c:f395 GET
64coaps response sent
65coaps request from fdde:ad00:beef:0:9e68:576f:714c:f395 PUT with payload: 7061796c6f6164
66coaps response sent
67```
68
69## Generate Elliptic Curve Private Key and X.509 Certificate
70
71### EC Private Key
72
73```bash
74> openssl ecparam -genkey -name prime256v1 -noout -out ec_private.pem
75```
76
77### X.509 Certificate
78
79```bash
80> openssl req -x509 -new -key ec_private.pem -out x509_cert.pem -days 30
81```
82
83## Command List
84
85- [help](#help)
86- [connect](#connect-address)
87- [delete](#delete-uri-path-type-payload)
88- [disconnect](#disconnect)
89- [get](#get-uri-path-type)
90- [isclosed](#isclosed)
91- [isconnactive](#isconnactive)
92- [isconnected](#isconnected)
93- [post](#post-uri-path-type-payload)
94- [psk](#psk-psk-pskid)
95- [put](#put-uri-path-type-payload)
96- [resource](#resource-uri-path)
97- [set](#set-new-content)
98- [start](#start)
99- [stop](#stop)
100- [x509](#x509)
101
102## Command Details
103
104### help
105
106```bash
107> coaps help
108connect
109delete
110disconnect
111get
112isclosed
113isconnactive
114isconnected
115post
116psk
117put
118resource
119set
120start
121stop
122x509
123Done
124```
125
126List the CoAPS CLI commands.
127
128### connect \<address\>
129
130Establish DTLS session.
131
132- address: IPv6 address of the peer.
133
134```bash
135> coaps connect fdde:ad00:beef:0:9903:14b:27e0:5744
136Done
137coaps connected
138```
139
140### delete \<uri-path\> \[type\] \[payload\]
141
142- uri-path: URI path of the resource.
143- type: "con" for Confirmable or "non-con" for Non-confirmable (default).
144- payload: CoAPS request payload.
145
146```bash
147> coaps delete test-resource con payload
148Done
149```
150
151### disconnect
152
153```bash
154> coaps disconnect
155coaps disconnected
156Done
157```
158
159### get \<uri-path\> \[type\]
160
161- uri-path: URI path of the resource.
162- type: "con" for Confirmable or "non-con" for Non-confirmable (default). Use "block-<block-size>" if the response should be transferred block-wise. ("block-16","block-32","block-64","block-128","block-256","block-512","block-1024")
163
164```bash
165> coaps get test-resource
166Done
167```
168
169```bash
170> coaps get test-resource block-1024
171Done
172```
173
174### post \<uri-path\> \[type\] \[payload\]
175
176- uri-path: URI path of the resource.
177- type: "con" for Confirmable or "non-con" for Non-confirmable (default). Use "block-<block-size>" to send blocks with random payload. ("block-16","block-32","block-64","block-128","block-256","block-512","block-1024")
178- payload: CoAP request payload. If \[type\] is "block-<block-size>", the amount of blocks to be sent can be set here.
179
180```bash
181> coaps post test-resource con payload
182Done
183```
184
185```bash
186> coaps post test-resource block-1024 10
187Done
188```
189
190### psk \<psk\> \<pskid\>
191
192Set DTLS ciphersuite to `TLS_PSK_WITH_AES_128_CCM_8`.
193
194- psk: pre-shared key
195- pskid: pre-shared key identifier
196
197```bash
198> coaps psk 123 pskid
199Done
200```
201
202### put \<uri-path\> \[type\] \[payload\]
203
204- uri-path: URI path of the resource.
205- type: "con" for Confirmable or "non-con" for Non-confirmable (default). Use "block-<block-size>" to send blocks with random payload. ("block-16","block-32","block-64","block-128","block-256","block-512","block-1024")
206- payload: CoAP request payload. If \[type\] is "block-<block-size>", the amount of blocks to be sent can be set here.
207
208```bash
209> coaps put test-resource con payload
210Done
211```
212
213```bash
214> coaps put test-resource block-1024 10
215Done
216```
217
218### resource \[uri-path\]
219
220Sets the URI path for the test resource.
221
222```bash
223> coaps resource test-resource
224Done
225> coaps resource
226test-resource
227Done
228```
229
230### set \[new-content\]
231
232Sets the content sent by the test resource.
233
234```bash
235> coaps set Testing123
236Done
237```
238
239### start \[check-peer-cert\|max-conn-attempts\]
240
241Starts the application coaps service.
242
243The `check-peer-cert` parameter determines if the peer-certificate check is enabled (default) or disabled. The `max-conn-attempts` parameter sets the maximum number of allowed attempts, successful or failed, to connect to the CoAP Secure server. The default value of this parameter is 0, which means that there is no limit to the number of attempts. The `check-peer-cert` and `max-conn-attempts` parameters work together in the following combinations, even though you can only specify one argument:
244
245- No argument specified: Defaults are used.
246- Setting `check-peer-cert` to `true`: Has the same effect as as omitting the argument, which is that the `check-peer-cert` value is `true`, and the `max-conn-attempts` value is 0.
247- Setting `check-peer-cert` to `false`: `check-peer-cert` value is `false`, and the `max-conn-attempts` value is `0`.
248- Specifying a number: `check-peer-cert` is `true`, and the `max-conn-attempts` value is the number specified in the argument.
249
250```bash
251> coaps start
252Done
253```
254
255### stop
256
257Stops the application coaps service.
258
259```bash
260> coaps stop
261Done
262```
263
264### isconnected
265
266Indicates whether or not the CoAP secure service is connected.
267
268```bash
269> coaps isconnected
270yes
271Done
272```
273
274### isconnactive
275
276Indicates whether or not the CoAP secure service connection is active (already connected or establishing a connection).
277
278```bash
279> coaps isconnactive
280yes
281Done
282```
283
284### isclosed
285
286Indicates whether or not the CoAP secure service is closed.
287
288```bash
289> coaps isclosed
290no
291Done
292```
293
294### x509
295
296Set DTLS ciphersuite to `TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8`.
297
298The X.509 certificate stored in [`src/cli/x509_cert_key.hpp`](x509_cert_key.hpp).
299
300```bash
301> coaps x509
302Done
303```
304

README_COMMISSIONER.md

1# OpenThread CLI - Commissioner
2
3## Overview
4
5The Commissioner is an entity that can add new Thread devices securely to a Thread network. It also can manage a Thread network by changing network configuration parameters ([Operational Datasets](README_DATASET.md)) or sending specific management/diagnostic commands to selected Thread devices. Before a Commissioner can do its tasks, it has to petition to the Leader to get permission to become the Commissioner.
6
7## Quick Start
8
9See [README_COMMISSIONING.md](README_COMMISSIONING.md).
10
11## Command List
12
13- [help](#help)
14- [announce](#announce)
15- [energy](#energy)
16- [joiner add](#joiner-add)
17- [joiner remove](#joiner-remove)
18- [joiner table](#joiner-table)
19- [mgmtget](#mgmtget)
20- [mgmtset](#mgmtset)
21- [panid](#panid)
22- [provisioningurl](#provisioningurl)
23- [sessionid](#sessionid)
24- [start](#start)
25- [state](#state)
26- [stop](#stop)
27
28## Command Details
29
30### help
31
32Usage: `commissioner help`
33
34Print commissioner help menu.
35
36```bash
37> commissioner help
38help
39announce
40energy
41joiner
42mgmtget
43mgmtset
44panid
45provisioningurl
46sessionid
47start
48stop
49Done
50```
51
52### announce
53
54Usage: `commissioner announce <mask> <count> <period> <destination>`
55
56Send a `MGMT_ANNOUNCE_BEGIN` message.
57
58- mask: Bitmask identifying channels to send MLE Announce messages.
59- count: Number of MLE Announce transmissions per channel.
60- period: Period between successive MLE Announce transmissions (milliseconds).
61- destination: IPv6 destination for the message (may be multicast).
62
63```bash
64> commissioner announce 0x00050000 2 32 fdde:ad00:beef:0:0:ff:fe00:c00
65Done
66```
67
68### energy
69
70Usage: `commissioner energy <mask> <count> <period> <scanDuration> <destination>`
71
72Send a `MGMT_ED_SCAN` message.
73
74- mask: Bitmask identifying channels to perform IEEE 802.15.4 ED Scans.
75- count: Number of IEEE 802.15.4 ED Scans per channel.
76- period: Period between successive IEEE 802.15.4 ED Scans (milliseconds).
77- scanDuration: IEEE 802.15.4 ScanDuration to use when performing an IEEE 802.15.4 ED Scan (milliseconds).
78- destination: IPv6 destination for the message (may be multicast).
79
80The contents of `MGMT_ED_REPORT` messages (i.e. Channel Mask and Energy List) are printed as they are received.
81
82```bash
83> commissioner energy 0x00050000 2 32 1000 fdde:ad00:beef:0:0:ff:fe00:c00
84Done
85Energy: 00050000 0 0 0 0
86```
87
88### joiner add
89
90Usage: `commissioner joiner add <eui64>|<discerner> <pskd> [timeout]`
91
92Add a Joiner entry.
93
94- eui64: The IEEE EUI-64 of the Joiner or '\*' to match any Joiner.
95- discerner: The Joiner discerner in format `number/length`.
96- pskd: Pre-Shared Key for the Joiner.
97- timeout: joiner timeout in seconds.
98
99```bash
100> commissioner joiner add d45e64fa83f81cf7 J01NME
101Done
102```
103
104```bash
105> commissioner joiner add 0xabc/12 J01NME
106Done
107```
108
109### joiner remove
110
111Usage: `commissioner joiner remove <eui64>|<discerner>`
112
113Remove a Joiner entry.
114
115- eui64: The IEEE EUI-64 of the Joiner or '\*' to match any Joiner.
116- discerner: The Joiner discerner in format `number/length`.
117
118```bash
119> commissioner joiner remove d45e64fa83f81cf7
120Done
121```
122
123```bash
124> commissioner joiner remove 0xabc/12
125Done
126```
127
128### joiner table
129
130Usage: `commissioner joiner table`
131
132List all Joiner entries.
133
134```bash
135> commissioner joiner table
136| ID                    | PSKd                             | Expiration |
137+-----------------------+----------------------------------+------------+
138|                     * |                           J01NME |      81015 |
139|      d45e64fa83f81cf7 |                           J01NME |     101204 |
140| 0x0000000000000abc/12 |                           J01NME |     114360 |
141Done
142```
143
144### mgmtget
145
146Usage: `commissioner mgmtget [locator] [sessionid] [steeringdata] [joinerudpport] [-x <TLV Types>]`
147
148Send a `MGMT_GET` message to the Leader.
149
150```bash
151> commissioner mgmtget locator sessionid
152Done
153```
154
155### mgmtset
156
157Usage: `commissioner mgmtset [locator <locator>] [sessionid <sessionid>] [steeringdata <steeringdata>] [joinerudpport <joinerudpport>] [-x <TLVs>]`
158
159Send a `MGMT_SET` message to the Leader.
160
161```bash
162> commissioner mgmtset joinerudpport 9988
163Done
164```
165
166### panid
167
168Usage: `commissioner panid <panid> <mask> <destination>`
169
170Send a `MGMT_PANID_QUERY` message.
171
172- panid: PAN ID to check for conflicts.
173- mask: Bitmask identifying channels to perform IEEE 802.15.4 Active Scans.
174- destination: IPv6 destination for the message (may be multicast).
175
176The contents of `MGMT_PANID_CONFLICT` messages (i.e. PAN ID and Channel Mask) are printed as they are received.
177
178```bash
179> commissioner panid 0xdead 0x7fff800 fdde:ad00:beef:0:0:ff:fe00:c00
180Done
181Conflict: dead, 00000800
182```
183
184### provisioningurl
185
186Usage: `commissioner provisioningurl <provisioningurl>`
187
188Set the Provisioning URL.
189
190```bash
191> commissioner provisioningurl http://github.com/openthread/openthread
192Done
193```
194
195### sessionid
196
197Usage: `commissioner sessionid`
198
199Get current commissioner session id.
200
201```bash
202> commissioner sessionid
2030
204Done
205```
206
207### id
208
209Usage: `commissioner id`
210
211Get the commissioner id.
212
213```bash
214> commissioner id
215OpenThread Commissioner
216Done
217```
218
219### id \<name\>
220
221Set the commissioner id.
222
223```bash
224> commissioner id "Custom Commissioner Id"
225Done
226```
227
228### start
229
230Usage: `commissioner start`
231
232Start the Commissioner role.
233
234This command will cause the device to send `LEAD_PET` and `LEAD_KA` messages.
235
236```bash
237> commissioner start
238Commissioner: petitioning
239Done
240Commissioner: active
241```
242
243### state
244
245Usage: `commissioner state`
246
247Get Commissioner state.
248
249This command will return the current Commissioner state.
250
251```bash
252> commissioner state
253active
254Done
255```
256
257### stop
258
259Usage: `commissioner stop`
260
261Stop the Commissioner role.
262
263This command will cause the device to send `LEAD_KA[Reject]` messages.
264
265```bash
266> commissioner stop
267Done
268```
269

README_COMMISSIONING.md

1# OpenThread CLI - Commissioning
2
3## Overview
4
5Commissioning is the process of adding a new Thread device, called the Joiner, to a Thread network. This process is done under guidance of a [Commissioner](README_COMMISSIONER.md).
6
7## Quick Start
8
9### Form Network
10
11Form a network with the Thread device that has Commissioner support.
12
131. Generate and view new network configuration.
14
15   ```bash
16   > dataset init new
17   Done
18   > dataset
19   Active Timestamp: 1
20   Channel: 13
21   Channel Mask: 0x07fff800
22   Ext PAN ID: d63e8e3e495ebbc3
23   Mesh Local Prefix: fd3d:b50b:f96d:722d::/64
24   Network Key: dfd34f0f05cad978ec4e32b0413038ff
25   Network Name: OpenThread-8f28
26   PAN ID: 0x8f28
27   PSKc: c23a76e98f1a6483639b1ac1271e2e27
28   Security Policy: 0, onrc
29   Done
30   ```
31
322. Commit new dataset to the Active Operational Dataset in non-volatile storage.
33
34   ```bash
35   dataset commit active
36   Done
37   ```
38
393. Enable Thread interface
40
41   ```bash
42   > ifconfig up
43   Done
44   > thread start
45   Done
46   ```
47
48### Obtain Joiner IEEE EUI-64
49
501. Start the Joiner node and obtain the Joiner's IEEE EUI-64.
51
52   ```bash
53   > eui64
54   18b4300000000002
55   Done
56   ```
57
58### Start Commissioner
59
601. Start the Commissioner Role
61
62   ```bash
63   > commissioner start
64   Commissioner: petitioning
65   Done
66   Commissioner: active
67   ```
68
692. Add the Joiner with the device-specific pre-shared key (PSKd)
70
71   ```bash
72   > commissioner joiner add 18b4300000000002 J01NME
73   Done
74   ```
75
76### Start Joiner
77
781. Factory reset the device.
79
80   ```bash
81   > factoryreset
82   ```
83
842. Start the Joiner process.
85
86   ```bash
87   > ifconfig up
88   Done
89   > joiner start J01NME
90   Done
91   Join success
92   ```
93
943. Attach to Thread network
95
96   ```bash
97   > thread start
98   Done
99   ```
100
1014. After successful attach, validate the device has the same Active Operational Dataset as above.
102
103   ```bash
104   > dataset active
105   Active Timestamp: 1
106   Channel: 13
107   Channel Mask: 0x07fff800
108   Ext PAN ID: d63e8e3e495ebbc3
109   Mesh Local Prefix: fd3d:b50b:f96d:722d::/64
110   Network Key: dfd34f0f05cad978ec4e32b0413038ff
111   Network Name: OpenThread-8f28
112   PAN ID: 0x8f28
113   PSKc: c23a76e98f1a6483639b1ac1271e2e27
114   Security Policy: 0, onrc
115   Done
116   ```
117
118## CLI Reference
119
120- [Commissioner CLI Reference](README_COMMISSIONER.md)
121- [Joiner CLI Reference](README_JOINER.md)
122

README_DATASET.md

1# OpenThread CLI - Operational Datasets
2
3## Overview
4
5Thread network configuration parameters are managed using Active and Pending Operational Dataset objects.
6
7### WARNING - Restrictions for production use!
8
9The CLI commands to write/change the Active and Pending Operational Datasets may allow setting invalid parameters, or invalid combinations of parameters, for testing purposes. These CLI commands can only be used:
10
11- To configure network parameters for the first device in a newly created Thread network.
12- For testing (not applicable to production devices).
13
14In production Thread networks, the correct method to write/change Operational Datasets is via a [Commissioner](README_COMMISSIONER.md) that performs [commissioning](README_COMMISSIONING.md). Production devices that are not an active Commissioner and are part of a Thread network MUST NOT modify the Operational Datasets in any way.
15
16### Active Operational Dataset
17
18The Active Operational Dataset includes parameters that are currently in use across an entire Thread network. The Active Operational Dataset contains:
19
20- Active Timestamp
21- Channel
22- Wake-up Channel
23- Channel Mask
24- Extended PAN ID
25- Mesh-Local Prefix
26- Network Name
27- PAN ID
28- PSKc
29- Security Policy
30
31### Pending Operational Dataset
32
33The Pending Operational Dataset is used to communicate changes to the Active Operational Dataset before they take effect. The Pending Operational Dataset contains all the parameters from the Active Operational Dataset, with the addition of:
34
35- Delay Timer
36- Pending Timestamp
37
38## Quick Start
39
40### Form Network
41
421. Generate and view new network configuration.
43
44   ```bash
45   > dataset init new
46   Done
47   > dataset
48   Active Timestamp: 1
49   Channel: 15
50   Wake-up Channel: 16
51   Channel Mask: 0x07fff800
52   Ext PAN ID: 39758ec8144b07fb
53   Mesh Local Prefix: fdf1:f1ad:d079:7dc0::/64
54   Network Key: f366cec7a446bab978d90d27abe38f23
55   Network Name: OpenThread-5938
56   PAN ID: 0x5938
57   PSKc: 3ca67c969efb0d0c74a4d8ee923b576c
58   Security Policy: 672 onrc 0
59   Done
60   ```
61
622. Commit new dataset to the Active Operational Dataset in non-volatile storage.
63
64   ```bash
65   dataset commit active
66   Done
67   ```
68
693. Enable Thread interface
70
71   ```bash
72   > ifconfig up
73   Done
74   > thread start
75   Done
76   ```
77
78### Attach to Existing Network
79
80Only the Network Key is required for a device to attach to a Thread network.
81
82While not required, specifying the channel avoids the need to search across multiple channels, improving both latency and efficiency of the attach process.
83
84After the device successfully attaches to a Thread network, the device will retrieve the complete Active Operational Dataset.
85
861. Create a partial Active Operational Dataset.
87
88   ```bash
89   > dataset networkkey dfd34f0f05cad978ec4e32b0413038ff
90   Done
91   > dataset commit active
92   Done
93   ```
94
952. Enable Thread interface.
96
97   ```bash
98   > ifconfig up
99   Done
100   > thread start
101   Done
102   ```
103
1043. After attaching, validate that the device received the complete Active Operational Dataset.
105
106   ```bash
107   > dataset active
108   Active Timestamp: 1
109   Channel: 15
110   Wake-up Channel: 16
111   Channel Mask: 0x07fff800
112   Ext PAN ID: 39758ec8144b07fb
113   Mesh Local Prefix: fdf1:f1ad:d079:7dc0::/64
114   Network Key: f366cec7a446bab978d90d27abe38f23
115   Network Name: OpenThread-5938
116   PAN ID: 0x5938
117   PSKc: 3ca67c969efb0d0c74a4d8ee923b576c
118   Security Policy: 672 onrc 0
119   Done
120   ```
121
122### Using the Dataset Updater to update Operational Dataset
123
124Dataset Updater can be used for a delayed update of network parameters on all devices of a Thread Network.
125
1261. Clear the dataset buffer and add the Dataset fields to update.
127
128   ```bash
129   > dataset clear
130   Done
131
132   > dataset channel 12
133   Done
134   ```
135
1362. Set the delay timer parameter (example uses 5 minutes or 300000 ms). Check the resulting dataset. There is no need to specify active or pending timestamps because the Dataset Updater will handle this. If specified the `dataset updater start` will issue an error.
137
138   ```bash
139   > dataset delay 300000
140
141   > dataset
142   Channel: 12
143   Delay: 30000
144   Done
145   ```
146
1473. Start the Dataset Updater, which will prepare a Pending Operation Dataset and inform the Leader to distribute it to other devices.
148
149   ```bash
150   > dataset updater start
151   Done
152
153   > dataset updater
154   Enabled
155   ```
156
1574. After about 5 minutes, the changes are applied to the Active Operational Dataset on the Leader. This can also be checked at other devices on the network: these should have applied the new Dataset too, at approximately the same time as the Leader has done this.
158
159   ```bash
160   > dataset active
161   Active Timestamp: 10
162   Channel: 12
163   Channel Mask: 0x07fff800
164   Ext PAN ID: 324a71d90cdc8345
165   Mesh Local Prefix: fd7d:da74:df5e:80c::/64
166   Network Key: be768535bac1b8d228960038311d6ca2
167   Network Name: OpenThread-bcaf
168   PAN ID: 0xbcaf
169   PSKc: e79b274ab22414a814ed5cce6a30be67
170   Security Policy: 672 onrc 0
171   Done
172   ```
173
174### Using the Pending Operational Dataset for Delayed Dataset Updates
175
176The Pending Operational Dataset can be used for a delayed update of network parameters on all devices of a Thread Network. If certain Active Operational Dataset parameters need to be changed, but the change would impact the connectivity of the network, delaying the update helps to let all devices receive the new parameters before the update is applied. Examples of such parameters are the channel, PAN ID, certain Security Policy bits, or Network Key.
177
178The delay timer determines the time period after which the Pending Operational Dataset takes effect and becomes the Active Operational Dataset. The following example shows how a Pending Operational Dataset with delay timer can be set at a Leader device. The Leader will initiate the distribution of the Pending Operational Dataset to the rest of the devices in the network.
179
180Normally, an active Commissioner will set a new Pending Operational Dataset. For testing purposes, we will do this in the example directly on the Leader using the CLI - so without using a Commissioner.
181
1821. The main parameter to change is the channel. We can display the current Active Operational Dataset to see that the current channel is 16.
183
184   ```bash
185   > dataset active
186   Active Timestamp: 1691070443
187   Channel: 16
188   Channel Mask: 0x07fff800
189   Ext PAN ID: 324a71d90cdc8345
190   Mesh Local Prefix: fd7d:da74:df5e:80c::/64
191   Network Key: be768535bac1b8d228960038311d6ca2
192   Network Name: OpenThread-bcaf
193   PAN ID: 0xbcaf
194   PSKc: e79b274ab22414a814ed5cce6a30be67
195   Security Policy: 672 onrc 0
196   Done
197   ```
198
1992. Create a new Dataset in the dataset buffer, by copying the Active Operational Dataset. Then change the channel number to 12 and increase the timestamp.
200
201   ```bash
202   > dataset init active
203   Done
204   > dataset activetimestamp 1696177379
205   Done
206   > dataset pendingtimestamp 1696177379
207   Done
208   > dataset channel 12
209   Done
210   ```
211
2123. Set the delay timer parameter to 5 minutes (300000 ms). Show the resulting Dataset that's ready to be used.
213
214   ```bash
215   > dataset delay 300000
216   Done
217   > dataset
218   Pending Timestamp: 1696177379
219   Active Timestamp: 1696177379
220   Channel: 12
221   Channel Mask: 0x07fff800
222   Delay: 300000
223   Ext PAN ID: 324a71d90cdc8345
224   Mesh Local Prefix: fd7d:da74:df5e:80c::/64
225   Network Key: be768535bac1b8d228960038311d6ca2
226   Network Name: OpenThread-bcaf
227   PAN ID: 0xbcaf
228   PSKc: e79b274ab22414a814ed5cce6a30be67
229   Security Policy: 672 onrc 0
230   Done
231   ```
232
2334. Commit the new Dataset as the Pending Operational Dataset. This also starts the delay timer countdown. The Leader then starts the distribution of the Pending Operational Dataset to other devices in the network.
234
235   ```bash
236   > dataset commit pending
237   Done
238   ```
239
2405. To verify that the delay timer is counting down, display the Pending Operational Dataset after a few seconds.
241
242   ```bash
243   > dataset pending
244   Pending Timestamp: 1696177379
245   Active Timestamp: 1696177379
246   Channel: 12
247   Channel Mask: 0x07fff800
248   Delay: 293051
249   Ext PAN ID: 324a71d90cdc8345
250   Mesh Local Prefix: fd7d:da74:df5e:80c::/64
251   Network Key: be768535bac1b8d228960038311d6ca2
252   Network Name: OpenThread-bcaf
253   PAN ID: 0xbcaf
254   PSKc: e79b274ab22414a814ed5cce6a30be67
255   Security Policy: 672 onrc 0
256   Done
257   ```
258
259   This shows that indeed the delay timer has started counting down from its initial value `300000`. The same can be optionally checked on other devices in the network.
260
2616) After about 5 minutes, check that the Pending Operational Dataset has been applied at the Leader. This can also be checked at other devices on the network: these should have applied the new Dataset too, at approximately the same time as the Leader has done this.
262
263   ```bash
264   > dataset active
265   Active Timestamp: 1696177379
266   Channel: 12
267   Channel Mask: 0x07fff800
268   Ext PAN ID: 324a71d90cdc8345
269   Mesh Local Prefix: fd7d:da74:df5e:80c::/64
270   Network Key: be768535bac1b8d228960038311d6ca2
271   Network Name: OpenThread-bcaf
272   PAN ID: 0xbcaf
273   PSKc: e79b274ab22414a814ed5cce6a30be67
274   Security Policy: 672 onrc 0
275   Done
276   ```
277
278   This shows that the Active Operational Dataset has now been updated to use channel 12. And the Pending Operational Dataset is no longer present, as can be seen by this command:
279
280   ```bash
281   > dataset pending
282   Error 23: NotFound
283   ```
284
285## Command List
286
287- [help](#help)
288- [active](#active)
289- [activetimestamp](#activetimestamp)
290- [channel](#channel)
291- [channelmask](#channelmask)
292- [clear](#clear)
293- [commit](#commit)
294- [delay](#delay)
295- [extpanid](#extpanid)
296- [init](#init)
297- [meshlocalprefix](#meshlocalprefix)
298- [mgmtgetcommand](#mgmtgetcommand)
299- [mgmtsetcommand](#mgmtsetcommand)
300- [networkkey](#networkkey)
301- [networkname](#networkname)
302- [panid](#panid)
303- [pending](#pending)
304- [pendingtimestamp](#pendingtimestamp)
305- [pskc](#pskc)
306- [securitypolicy](#securitypolicy)
307- [tlvs](#tlvs)
308- [updater](#updater)
309- [wakeupchannel](#wakeupchannel)
310
311## Command Details
312
313### help
314
315Usage: `dataset help`
316
317Print dataset help menu.
318
319```bash
320> dataset help
321help
322active
323activetimestamp
324channel
325channelmask
326clear
327commit
328delay
329extpanid
330init
331meshlocalprefix
332mgmtgetcommand
333mgmtsetcommand
334networkkey
335networkname
336panid
337pending
338pendingtimestamp
339pskc
340securitypolicy
341set
342tlvs
343wakeupchannel
344Done
345```
346
347### active
348
349Usage: `dataset active [-x]`
350
351Print Active Operational Dataset in human-readable form.
352
353```bash
354> dataset active
355Active Timestamp: 1
356Channel: 15
357Wake-up Channel: 16
358Channel Mask: 0x07fff800
359Ext PAN ID: 39758ec8144b07fb
360Mesh Local Prefix: fdf1:f1ad:d079:7dc0::/64
361Network Key: f366cec7a446bab978d90d27abe38f23
362Network Name: OpenThread-5938
363PAN ID: 0x5938
364PSKc: 3ca67c969efb0d0c74a4d8ee923b576c
365Security Policy: 672 onrc 0
366Done
367```
368
369Print Active Operational Dataset as hex-encoded TLVs.
370
371```bash
372> dataset active -x
3730e08000000000001000000030000164a0300001735060004001fffe00208b182e6a17996cecc0708fd3f363fa8f1b0bc0510ebb6f6a447c96e1542176df3a834ac0e030f4f70656e5468726561642d3663393901026c99041096e9cdfe1eb1363a3676e2b94df0271b0c0402a0f7f8
374Done
375```
376
377### activetimestamp
378
379Usage: `dataset activetimestamp [timestamp]`
380
381Get active timestamp seconds. It represents a "Unix time", in number of seconds since Jan 1st, 1970.
382
383```bash
384> dataset activetimestamp
385123456789
386Done
387```
388
389Set active timestamp seconds.
390
391```bash
392> dataset activetimestamp 123456789
393Done
394```
395
396### channel
397
398Usage: `channel [channel]`
399
400Get channel.
401
402```bash
403> dataset channel
40412
405Done
406```
407
408Set channel.
409
410```bash
411> dataset channel 12
412Done
413```
414
415### channelmask
416
417Usage: `dataset channelmask [channelmask]`
418
419Get channel mask.
420
421```bash
422> dataset channelmask
4230x07fff800
424Done
425```
426
427Set channel mask.
428
429```bash
430> dataset channelmask 0x07fff800
431Done
432```
433
434### clear
435
436Usage: `dataset clear`
437
438Reset operational dataset buffer.
439
440```bash
441> dataset clear
442Done
443```
444
445### commit
446
447Usage: `dataset commit <active|pending>`
448
449Commit operational dataset buffer to active/pending operational dataset.
450
451```bash
452> dataset commit active
453Done
454```
455
456### delay
457
458Usage: `dataset delay [delay]`
459
460Get delay timer value. The timer value is in milliseconds.
461
462```bash
463> dataset delay
4641000
465Done
466```
467
468Set delay timer value.
469
470```bash
471> dataset delay 100000
472Done
473```
474
475### extpanid
476
477Usage: `dataset extpanid [extpanid]`
478
479Get extended panid.
480
481```bash
482> dataset extpanid
483000db80123456789
484Done
485```
486
487Set extended panid.
488
489**NOTE** The commissioning credential in the dataset buffer becomes stale after changing this value. Use [pskc](#pskc) to reset.
490
491```bash
492> dataset extpanid 000db80123456789
493Done
494```
495
496### init
497
498Usage: `dataset init <active|new|pending|tlvs <hex-encoded TLVs>>`
499
500Initialize operational dataset buffer. Use `new` to initialize with randomly selected values:
501
502```bash
503> dataset init new
504Done
505```
506
507Use `active` or `pending` to initialize the dataset buffer with a copy of the current Active Operational Dataset or Pending Operational Dataset, respectively:
508
509```bash
510> dataset init active
511Done
512```
513
514Use the `tlvs` option to initialize the dataset buffer from a string of hex-encoded TLVs:
515
516```bash
517> dataset init tlvs 0e080000000000010000000300001235060004001fffe002088665f03e6e42e7750708fda576e5f9a5bd8c0510506071d8391be671569e080d52870fd5030f4f70656e5468726561642d633538640102c58d04108a926cf8b13275a012ceedeeae40910d0c0402a0f7f8
518Done
519```
520
521### meshlocalprefix
522
523Usage: `dataset meshlocalprefix [prefix]`
524
525Get mesh local prefix.
526
527```bash
528> dataset meshlocalprefix
529fd00:db8:0:0::/64
530Done
531```
532
533Set mesh local prefix.
534
535```bash
536> dataset meshlocalprefix fd00:db8::
537Done
538```
539
540### mgmtgetcommand
541
542Usage: `dataset mgmtgetcommand <active|pending> [address <destination>] [TLV list] [-x]`
543
544Send MGMT_ACTIVE_GET or MGMT_PENDING_GET.
545
546```bash
547> dataset mgmtgetcommand active address fdde:ad00:beef:0:558:f56b:d688:799 activetimestamp securitypolicy
548Done
549```
550
551### mgmtsetcommand
552
553Usage: `dataset mgmtsetcommand <active|pending> [TLV Type list] [-x]`
554
555Send MGMT_ACTIVE_SET or MGMT_PENDING_SET.
556
557```bash
558> dataset mgmtsetcommand active activetimestamp 123 securitypolicy 1 onrc 0
559Done
560```
561
562### networkkey
563
564Usage: `dataset networkkey [key]`
565
566Get network key
567
568```bash
569> dataset networkkey
57000112233445566778899aabbccddeeff
571Done
572```
573
574Set network key.
575
576```bash
577> dataset networkkey 00112233445566778899aabbccddeeff
578Done
579```
580
581### networkname
582
583Usage: `dataset networkname [name]`
584
585Get network name.
586
587```bash
588> dataset networkname
589OpenThread
590Done
591```
592
593Set network name.
594
595**NOTE** The commissioning credential in the dataset buffer becomes stale after changing this value. Use [pskc](#pskc) to reset.
596
597```bash
598> dataset networkname OpenThread
599Done
600```
601
602### panid
603
604Usage: `dataset panid [panid]`
605
606Get panid.
607
608```bash
609> dataset panid
6100x1234
611Done
612```
613
614Set panid.
615
616```bash
617> dataset panid 0x1234
618Done
619```
620
621### pending
622
623Usage: `dataset pending [-x]`
624
625Print Pending Operational Dataset in human-readable form.
626
627```bash
628> dataset pending
629Pending Timestamp: 2
630Active Timestamp: 1
631Channel: 26
632Channel Mask: 0x07fff800
633Delay: 58706
634Ext PAN ID: a74182f4d3f4de41
635Mesh Local Prefix: fd46:c1b9:e159:5574::/64
636Network Key: ed916e454d96fd00184f10a6f5c9e1d3
637Network Name: OpenThread-bff8
638PAN ID: 0xbff8
639PSKc: 264f78414adc683191863d968f72d1b7
640Security Policy: 672 onrc 0
641Done
642```
643
644Print Pending Operational Dataset as hex-encoded TLVs.
645
646```bash
647> dataset pending -x
6480e0800000000000100003308000000000002000034040000b512000300001a35060004001fffe00208a74182f4d3f4de410708fd46c1b9e15955740510ed916e454d96fd00184f10a6f5c9e1d3030f4f70656e5468726561642d626666380102bff80410264f78414adc683191863d968f72d1b70c0402a0f7f8
649Done
650```
651
652### pendingtimestamp
653
654Usage: `dataset pendingtimestamp [timestamp]`
655
656Get pending timestamp seconds. It represents a "Unix time", in number of seconds since Jan 1st, 1970.
657
658```bash
659> dataset pendingtimestamp
660123456789
661Done
662```
663
664Set pending timestamp seconds.
665
666```bash
667> dataset pendingtimestamp 123456789
668Done
669```
670
671### pskc
672
673Usage: `pskc [-p] [<key>|<passphrase>]`
674
675Get PSKc.
676
677```bash
678> dataset pskc
67967c0c203aa0b042bfb5381c47aef4d9e
680Done
681```
682
683Set PSKc.
684
685With `-p`(**only for FTD**) generate PSKc from \<passphrase\> (UTF-8 encoded) together with network name and extended PAN ID in the dataset buffer if set or values in the current stack if not, otherwise set PSKc as \<key\> (hex format).
686
687```bash
688> dataset pskc 67c0c203aa0b042bfb5381c47aef4d9e
689Done
690> dataset pskc -p 123456
691Done
692```
693
694### securitypolicy
695
696Usage: `dataset securitypolicy [<rotationtime> [onrcCepR] [versionthreshold]]`
697
698Get security policy.
699
700```bash
701> dataset securitypolicy
702672 onrc 0
703Done
704```
705
706Set security policy.
707
708- o: Obtaining the Network Key for out-of-band commissioning is enabled.
709- n: Native Commissioning using PSKc is allowed.
710- r: Thread 1.x Routers are enabled.
711- c: External Commissioner authentication is allowed using PSKc.
712- C: Thread 1.2 Commercial Commissioning is enabled.
713- e: Thread 1.2 Autonomous Enrollment is enabled.
714- p: Thread 1.2 Network Key Provisioning is enabled.
715- R: Non-CCM routers are allowed in Thread 1.2 CCM networks.
716
717If the `versionthreshold` parameter is not provided, a default value of zero is assumed.
718
719```bash
720> dataset securitypolicy 672 onrc 0
721Done
722```
723
724### set
725
726Usage: `dataset set <active|pending> <dataset>`
727
728Set the Active Operational Dataset using hex-encoded TLVs.
729
730```bash
731> dataset set active 0e080000000000010000000300000f35060004001fffe0020839758ec8144b07fb0708fdf1f1add0797dc00510f366cec7a446bab978d90d27abe38f23030f4f70656e5468726561642d353933380102593804103ca67c969efb0d0c74a4d8ee923b576c0c0402a0f7f8
732Done
733```
734
735Set the Pending Operational Dataset using hex-encoded TLVs.
736
737```bash
738> dataset set pending 0e0800000000000100003308000000000002000034040000b512000300001a35060004001fffe00208a74182f4d3f4de410708fd46c1b9e15955740510ed916e454d96fd00184f10a6f5c9e1d3030f4f70656e5468726561642d626666380102bff80410264f78414adc683191863d968f72d1b70c0402a0f7f8
739Done
740```
741
742### tlvs
743
744Usage: `dataset tlvs`
745
746Convert the Operational Dataset to hex-encoded TLVs.
747
748```bash
749> dataset
750Active Timestamp: 1
751Channel: 22
752Channel Mask: 0x07fff800
753Ext PAN ID: d196fa2040e973b6
754Mesh Local Prefix: fdbb:c310:c48f:3a39::/64
755Network Key: 9929154dbc363218bcd22f907caf5c15
756Network Name: OpenThread-de2b
757PAN ID: 0xde2b
758PSKc: 15b2c16f7ba92ed4bc7b1ee054f1553f
759Security Policy: 672 onrc 0
760Done
761
762> dataset tlvs
7630e080000000000010000000300001635060004001fffe00208d196fa2040e973b60708fdbbc310c48f3a3905109929154dbc363218bcd22f907caf5c15030f4f70656e5468726561642d646532620102de2b041015b2c16f7ba92ed4bc7b1ee054f1553f0c0402a0f7f8
764Done
765```
766
767### updater
768
769Usage: `dataset updater`
770
771Requires `OPENTHREAD_CONFIG_DATASET_UPDATER_ENABLE`.
772
773Indicate whether there is an ongoing Operation Dataset update request.
774
775```bash
776> dataset updater
777Enabled
778```
779
780### updater start
781
782Usage: `dataset updater start`
783
784Requires `OPENTHREAD_CONFIG_DATASET_UPDATER_ENABLE`.
785
786Request network to update its Operation Dataset to the current operational dataset buffer.
787
788The current operational dataset buffer should contain the fields to be updated with their new values. It must not contain Active or Pending Timestamp fields. The Delay field is optional. If not provided, a default value (1000 ms) is used.
789
790```bash
791> channel
79219
793Done
794
795> dataset clear
796Done
797> dataset channel 15
798Done
799> dataset
800Channel: 15
801Done
802
803> dataset updater start
804Done
805> dataset updater
806Enabled
807Done
808
809Dataset update complete: OK
810
811> channel
81215
813Done
814```
815
816### updater cancel
817
818Usage: `dataset updater cancel`
819
820Requires `OPENTHREAD_CONFIG_DATASET_UPDATER_ENABLE`.
821
822Cancels an ongoing (if any) Operational Dataset update request.
823
824```bash
825> dataset updater start
826Done
827> dataset updater
828Enabled
829Done
830>
831> dataset updater cancel
832Done
833> dataset updater
834Disabled
835Done
836```
837
838### wakeupchannel
839
840Usage: `wakeupchannel [channel]`
841
842Get wake-up channel.
843
844```bash
845> dataset wakeupchannel
84613
847Done
848```
849
850Set wake-up channel.
851
852```bash
853> dataset wakeupchannel 13
854Done
855```
856

README_HISTORY.md

1# OpenThread CLI - History Tracker
2
3History Tracker module records history of different events (e.g., RX and TX IPv6 messages or network info changes, etc.) as the Thread network operates. All tracked entries are timestamped.
4
5All commands under `history` require `OPENTHREAD_CONFIG_HISTORY_TRACKER_ENABLE` feature to be enabled.
6
7The number of entries recorded for each history list is configurable through a set of OpenThread config options, e.g. `OPENTHREAD_CONFIG_HISTORY_TRACKER_NET_INFO_LIST_SIZE` specifies the number of entries in Network Info history list. The History Tracker will keep the most recent entries overwriting oldest one when the list gets full.
8
9## Command List
10
11Usage : `history [command] ...`
12
13- [help](#help)
14- [ipaddr](#ipaddr)
15- [ipmaddr](#ipmaddr)
16- [neighbor](#neighbor)
17- [netinfo](#netinfo)
18- [prefix](#prefix)
19- [route](#route)
20- [router](#router)
21- [rx](#rx)
22- [rxtx](#rxtx)
23- [tx](#tx)
24
25## Timestamp Format
26
27Recorded entries are timestamped. When the history list is printed, the timestamps are shown relative the time the command was issues (i.e., when the list was printed) indicating how long ago the entry was recorded.
28
29```bash
30> history netinfo
31| Age                  | Role     | Mode | RLOC16 | Partition ID |
32+----------------------+----------+------+--------+--------------+
33|         02:31:50.628 | leader   | rdn  | 0x2000 |    151029327 |
34|         02:31:53.262 | detached | rdn  | 0xfffe |            0 |
35|         02:31:54.663 | detached | rdn  | 0x2000 |            0 |
36Done
37```
38
39For example `02:31:50.628` indicates the event was recorded "2 hours, 31 minutes, 50 seconds, and 628 milliseconds ago". Number of days is added for events that are older than 24 hours, e.g., `1 day 11:25:31.179`, or `31 days 03:00:23.931`.
40
41Timestamps use millisecond accuracy and are tacked up to 49 days. If the event is older than 49 days, the entry is still tracked in the list but the timestamp is shown as `more than 49 days`.
42
43## Command Details
44
45### help
46
47Usage: `history help`
48
49Print SRP client help menu.
50
51```bash
52> history help
53help
54ipaddr
55ipmaddr
56neighbor
57netinfo
58prefix
59route
60router
61rx
62rxtx
63tx
64Done
65>
66```
67
68### ipaddr
69
70Usage `history ipaddr [list] [<num-entries>]`
71
72Print the unicast IPv6 address history. Each entry provides:
73
74- Event: Added or Removed.
75- Address: Unicast address along with its prefix length (in bits).
76- Origin: thread, slaac, dhcp6, or manual.
77- Address Scope.
78- Flags: Preferred, Valid, and RLOC (whether the address is RLOC).
79
80Print the unicast IPv6 address history as table.
81
82```bash
83> history ipaddr
84| Age                  | Event   | Address / PrefixLength                      | Origin |Scope| P | V | R |
85+----------------------+---------+---------------------------------------------+--------+-----+---+---+---+
86|         00:00:04.991 | Removed | 2001:dead:beef:cafe:c4cb:caba:8d55:e30b/64  | slaac  |  14 | Y | Y | N |
87|         00:00:44.647 | Added   | 2001:dead:beef:cafe:c4cb:caba:8d55:e30b/64  | slaac  |  14 | Y | Y | N |
88|         00:01:07.199 | Added   | fd00:0:0:0:0:0:0:1/64                       | manual |  14 | Y | Y | N |
89|         00:02:17.885 | Added   | fdde:ad00:beef:0:0:ff:fe00:fc00/64          | thread |   3 | N | Y | N |
90|         00:02:17.885 | Added   | fdde:ad00:beef:0:0:ff:fe00:5400/64          | thread |   3 | N | Y | Y |
91|         00:02:20.107 | Removed | fdde:ad00:beef:0:0:ff:fe00:5400/64          | thread |   3 | N | Y | Y |
92|         00:02:21.575 | Added   | fdde:ad00:beef:0:0:ff:fe00:5400/64          | thread |   3 | N | Y | Y |
93|         00:02:21.575 | Added   | fdde:ad00:beef:0:ecea:c4fc:ad96:4655/64     | thread |   3 | N | Y | N |
94|         00:02:23.904 | Added   | fe80:0:0:0:3c12:a4d2:fbe0:31ad/64           | thread |   2 | Y | Y | N |
95Done
96```
97
98Print the unicast IPv6 address history as a list (the last 5 entries).
99
100```bash
101> history ipaddr list 5
10200:00:20.327 -> event:Removed address:2001:dead:beef:cafe:c4cb:caba:8d55:e30b prefixlen:64 origin:slaac scope:14 preferred:yes valid:yes rloc:no
10300:00:59.983 -> event:Added address:2001:dead:beef:cafe:c4cb:caba:8d55:e30b prefixlen:64 origin:slaac scope:14 preferred:yes valid:yes rloc:no
10400:01:22.535 -> event:Added address:fd00:0:0:0:0:0:0:1 prefixlen:64 origin:manual scope:14 preferred:yes valid:yes rloc:no
10500:02:33.221 -> event:Added address:fdde:ad00:beef:0:0:ff:fe00:fc00 prefixlen:64 origin:thread scope:3 preferred:no valid:yes rloc:no
10600:02:33.221 -> event:Added address:fdde:ad00:beef:0:0:ff:fe00:5400 prefixlen:64 origin:thread scope:3 preferred:no valid:yes rloc:yes
107Done
108```
109
110### ipmaddr
111
112Usage `history ipmaddr [list] [<num-entries>]`
113
114Print the multicast IPv6 address history. Each entry provides:
115
116- Event: Subscribed or Unsubscribed.
117- Address: Multicast address.
118- Origin: Thread, or Manual.
119
120Print the multicast IPv6 address history as table.
121
122```bash
123> history ipmaddr
124| Age                  | Event        | Multicast Address                       | Origin |
125+----------------------+--------------+-----------------------------------------+--------+
126|         00:00:08.592 | Unsubscribed | ff05:0:0:0:0:0:0:1                      | Manual |
127|         00:01:25.353 | Subscribed   | ff05:0:0:0:0:0:0:1                      | Manual |
128|         00:01:54.953 | Subscribed   | ff03:0:0:0:0:0:0:2                      | Thread |
129|         00:01:54.953 | Subscribed   | ff02:0:0:0:0:0:0:2                      | Thread |
130|         00:01:59.329 | Subscribed   | ff33:40:fdde:ad00:beef:0:0:1            | Thread |
131|         00:01:59.329 | Subscribed   | ff32:40:fdde:ad00:beef:0:0:1            | Thread |
132|         00:02:01.129 | Subscribed   | ff03:0:0:0:0:0:0:fc                     | Thread |
133|         00:02:01.129 | Subscribed   | ff03:0:0:0:0:0:0:1                      | Thread |
134|         00:02:01.129 | Subscribed   | ff02:0:0:0:0:0:0:1                      | Thread |
135Done
136```
137
138Print the multicast IPv6 address history as a list.
139
140```bash
141> history ipmaddr list
14200:00:25.447 -> event:Unsubscribed address:ff05:0:0:0:0:0:0:1 origin:Manual
14300:01:42.208 -> event:Subscribed address:ff05:0:0:0:0:0:0:1 origin:Manual
14400:02:11.808 -> event:Subscribed address:ff03:0:0:0:0:0:0:2 origin:Thread
14500:02:11.808 -> event:Subscribed address:ff02:0:0:0:0:0:0:2 origin:Thread
14600:02:16.184 -> event:Subscribed address:ff33:40:fdde:ad00:beef:0:0:1 origin:Thread
14700:02:16.184 -> event:Subscribed address:ff32:40:fdde:ad00:beef:0:0:1 origin:Thread
14800:02:17.984 -> event:Subscribed address:ff03:0:0:0:0:0:0:fc origin:Thread
14900:02:17.984 -> event:Subscribed address:ff03:0:0:0:0:0:0:1 origin:Thread
15000:02:17.984 -> event:Subscribed address:ff02:0:0:0:0:0:0:1 origin:Thread
151Done
152```
153
154### neighbor
155
156Usage `history neighbor [list] [<num-entries>]`
157
158Print the neighbor table history. Each entry provides:
159
160- Type: Child or Router
161- Event: Added, Removed, Changed (e.g., mode change).
162- Extended Address
163- RLOC16
164- MLE Link Mode
165- Average RSS (in dBm) of received frames from neighbor at the time the entry was recorded
166
167Print the neighbor history as a table.
168
169```bash
170> history neighbor
171| Age                  | Type   | Event     | Extended Address | RLOC16 | Mode | Ave RSS |
172+----------------------+--------+-----------+------------------+--------+------+---------+
173|         00:00:29.233 | Child  | Added     | ae5105292f0b9169 | 0x8404 | -    |     -20 |
174|         00:01:38.368 | Child  | Removed   | ae5105292f0b9169 | 0x8401 | -    |     -20 |
175|         00:04:27.181 | Child  | Changed   | ae5105292f0b9169 | 0x8401 | -    |     -20 |
176|         00:04:51.236 | Router | Added     | 865c7ca38a5fa960 | 0x9400 | rdn  |     -20 |
177|         00:04:51.587 | Child  | Removed   | 865c7ca38a5fa960 | 0x8402 | rdn  |     -20 |
178|         00:05:22.764 | Child  | Changed   | ae5105292f0b9169 | 0x8401 | rn   |     -20 |
179|         00:06:40.764 | Child  | Added     | 4ec99efc874a1841 | 0x8403 | r    |     -20 |
180|         00:06:44.060 | Child  | Added     | 865c7ca38a5fa960 | 0x8402 | rdn  |     -20 |
181|         00:06:49.515 | Child  | Added     | ae5105292f0b9169 | 0x8401 | -    |     -20 |
182Done
183```
184
185Print the neighbor history as a list.
186
187```bash
188
189> history neighbor list
19000:00:34.753 -> type:Child event:Added extaddr:ae5105292f0b9169 rloc16:0x8404 mode:- rss:-20
19100:01:43.888 -> type:Child event:Removed extaddr:ae5105292f0b9169 rloc16:0x8401 mode:- rss:-20
19200:04:32.701 -> type:Child event:Changed extaddr:ae5105292f0b9169 rloc16:0x8401 mode:- rss:-20
19300:04:56.756 -> type:Router event:Added extaddr:865c7ca38a5fa960 rloc16:0x9400 mode:rdn rss:-20
19400:04:57.107 -> type:Child event:Removed extaddr:865c7ca38a5fa960 rloc16:0x8402 mode:rdn rss:-20
19500:05:28.284 -> type:Child event:Changed extaddr:ae5105292f0b9169 rloc16:0x8401 mode:rn rss:-20
19600:06:46.284 -> type:Child event:Added extaddr:4ec99efc874a1841 rloc16:0x8403 mode:r rss:-20
19700:06:49.580 -> type:Child event:Added extaddr:865c7ca38a5fa960 rloc16:0x8402 mode:rdn rss:-20
19800:06:55.035 -> type:Child event:Added extaddr:ae5105292f0b9169 rloc16:0x8401 mode:- rss:-20
199Done
200```
201
202### netinfo
203
204Usage `history netinfo [list] [<num-entries>]`
205
206Print the Network Info history. Each Network Info provides:
207
208- Device Role
209- MLE Link Mode
210- RLOC16
211- Partition ID
212
213Print the Network Info history as a table.
214
215```bash
216> history netinfo
217| Age                  | Role     | Mode | RLOC16 | Partition ID |
218+----------------------+----------+------+--------+--------------+
219|         00:00:10.069 | router   | rdn  | 0x6000 |    151029327 |
220|         00:02:09.337 | child    | rdn  | 0x2001 |    151029327 |
221|         00:02:09.338 | child    | rdn  | 0x2001 |    151029327 |
222|         00:07:40.806 | child    | -    | 0x2001 |    151029327 |
223|         00:07:42.297 | detached | -    | 0x6000 |            0 |
224|         00:07:42.968 | disabled | -    | 0x6000 |            0 |
225Done
226```
227
228Print the Network Info history as a list.
229
230```bash
231> history netinfo list
23200:00:59.467 -> role:router mode:rdn rloc16:0x6000 partition-id:151029327
23300:02:58.735 -> role:child mode:rdn rloc16:0x2001 partition-id:151029327
23400:02:58.736 -> role:child mode:rdn rloc16:0x2001 partition-id:151029327
23500:08:30.204 -> role:child mode:- rloc16:0x2001 partition-id:151029327
23600:08:31.695 -> role:detached mode:- rloc16:0x6000 partition-id:0
23700:08:32.366 -> role:disabled mode:- rloc16:0x6000 partition-id:0
238Done
239```
240
241Print only the latest 2 entries.
242
243```bash
244> history netinfo 2
245| Age                  | Role     | Mode | RLOC16 | Partition ID |
246+----------------------+----------+------+--------+--------------+
247|         00:02:05.451 | router   | rdn  | 0x6000 |    151029327 |
248|         00:04:04.719 | child    | rdn  | 0x2001 |    151029327 |
249Done
250```
251
252### prefix
253
254Usage `history prefix [list] [<num-entries>]`
255
256Print the Network Data on mesh prefix history. Each item provides:
257
258- Event (`Added` or `Removed`)
259- Prefix
260- Flags
261- Preference (`high`, `med`, `low`)
262- RLOC16
263
264The flags are as follows:
265
266- `p`: Preferred flag
267- `a`: Stateless IPv6 Address Autoconfiguration flag
268- `d`: DHCPv6 IPv6 Address Configuration flag
269- `c`: DHCPv6 Other Configuration flag
270- `r`: Default Route flag
271- `o`: On Mesh flag
272- `s`: Stable flag
273- `n`: Nd Dns flag
274- `D`: Domain Prefix flag
275
276Print the history as a table.
277
278```bash
279> history prefix
280| Age                  | Event   | Prefix                                      | Flags     | Pref | RLOC16 |
281+----------------------+---------+---------------------------------------------+-----------+------+--------+
282|         00:00:10.663 | Added   | fd00:1111:2222:3333::/64                    | paro      | med  | 0x5400 |
283|         00:01:02.054 | Removed | fd00:dead:beef:1::/64                       | paros     | high | 0x5400 |
284|         00:01:21.136 | Added   | fd00:abba:cddd:0::/64                       | paos      | med  | 0x5400 |
285|         00:01:45.144 | Added   | fd00:dead:beef:1::/64                       | paros     | high | 0x3c00 |
286|         00:01:50.944 | Added   | fd00:dead:beef:1::/64                       | paros     | high | 0x5400 |
287|         00:01:59.887 | Added   | fd00:dead:beef:1::/64                       | paros     | med  | 0x8800 |
288Done
289```
290
291Print the history as a list.
292
293```bash
294> history prefix list
29500:04:12.487 -> event:Added prefix:fd00:1111:2222:3333::/64 flags:paro pref:med rloc16:0x5400
29600:05:03.878 -> event:Removed prefix:fd00:dead:beef:1::/64 flags:paros pref:high rloc16:0x5400
29700:05:22.960 -> event:Added prefix:fd00:abba:cddd:0::/64 flags:paos pref:med rloc16:0x5400
29800:05:46.968 -> event:Added prefix:fd00:dead:beef:1::/64 flags:paros pref:high rloc16:0x3c00
29900:05:52.768 -> event:Added prefix:fd00:dead:beef:1::/64 flags:paros pref:high rloc16:0x5400
30000:06:01.711 -> event:Added prefix:fd00:dead:beef:1::/64 flags:paros pref:med rloc16:0x8800
301```
302
303### route
304
305Usage `history route [list] [<num-entries>]`
306
307Print the Network Data external route history. Each item provides:
308
309- Event (`Added` or `Removed`)
310- Route
311- Flags
312- Preference (`high`, `med`, `low`)
313- RLOC16
314
315The flags are as follows:
316
317- `s`: Stable flag
318- `n`: NAT64 flag
319
320Print the history as a table.
321
322```bash
323history route
324| Age                  | Event   | Route                                       | Flags     | Pref | RLOC16 |
325+----------------------+---------+---------------------------------------------+-----------+------+--------+
326|         00:00:05.456 | Removed | fd00:1111:0::/48                            | s         | med  | 0x3c00 |
327|         00:00:29.310 | Added   | fd00:1111:0::/48                            | s         | med  | 0x3c00 |
328|         00:00:42.822 | Added   | fd00:1111:0::/48                            | s         | med  | 0x5400 |
329|         00:01:27.688 | Added   | fd00:aaaa:bbbb:cccc::/64                    | s         | med  | 0x8800 |
330Done
331```
332
333Print the history as a list (last two entries).
334
335```bash
336> history route list 2
33700:00:48.704 -> event:Removed route:fd00:1111:0::/48 flags:s pref:med rloc16:0x3c00
33800:01:12.558 -> event:Added route:fd00:1111:0::/48 flags:s pref:med rloc16:0x3c00
339Done
340```
341
342### router
343
344Usage `history router [list] [<num-entries>]`
345
346Print the route table history. Each item provides:
347
348- Event (`Added`, `Removed`, `NextHopChanged`, `CostChanged`)
349- Router ID and RLOC16 of router
350- Next Hop (Router ID and RLOC16) - `none` if no next hop.
351- Path cost (old `->` new) - `inf` to indicate infinite path cost.
352
353Print the history as a table.
354
355```bash
356> history router
357| Age                  | Event          | ID (RLOC16) | Next Hop    | Path Cost  |
358+----------------------+----------------+-------------+-------------+------------+
359|         00:00:05.258 | NextHopChanged |  7 (0x1c00) | 34 (0x8800) | inf ->   3 |
360|         00:00:08.604 | NextHopChanged | 34 (0x8800) | 34 (0x8800) | inf ->   2 |
361|         00:00:08.604 | Added          |  7 (0x1c00) |        none | inf -> inf |
362|         00:00:11.931 | Added          | 34 (0x8800) |        none | inf -> inf |
363|         00:00:14.948 | Removed        | 59 (0xec00) |        none | inf -> inf |
364|         00:00:14.948 | Removed        | 54 (0xd800) |        none | inf -> inf |
365|         00:00:14.948 | Removed        | 34 (0x8800) |        none | inf -> inf |
366|         00:00:14.948 | Removed        |  7 (0x1c00) |        none | inf -> inf |
367|         00:00:54.795 | NextHopChanged | 59 (0xec00) | 34 (0x8800) |   1 ->   5 |
368|         00:02:33.735 | NextHopChanged | 54 (0xd800) |        none |  15 -> inf |
369|         00:03:10.915 | CostChanged    | 54 (0xd800) | 34 (0x8800) |  13 ->  15 |
370|         00:03:45.716 | NextHopChanged | 54 (0xd800) | 34 (0x8800) |  15 ->  13 |
371|         00:03:46.188 | CostChanged    | 54 (0xd800) | 59 (0xec00) |  13 ->  15 |
372|         00:04:19.124 | CostChanged    | 54 (0xd800) | 59 (0xec00) |  11 ->  13 |
373|         00:04:52.008 | CostChanged    | 54 (0xd800) | 59 (0xec00) |   9 ->  11 |
374|         00:05:23.176 | CostChanged    | 54 (0xd800) | 59 (0xec00) |   7 ->   9 |
375|         00:05:51.081 | CostChanged    | 54 (0xd800) | 59 (0xec00) |   5 ->   7 |
376|         00:06:48.721 | CostChanged    | 54 (0xd800) | 59 (0xec00) |   3 ->   5 |
377|         00:07:13.792 | NextHopChanged | 54 (0xd800) | 59 (0xec00) |   1 ->   3 |
378|         00:09:28.681 | NextHopChanged |  7 (0x1c00) | 34 (0x8800) | inf ->   3 |
379|         00:09:31.882 | Added          |  7 (0x1c00) |        none | inf -> inf |
380|         00:09:51.240 | NextHopChanged | 54 (0xd800) | 54 (0xd800) | inf ->   1 |
381|         00:09:54.204 | Added          | 54 (0xd800) |        none | inf -> inf |
382|         00:10:20.645 | NextHopChanged | 34 (0x8800) | 34 (0x8800) | inf ->   2 |
383|         00:10:24.242 | NextHopChanged | 59 (0xec00) | 59 (0xec00) | inf ->   1 |
384|         00:10:24.242 | Added          | 34 (0x8800) |        none | inf -> inf |
385|         00:10:41.900 | NextHopChanged | 59 (0xec00) |        none |   1 -> inf |
386|         00:10:42.480 | Added          |  3 (0x0c00) |  3 (0x0c00) | inf -> inf |
387|         00:10:43.614 | Added          | 59 (0xec00) | 59 (0xec00) | inf ->   1 |
388Done
389```
390
391Print the history as a list (last 20 entries).
392
393```bash
394> history router list 20
39500:00:06.959 -> event:NextHopChanged router:7(0x1c00) nexthop:34(0x8800) old-cost:inf new-cost:3
39600:00:10.305 -> event:NextHopChanged router:34(0x8800) nexthop:34(0x8800) old-cost:inf new-cost:2
39700:00:10.305 -> event:Added router:7(0x1c00) nexthop:none old-cost:inf new-cost:inf
39800:00:13.632 -> event:Added router:34(0x8800) nexthop:none old-cost:inf new-cost:inf
39900:00:16.649 -> event:Removed router:59(0xec00) nexthop:none old-cost:inf new-cost:inf
40000:00:16.649 -> event:Removed router:54(0xd800) nexthop:none old-cost:inf new-cost:inf
40100:00:16.649 -> event:Removed router:34(0x8800) nexthop:none old-cost:inf new-cost:inf
40200:00:16.649 -> event:Removed router:7(0x1c00) nexthop:none old-cost:inf new-cost:inf
40300:00:56.496 -> event:NextHopChanged router:59(0xec00) nexthop:34(0x8800) old-cost:1 new-cost:5
40400:02:35.436 -> event:NextHopChanged router:54(0xd800) nexthop:none old-cost:15 new-cost:inf
40500:03:12.616 -> event:CostChanged router:54(0xd800) nexthop:34(0x8800) old-cost:13 new-cost:15
40600:03:47.417 -> event:NextHopChanged router:54(0xd800) nexthop:34(0x8800) old-cost:15 new-cost:13
40700:03:47.889 -> event:CostChanged router:54(0xd800) nexthop:59(0xec00) old-cost:13 new-cost:15
40800:04:20.825 -> event:CostChanged router:54(0xd800) nexthop:59(0xec00) old-cost:11 new-cost:13
40900:04:53.709 -> event:CostChanged router:54(0xd800) nexthop:59(0xec00) old-cost:9 new-cost:11
41000:05:24.877 -> event:CostChanged router:54(0xd800) nexthop:59(0xec00) old-cost:7 new-cost:9
41100:05:52.782 -> event:CostChanged router:54(0xd800) nexthop:59(0xec00) old-cost:5 new-cost:7
41200:06:50.422 -> event:CostChanged router:54(0xd800) nexthop:59(0xec00) old-cost:3 new-cost:5
41300:07:15.493 -> event:NextHopChanged router:54(0xd800) nexthop:59(0xec00) old-cost:1 new-cost:3
41400:09:30.382 -> event:NextHopChanged router:7(0x1c00) nexthop:34(0x8800) old-cost:inf new-cost:3
415Done
416```
417
418### rx
419
420Usage `history rx [list] [<num-entries>]`
421
422Print the IPv6 message RX history in either table or list format. Entries provide same information and follow same format as in `history rxtx` command.
423
424Print the IPv6 message RX history as a table:
425
426```bash
427> history rx
428| Age                  | Type             | Len   | Chksum | Sec | Prio | RSS  |Dir | Neighb | Radio |
429+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
430|                      | UDP              |    50 | 0xbd26 |  no |  net |  -20 | RX | 0x4800 |  15.4 |
431|         00:00:07.640 | src: [fe80:0:0:0:d03d:d3e7:cc5e:7cd7]:19788                                 |
432|                      | dst: [ff02:0:0:0:0:0:0:1]:19788                                             |
433+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
434|                      | HopOpts          |    44 | 0x0000 | yes | norm |  -20 | RX | 0x4800 |  15.4 |
435|         00:00:09.263 | src: [fdde:ad00:beef:0:0:ff:fe00:4800]:0                                    |
436|                      | dst: [ff03:0:0:0:0:0:0:2]:0                                                 |
437+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
438|                      | UDP              |    12 | 0x3f7d | yes |  net |  -20 | RX | 0x4800 |  15.4 |
439|         00:00:09.302 | src: [fdde:ad00:beef:0:0:ff:fe00:4800]:61631                                |
440|                      | dst: [fdde:ad00:beef:0:0:ff:fe00:4801]:61631                                |
441+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
442|                      | ICMP6(EchoReqst) |    16 | 0x942c | yes | norm |  -20 | RX | 0x4800 |  15.4 |
443|         00:00:09.304 | src: [fdde:ad00:beef:0:ac09:a16b:3204:dc09]:0                               |
444|                      | dst: [fdde:ad00:beef:0:dc0e:d6b3:f180:b75b]:0                               |
445+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
446|                      | HopOpts          |    44 | 0x0000 | yes | norm |  -20 | RX | 0x4800 |  15.4 |
447|         00:00:09.304 | src: [fdde:ad00:beef:0:0:ff:fe00:4800]:0                                    |
448|                      | dst: [ff03:0:0:0:0:0:0:2]:0                                                 |
449+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
450|                      | UDP              |    50 | 0x2e37 |  no |  net |  -20 | RX | 0x4800 |  15.4 |
451|         00:00:21.622 | src: [fe80:0:0:0:d03d:d3e7:cc5e:7cd7]:19788                                 |
452|                      | dst: [ff02:0:0:0:0:0:0:1]:19788                                             |
453+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
454|                      | UDP              |    50 | 0xe177 |  no |  net |  -20 | RX | 0x4800 |  15.4 |
455|         00:00:26.640 | src: [fe80:0:0:0:d03d:d3e7:cc5e:7cd7]:19788                                 |
456|                      | dst: [ff02:0:0:0:0:0:0:1]:19788                                             |
457+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
458|                      | UDP              |   165 | 0x82ee | yes |  net |  -20 | RX | 0x4800 |  15.4 |
459|         00:00:30.000 | src: [fe80:0:0:0:d03d:d3e7:cc5e:7cd7]:19788                                 |
460|                      | dst: [fe80:0:0:0:a4a5:bbac:a8e:bd07]:19788                                  |
461+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
462|                      | UDP              |    93 | 0x52df |  no |  net |  -20 | RX | unknwn |  15.4 |
463|         00:00:30.480 | src: [fe80:0:0:0:d03d:d3e7:cc5e:7cd7]:19788                                 |
464|                      | dst: [fe80:0:0:0:a4a5:bbac:a8e:bd07]:19788                                  |
465+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
466|                      | UDP              |    50 | 0x5ccf |  no |  net |  -20 | RX | unknwn |  15.4 |
467|         00:00:30.772 | src: [fe80:0:0:0:d03d:d3e7:cc5e:7cd7]:19788                                 |
468|                      | dst: [ff02:0:0:0:0:0:0:1]:19788                                             |
469Done
470
471```
472
473Print the latest 5 entries of the IPv6 message RX history as a list:
474
475```bash
476> history rx list 4
47700:00:13.368
478    type:UDP len:50 checksum:0xbd26 sec:no prio:net rss:-20 from:0x4800 radio:15.4
479    src:[fe80:0:0:0:d03d:d3e7:cc5e:7cd7]:19788
480    dst:[ff02:0:0:0:0:0:0:1]:19788
48100:00:14.991
482    type:HopOpts len:44 checksum:0x0000 sec:yes prio:norm rss:-20 from:0x4800 radio:15.4
483    src:[fdde:ad00:beef:0:0:ff:fe00:4800]:0
484    dst:[ff03:0:0:0:0:0:0:2]:0
48500:00:15.030
486    type:UDP len:12 checksum:0x3f7d sec:yes prio:net rss:-20 from:0x4800 radio:15.4
487    src:[fdde:ad00:beef:0:0:ff:fe00:4800]:61631
488    dst:[fdde:ad00:beef:0:0:ff:fe00:4801]:61631
48900:00:15.032
490    type:ICMP6(EchoReqst) len:16 checksum:0x942c sec:yes prio:norm rss:-20 from:0x4800 radio:15.4
491    src:[fdde:ad00:beef:0:ac09:a16b:3204:dc09]:0
492    dst:[fdde:ad00:beef:0:dc0e:d6b3:f180:b75b]:0
493Done
494```
495
496### rxtx
497
498Usage `history rxtx [list] [<num-entries>]`
499
500Print the combined IPv6 message RX and TX history in either table or list format. Each entry provides:
501
502- IPv6 message type: UDP, TCP, ICMP6 (and its subtype), etc.
503- IPv6 payload length (excludes the IPv6 header).
504- Source IPv6 address and port number.
505- Destination IPv6 address and port number (port number is valid for UDP/TCP, it is zero otherwise).
506- Whether or not link-layer security was used.
507- Message priority: low, norm, high, net (for Thread control messages).
508- Message checksum (valid for UDP, TCP, or ICMP6 message)
509- RSS: Received Signal Strength (in dBm) - averaged over all received fragment frames that formed the message. For TX history `NA` (not applicable) is used.
510- Whether the message was sent or received (`TX` or `RX`). A failed transmission (e.g., if tx was aborted or no ack from peer for any of the message fragments) is indicated with `TX-F` in the table format or `tx-success:no` in the list format.
511- Short address (RLOC16) of neighbor to/from which the message was sent/received. If the frame is broadcast, it is shown as `bcast` in table format or `0xffff` in the list format. If the short address of neighbor is not available, it is shown as `unknwn` in the table format or `0xfffe` in the list format.
512- Radio link on which the message was sent/received (useful when `OPENTHREAD_CONFIG_MULTI_RADIO` is enabled). Can be `15.4`, `trel`, or `all` (if sent on all radio links).
513
514Print the IPv6 message RX and TX history as a table:
515
516```bash
517> history rxtx
518| Age                  | Type             | Len   | Chksum | Sec | Prio | RSS  |Dir | Neighb | Radio |
519+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
520|                      | HopOpts          |    44 | 0x0000 | yes | norm |  -20 | RX | 0x0800 |  15.4 |
521|         00:00:09.267 | src: [fdde:ad00:beef:0:0:ff:fe00:800]:0                                     |
522|                      | dst: [ff03:0:0:0:0:0:0:2]:0                                                 |
523+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
524|                      | UDP              |    12 | 0x6c6b | yes |  net |  -20 | RX | 0x0800 |  15.4 |
525|         00:00:09.290 | src: [fdde:ad00:beef:0:0:ff:fe00:800]:61631                                 |
526|                      | dst: [fdde:ad00:beef:0:0:ff:fe00:801]:61631                                 |
527+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
528|                      | ICMP6(EchoReqst) |    16 | 0xc6a2 | yes | norm |  -20 | RX | 0x0800 |  15.4 |
529|         00:00:09.292 | src: [fdde:ad00:beef:0:efe8:4910:cf95:dee9]:0                               |
530|                      | dst: [fdde:ad00:beef:0:af4c:3644:882a:3698]:0                               |
531+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
532|                      | ICMP6(EchoReply) |    16 | 0xc5a2 | yes | norm |  NA  | TX | 0x0800 |  15.4 |
533|         00:00:09.292 | src: [fdde:ad00:beef:0:af4c:3644:882a:3698]:0                               |
534|                      | dst: [fdde:ad00:beef:0:efe8:4910:cf95:dee9]:0                               |
535+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
536|                      | UDP              |    50 | 0xaa0d | yes |  net |  NA  | TX | 0x0800 |  15.4 |
537|         00:00:09.294 | src: [fdde:ad00:beef:0:0:ff:fe00:801]:61631                                 |
538|                      | dst: [fdde:ad00:beef:0:0:ff:fe00:800]:61631                                 |
539+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
540|                      | HopOpts          |    44 | 0x0000 | yes | norm |  -20 | RX | 0x0800 |  15.4 |
541|         00:00:09.296 | src: [fdde:ad00:beef:0:0:ff:fe00:800]:0                                     |
542|                      | dst: [ff03:0:0:0:0:0:0:2]:0                                                 |
543+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
544|                      | UDP              |    50 | 0xc1d8 |  no |  net |  -20 | RX | 0x0800 |  15.4 |
545|         00:00:09.569 | src: [fe80:0:0:0:54d9:5153:ffc6:df26]:19788                                 |
546|                      | dst: [ff02:0:0:0:0:0:0:1]:19788                                             |
547+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
548|                      | UDP              |    50 | 0x3cb1 |  no |  net |  -20 | RX | 0x0800 |  15.4 |
549|         00:00:16.519 | src: [fe80:0:0:0:54d9:5153:ffc6:df26]:19788                                 |
550|                      | dst: [ff02:0:0:0:0:0:0:1]:19788                                             |
551+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
552|                      | UDP              |    50 | 0xeda0 |  no |  net |  -20 | RX | 0x0800 |  15.4 |
553|         00:00:20.599 | src: [fe80:0:0:0:54d9:5153:ffc6:df26]:19788                                 |
554|                      | dst: [ff02:0:0:0:0:0:0:1]:19788                                             |
555+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
556|                      | UDP              |   165 | 0xbdfa | yes |  net |  -20 | RX | 0x0800 |  15.4 |
557|         00:00:21.059 | src: [fe80:0:0:0:54d9:5153:ffc6:df26]:19788                                 |
558|                      | dst: [fe80:0:0:0:8893:c2cc:d983:1e1c]:19788                                 |
559+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
560|                      | UDP              |    64 | 0x1c11 |  no |  net |  NA  | TX | 0x0800 |  15.4 |
561|         00:00:21.062 | src: [fe80:0:0:0:8893:c2cc:d983:1e1c]:19788                                 |
562|                      | dst: [fe80:0:0:0:54d9:5153:ffc6:df26]:19788                                 |
563+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
564|                      | UDP              |    93 | 0xedff |  no |  net |  -20 | RX | unknwn |  15.4 |
565|         00:00:21.474 | src: [fe80:0:0:0:54d9:5153:ffc6:df26]:19788                                 |
566|                      | dst: [fe80:0:0:0:8893:c2cc:d983:1e1c]:19788                                 |
567+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
568|                      | UDP              |    44 | 0xd383 |  no |  net |  NA  | TX | bcast  |  15.4 |
569|         00:00:21.811 | src: [fe80:0:0:0:8893:c2cc:d983:1e1c]:19788                                 |
570|                      | dst: [ff02:0:0:0:0:0:0:2]:19788                                             |
571Done
572```
573
574Print the latest 5 entries of the IPv6 message RX history as a list:
575
576```bash
577> history rxtx list 5
578
57900:00:02.100
580    type:UDP len:50 checksum:0xd843 sec:no prio:net rss:-20 from:0x0800 radio:15.4
581    src:[fe80:0:0:0:54d9:5153:ffc6:df26]:19788
582    dst:[ff02:0:0:0:0:0:0:1]:19788
58300:00:15.331
584    type:HopOpts len:44 checksum:0x0000 sec:yes prio:norm rss:-20 from:0x0800 radio:15.4
585    src:[fdde:ad00:beef:0:0:ff:fe00:800]:0
586    dst:[ff03:0:0:0:0:0:0:2]:0
58700:00:15.354
588    type:UDP len:12 checksum:0x6c6b sec:yes prio:net rss:-20 from:0x0800 radio:15.4
589    src:[fdde:ad00:beef:0:0:ff:fe00:800]:61631
590    dst:[fdde:ad00:beef:0:0:ff:fe00:801]:61631
59100:00:15.356
592    type:ICMP6(EchoReqst) len:16 checksum:0xc6a2 sec:yes prio:norm rss:-20 from:0x0800 radio:15.4
593    src:[fdde:ad00:beef:0:efe8:4910:cf95:dee9]:0
594    dst:[fdde:ad00:beef:0:af4c:3644:882a:3698]:0
59500:00:15.356
596    type:ICMP6(EchoReply) len:16 checksum:0xc5a2 sec:yes prio:norm tx-success:yes to:0x0800 radio:15.4
597    src:[fdde:ad00:beef:0:af4c:3644:882a:3698]:0
598    dst:[fdde:ad00:beef:0:efe8:4910:cf95:dee9]:0
599```
600
601### tx
602
603Usage `history tx [list] [<num-entries>]`
604
605Print the IPv6 message TX history in either table or list format. Entries provide same information and follow same format as in `history rxtx` command.
606
607Print the IPv6 message TX history as a table (10 latest entries):
608
609```bash
610> history tx
611| Age                  | Type             | Len   | Chksum | Sec | Prio | RSS  |Dir | Neighb | Radio |
612+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
613|                      | ICMP6(EchoReply) |    16 | 0x932c | yes | norm |  NA  | TX | 0x4800 |  15.4 |
614|         00:00:18.798 | src: [fdde:ad00:beef:0:dc0e:d6b3:f180:b75b]:0                               |
615|                      | dst: [fdde:ad00:beef:0:ac09:a16b:3204:dc09]:0                               |
616+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
617|                      | UDP              |    50 | 0xce87 | yes |  net |  NA  | TX | 0x4800 |  15.4 |
618|         00:00:18.800 | src: [fdde:ad00:beef:0:0:ff:fe00:4801]:61631                                |
619|                      | dst: [fdde:ad00:beef:0:0:ff:fe00:4800]:61631                                |
620+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
621|                      | UDP              |    64 | 0xf7ba |  no |  net |  NA  | TX | 0x4800 |  15.4 |
622|         00:00:39.499 | src: [fe80:0:0:0:a4a5:bbac:a8e:bd07]:19788                                  |
623|                      | dst: [fe80:0:0:0:d03d:d3e7:cc5e:7cd7]:19788                                 |
624+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
625|                      | UDP              |    44 | 0x26d4 |  no |  net |  NA  | TX | bcast  |  15.4 |
626|         00:00:40.256 | src: [fe80:0:0:0:a4a5:bbac:a8e:bd07]:19788                                  |
627|                      | dst: [ff02:0:0:0:0:0:0:2]:19788                                             |
628Done
629```
630
631Print the IPv6 message TX history as a list:
632
633```bash
634history tx list
63500:00:23.957
636    type:ICMP6(EchoReply) len:16 checksum:0x932c sec:yes prio:norm tx-success:yes to:0x4800 radio:15.4
637    src:[fdde:ad00:beef:0:dc0e:d6b3:f180:b75b]:0
638    dst:[fdde:ad00:beef:0:ac09:a16b:3204:dc09]:0
63900:00:23.959
640    type:UDP len:50 checksum:0xce87 sec:yes prio:net tx-success:yes to:0x4800 radio:15.4
641    src:[fdde:ad00:beef:0:0:ff:fe00:4801]:61631
642    dst:[fdde:ad00:beef:0:0:ff:fe00:4800]:61631
64300:00:44.658
644    type:UDP len:64 checksum:0xf7ba sec:no prio:net tx-success:yes to:0x4800 radio:15.4
645    src:[fe80:0:0:0:a4a5:bbac:a8e:bd07]:19788
646    dst:[fe80:0:0:0:d03d:d3e7:cc5e:7cd7]:19788
64700:00:45.415
648    type:UDP len:44 checksum:0x26d4 sec:no prio:net tx-success:yes to:0xffff radio:15.4
649    src:[fe80:0:0:0:a4a5:bbac:a8e:bd07]:19788
650    dst:[ff02:0:0:0:0:0:0:2]:19788
651Done
652```
653

README_JOINER.md

1# OpenThread CLI - Joiner
2
3## Quick Start
4
5See [README_COMMISSIONING.md](README_COMMISSIONING.md).
6
7## Command List
8
9- [help](#help)
10- [discerner](#discerner)
11- [id](#id)
12- [start](#start)
13- [state](#state)
14- [stop](#stop)
15
16## Command Details
17
18### help
19
20Usage: `joiner help`
21
22Print joiner help menu.
23
24```bash
25> joiner help
26help
27id
28start
29state
30stop
31Done
32```
33
34### discerner
35
36Usage: `joiner discerner [discerner]`
37
38Print or set the Joiner Discerner. Note this value takes the place of the place of EUI-64 during the joiner session of Thread commissioning.
39
40- discerner: `clear` to clear discerner, `number/length` to set discerner
41
42```bash
43> joiner discerner 0xabc/12
44Done
45> joiner discerner
460xabc/12
47Done
48> joiner discerner clear
49Done
50```
51
52### id
53
54Usage: `joiner id`
55
56Print the Joiner ID.
57
58```bash
59> joiner id
60d65e64fa83f81cf7
61Done
62```
63
64### start
65
66Usage: `joiner start <pskd> [provisioning-url]`
67
68Start the Joiner role.
69
70- pskd: Pre-Shared Key for the Joiner.
71- provisioning-url: Provisioning URL for the Joiner (optional).
72
73This command will cause the device to start the Joiner process.
74
75```bash
76> joiner start J01NM3
77Done
78```
79
80### state
81
82Usage: `joiner state`
83
84Print the Joiner state.
85
86- Idle
87- Discover
88- Connecting
89- Connected
90- Entrust
91- Joined
92
93```bash
94> joiner state
95Idle
96Done
97```
98
99### stop
100
101Usage: `joiner stop`
102
103Stop the Joiner role.
104
105```bash
106> joiner stop
107Done
108```
109

README_NETDATA.md

1# OpenThread CLI - Network Data
2
3## Overview
4
5Thread Network Data contains information about Border Routers and other servers available in the Thread network. Border Routers and devices offering services register their information with the Leader. The Leader collects and structures this information within the Thread Network Data and distributes the information to all devices in the Thread Network.
6
7Border Routers may register prefixes assigned to the Thread Network and prefixes that they offer routes for. Services may register any information relevant to the service itself.
8
9Border Router and service information may be stable or temporary. Stable Thread Network Data is distributed to all devices, including Sleepy End Devices (SEDs). Temporary Network Data is distributed to all nodes except SEDs.
10
11## Quick Start
12
13### Form Network and Configure Prefix
14
151. Generate and view new network configuration.
16
17   ```bash
18   > dataset init new
19   Done
20   > dataset
21   Active Timestamp: 1
22   Channel: 13
23   Channel Mask: 0x07fff800
24   Ext PAN ID: d63e8e3e495ebbc3
25   Mesh Local Prefix: fd3d:b50b:f96d:722d::/64
26   Network Key: dfd34f0f05cad978ec4e32b0413038ff
27   Network Name: OpenThread-8f28
28   PAN ID: 0x8f28
29   PSKc: c23a76e98f1a6483639b1ac1271e2e27
30   Security Policy: 0, onrc
31   Done
32   ```
33
342. Commit new dataset to the Active Operational Dataset in non-volatile storage.
35
36   ```bash
37   dataset commit active
38   Done
39   ```
40
413. Enable Thread interface
42
43   ```bash
44   > ifconfig up
45   Done
46   > thread start
47   Done
48   ```
49
504. Observe IPv6 addresses assigned to the Thread interface.
51
52   ```bash
53   > ipaddr
54   fd3d:b50b:f96d:722d:0:ff:fe00:fc00
55   fd3d:b50b:f96d:722d:0:ff:fe00:dc00
56   fd3d:b50b:f96d:722d:393c:462d:e8d2:db32
57   fe80:0:0:0:a40b:197f:593d:ca61
58   Done
59   ```
60
615. Register an IPv6 prefix assigned to the Thread network.
62
63   ```bash
64   > prefix add fd00:dead:beef:cafe::/64 paros
65   Done
66   > netdata register
67   Done
68   ```
69
706. Observe Thread Network Data.
71
72   ```bash
73   > netdata show
74   Prefixes:
75   fd00:dead:beef:cafe::/64 paros med dc00
76   Routes:
77   Services:
78   Done
79   ```
80
817. Observe IPv6 addresses assigned to the Thread interface.
82
83   ```bash
84   > ipaddr
85   fd00:dead:beef:cafe:4da8:5234:4aa2:4cfa
86   fd3d:b50b:f96d:722d:0:ff:fe00:fc00
87   fd3d:b50b:f96d:722d:0:ff:fe00:dc00
88   fd3d:b50b:f96d:722d:393c:462d:e8d2:db32
89   fe80:0:0:0:a40b:197f:593d:ca61
90   Done
91   ```
92
93### Attach to Existing Network
94
95Only the Network Key is required for a device to attach to a Thread network.
96
97While not required, specifying the channel avoids the need to search across multiple channels, improving both latency and efficiency of the attach process.
98
99After the device successfully attaches to a Thread network, the device will retrieve the complete Active Operational Dataset.
100
1011. Create a partial Active Operational Dataset.
102
103   ```bash
104   > dataset networkkey dfd34f0f05cad978ec4e32b0413038ff
105   Done
106   > dataset commit active
107   Done
108   ```
109
1102. Enable Thread interface.
111
112   ```bash
113   > ifconfig up
114   Done
115   > thread start
116   Done
117   ```
118
1193. After attaching, observe Thread Network Data.
120
121   ```bash
122   > netdata show
123   Prefixes:
124   fd00:dead:beef:cafe::/64 paros med dc00
125   Routes:
126   Services:
127   Done
128   ```
129
1304. Observe IPv6 addresses assigned to the Thread interface.
131
132   ```bash
133   > ipaddr
134   fd00:dead:beef:cafe:4da8:5234:4aa2:4cfa
135   fd3d:b50b:f96d:722d:0:ff:fe00:fc00
136   fd3d:b50b:f96d:722d:0:ff:fe00:dc00
137   fd3d:b50b:f96d:722d:393c:462d:e8d2:db32
138   fe80:0:0:0:a40b:197f:593d:ca61
139   Done
140   ```
141
142## Command List
143
144- [help](#help)
145- [full](#full)
146- [length](#length)
147- [maxlength](#maxlength)
148- [publish](#publish)
149- [register](#register)
150- [show](#show)
151- [steeringdata](#steeringdata-check-eui64discerner)
152- [unpublish](#unpublish)
153
154## Command Details
155
156### help
157
158Usage: `netdata help`
159
160Print netdata help menu.
161
162```bash
163> netdata help
164full
165length
166maxlength
167publish
168register
169show
170steeringdata
171unpublish
172Done
173```
174
175### full
176
177Usage: `netdata full`
178
179Print "yes" or "no" flag tracking whether or not the "net data full" callback has been invoked since start of Thread operation or since the last time `netdata full reset` was used to reset the flag.
180
181This command requires `OPENTHREAD_CONFIG_BORDER_ROUTER_SIGNAL_NETWORK_DATA_FULL`.
182
183The "net data full" callback is invoked whenever:
184
185- The device is acting as a leader and receives a Network Data registration from a Border Router (BR) that it cannot add to Network Data (running out of space).
186- The device is acting as a BR and new entries cannot be added to its local Network Data.
187- The device is acting as a BR and tries to register its local Network Data entries with the leader, but determines that its local entries will not fit.
188
189```
190> netdata full
191no
192Done
193```
194
195### full reset
196
197Usage: `netdata full reset`
198
199Reset the flag tracking whether "net data full" callback was invoked.
200
201This command requires `OPENTHREAD_CONFIG_BORDER_ROUTER_SIGNAL_NETWORK_DATA_FULL`.
202
203```
204> netdata full reset
205Done
206```
207
208### length
209
210Usage: `netdata length`
211
212Get the current length of (number of bytes) Partition's Thread Network Data.
213
214```bash
215> netdata length
21623
217Done
218```
219
220### maxlength
221
222Usage: `netdata maxlength`
223
224Get the maximum observed length of the Thread Network Data since OT stack initialization or since the last call to `netdata maxlength reset`.
225
226```bash
227> netdata maxlength
22840
229Done
230```
231
232### maxlength reset
233
234Usage: `netdata maxlength reset`
235
236Reset the tracked maximum length of the Thread Network Data.
237
238```bash
239> netdata maxlength reset
240Done
241```
242
243### publish
244
245The Network Data Publisher provides mechanisms to limit the number of similar Service and/or Prefix (on-mesh prefix or external route) entries in the Thread Network Data by monitoring the Network Data and managing if or when to add or remove entries.
246
247The Publisher requires `OPENTHREAD_CONFIG_NETDATA_PUBLISHER_ENABLE`.
248
249### publish dnssrp
250
251Publish DNS/SRP service entry.
252
253This command requires `OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE`.
254
255The following formats are available: :
256
257- `netdata publish dnssrp anycast <seq-num> [<version>]` to publish "DNS/SRP Service Anycast Address" with a given sequence number and version.
258- `netdata publish dnssrp unicast <address> <port> [<version>]` to publish "DNS/SRP Service Unicast Address" with given address, port number and version info. The address/port/version info is included in Service TLV data.
259- `netdata publish dnssrp unicast <port> [<version>]` to publish "DNS/SRP Service Unicast Address" with given port number, version, and the device's mesh-local EID for the address. The address/port/version info is included in Server TLV data.
260
261A new call to `netdata publish dnssrp [anycast|unicast] [...]` command will remove and replace any previous "DNS/SRP Service" entry that was being published (from earlier `netdata publish dnssrp [...]` commands).
262
263```bash
264> netdata publish dnssrp anycast 1 2
265Done
266
267> netdata publish dnssrp unicast fd00::1234 51525 1
268Done
269
270> netdata publish dnssrp unicast 50152 2
271Done
272```
273
274### publish prefix \<prefix\> [padcrosnD][prf]
275
276Publish an on-mesh prefix entry.
277
278- p: Preferred flag
279- a: Stateless IPv6 Address Autoconfiguration flag
280- d: DHCPv6 IPv6 Address Configuration flag
281- c: DHCPv6 Other Configuration flag
282- r: Default Route flag
283- o: On Mesh flag
284- s: Stable flag
285- n: Nd Dns flag
286- D: Domain Prefix flag (only available for Thread 1.2).
287- prf: Preference, which may be 'high', 'med', or 'low'.
288
289```bash
290> netdata publish prefix fd00:1234:5678::/64 paos med
291Done
292```
293
294### publish route \<prefix\> [sn][prf]
295
296Publish an external route entry.
297
298- s: Stable flag
299- n: NAT64 flag
300- a: Advertising PIO (AP) flag
301- prf: Preference, which may be: 'high', 'med', or 'low'.
302
303```bash
304> netdata publish route fd00:1234:5678::/64 s high
305Done
306```
307
308### publish replace \<old prefix\> \<prefix\> [sn][prf]
309
310Replace a previously published external route entry.
311
312If there is no previously published external route matching old prefix, this command behaves similarly to `netdata publish route`. If there is a previously published route entry, it will be replaced with the new prefix. In particular, if the old prefix was already added in the Network Data, the change to the new prefix is immediately reflected in the Network Data (i.e., old prefix is removed and the new prefix is added in the same Network Data registration request to leader). This ensures that route entries in the Network Data are not abruptly removed.
313
314- s: Stable flag
315- n: NAT64 flag
316- a: Advertising PIO (AP) flag
317- prf: Preference, which may be: 'high', 'med', or 'low'.
318
319```bash
320> netdata publish replace ::/0 fd00:1234:5678::/64 s high
321Done
322```
323
324### register
325
326Usage: `netdata register`
327
328Register configured prefixes, routes, and services with the Leader.
329
330```bash
331> netdata register
332Done
333```
334
335### show
336
337Usage: `netdata show [local] [-x] [\<rloc16\>]`
338
339Print entries in Network Data, on-mesh prefixes, external routes, services, and 6LoWPAN context information.
340
341If the optional `rloc16` input is specified, prints the entries associated with the given RLOC16 only. The RLOC16 filtering can be used when `-x` or `local` are not used.
342
343On-mesh prefixes are listed under `Prefixes` header:
344
345- The on-mesh prefix
346- Flags
347  - p: Preferred flag
348  - a: Stateless IPv6 Address Autoconfiguration flag
349  - d: DHCPv6 IPv6 Address Configuration flag
350  - c: DHCPv6 Other Configuration flag
351  - r: Default Route flag
352  - o: On Mesh flag
353  - s: Stable flag
354  - n: Nd Dns flag
355  - D: Domain Prefix flag (only available for Thread 1.2).
356- Preference `high`, `med`, or `low`
357- RLOC16 of device which added the on-mesh prefix
358
359External Routes are listed under `Routes` header:
360
361- The route prefix
362- Flags
363  - s: Stable flag
364  - n: NAT64 flag
365  - a: Advertising PIO (AP) flag
366- Preference `high`, `med`, or `low`
367- RLOC16 of device which added the route prefix
368
369Service entries are listed under `Services` header:
370
371- Enterprise number
372- Service data (as hex bytes)
373- Server data (as hex bytes)
374- Flags
375  - s: Stable flag
376- RLOC16 of devices which added the service entry
377- Service ID
378
3796LoWPAN Context IDs are listed under `Contexts` header:
380
381- The prefix
382- Context ID
383- Compress flag (`c` if marked or `-` otherwise).
384
385Commissioning Dataset information is printed under `Commissioning` header:
386
387- Session ID if present in Dataset or `-` otherwise
388- Border Agent RLOC16 (in hex) if present in Dataset or `-` otherwise
389- Joiner UDP port number if present in Dataset or `-` otherwise
390- Steering Data (as hex bytes) if present in Dataset or `-` otherwise
391- Flags:
392  - e: if Dataset contains any extra unknown TLV
393
394Print Network Data received from the Leader.
395
396```bash
397> netdata show
398Prefixes:
399fd00:dead:beef:cafe::/64 paros med a000
400Routes:
401fd00:1234:0:0::/64 s med a000
402fd00:4567:0:0::/64 s med 8000
403Services:
40444970 5d fddead00beef00007bad0069ce45948504d2 s a000 0
405Contexts:
406fd00:dead:beef:cafe::/64 1 c
407Commissioning:
4081248 dc00 9988 00000000000120000000000000000000 e
409Done
410```
411
412Print Network Data entries from the Leader associated with `0xa00` RLOC16.
413
414```bash
415> netdata show 0xa00
416Prefixes:
417fd00:dead:beef:cafe::/64 paros med a000
418Routes:
419fd00:1234:0:0::/64 s med a000
420Services:
42144970 5d fddead00beef00007bad0069ce45948504d2 s a000 0
422Done
423```
424
425Print Network Data received from the Leader as hex-encoded TLVs.
426
427```bash
428> netdata show -x
42908040b02174703140040fd00deadbeefcafe0504dc00330007021140
430Done
431```
432
433Print local Network Data to sync with Leader.
434
435```bash
436> netdata show local
437Prefixes:
438fd00:dead:beef:cafe::/64 paros med dc00
439Routes:
440Services:
441Done
442```
443
444Print local Network Data to sync with Leader as hex-encoded TLVs.
445
446```bash
447> netdata show local -x
44808040b02174703140040fd00deadbeefcafe0504dc00330007021140
449Done
450```
451
452### netdata steeringdata check \<eui64\>|\<discerner\>
453
454Check whether the steering data includes a joiner.
455
456- eui64: The IEEE EUI-64 of the Joiner.
457- discerner: The Joiner discerner in format `number/length`.
458
459```bash
460> netdata steeringdata check d45e64fa83f81cf7
461Done
462> netdata steeringdata check 0xabc/12
463Done
464> netdata steeringdata check 0xdef/12
465Error 23: NotFound
466```
467
468### unpublish
469
470This command unpublishes a previously published Network Data entry.
471
472This command requires `OPENTHREAD_CONFIG_NETDATA_PUBLISHER_ENABLE`.
473
474### unpublish dnssrp
475
476Unpublishes DNS/SRP Service entry (available when `OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE` is enabled):
477
478- `netdata unpublish dnssrp` to unpublish "DNS/SRP Service" entry (anycast or unciast).
479
480```bash
481> netdata unpublish dnssrp
482Done
483```
484
485### unpublish \<prefix\>
486
487Unpublishes a previously published on-mesh prefix or external route entry.
488
489```bash
490> netdata unpublish fd00:1234:5678::/64
491Done
492```
493

README_SRP.md

1# OpenThread CLI - SRP (Service Registration Protocol)
2
3## Quick Start
4
5### Start SRP Server
6
7Start the SRP Server node:
8
9```bash
10./output/simulation/bin/ot-cli-ftd 1
11```
12
13Setup a Thread network and start the SRP Server:
14
15```bash
16> dataset init new
17Done
18> dataset
19Active Timestamp: 1
20Channel: 22
21Channel Mask: 0x07fff800
22Ext PAN ID: 8d6ed7a05a28fb3b
23Mesh Local Prefix: fded:5114:8263:1fe1::/64
24Network Key: 7fcbae4153cc2955c28440c15d4d4219
25Network Name: OpenThread-f7af
26PAN ID: 0xf7af
27PSKc: b658e40f174e3a11be149b302ef07a0f
28Security Policy: 672, onrc
29Done
30> dataset commit active
31Done
32> ifconfig up
33Done
34> thread start
35Done
36> state
37leader
38Done
39>ipaddr
40fded:5114:8263:1fe1:0:ff:fe00:fc00
41fded:5114:8263:1fe1:0:ff:fe00:c000
42fded:5114:8263:1fe1:68bc:ec03:c1ad:9325
43fe80:0:0:0:a8cd:6e23:df3d:4193
44Done
45> srp server enable
46Done
47```
48
49### Start SRP Client
50
51Start the SRP Client node:
52
53```bash
54./output/simulation/bin/ot-cli-ftd 2
55```
56
57Join the Thread Network and register a `_ipps._tcp` service:
58
59```bash
60> dataset networkkey 7fcbae4153cc2955c28440c15d4d4219
61Done
62> dataset commit active
63Done
64> ifconfig up
65Done
66> thread start
67Done
68> state
69child
70Done
71> ipaddr
72fded:5114:8263:1fe1:0:ff:fe00:c001
73fded:5114:8263:1fe1:44f9:cc06:4a2d:534
74fe80:0:0:0:38dd:fdf7:5fd:24e
75Done
76> srp client host name my-host
77Done
78> srp client host address fded:5114:8263:1fe1:44f9:cc06:4a2d:534
79Done
80> srp client service add my-service _ipps._tcp 12345
81Done
82> srp client autostart enable
83Done
84```
85
86The last command enables the auto-start mode on the client which then monitors the network data to discover available SRP servers within the Thread network and automatically starts the client.
87
88Alternatively, the client can be started manually using the `srp client start`.
89
90The SRP Server listening UDP port (which is `c002`(`49154`) in the example below) can be found from the Server Data (listed by the `netdata show` command).
91
92Make sure the SRP Server address & port are used for the `srp client start` command.
93
94```bash
95> netdata show
96Prefixes:
97Routes:
98Services:
9944970 5d c002 s 8400
100Done
101> srp client start fded:5114:8263:1fe1:68bc:ec03:c1ad:9325 49154
102Done
103```
104
105### Verify the service status
106
107Check if the host and service has been successfully registered on the client node:
108
109```bash
110> srp client host
111name:"my-host", state:Registered, addrs:[fded:5114:8263:1fe1:44f9:cc06:4a2d:534]
112Done
113> srp client service
114instance:"my-service", name:"_ipps._tcp", state:Registered, port:12345, priority:0, weight:0
115Done
116```
117
118Make sure it shows `state:Registered` for both host and service commands.
119
120Check the host & service on the server node:
121
122```bash
123> srp server host
124my-host.default.service.arpa.
125    deleted: false
126    addresses: [fded:5114:8263:1fe1:44f9:cc06:4a2d:534]
127Done
128> srp server service
129my-service._ipps._tcp.default.service.arpa.
130    deleted: false
131    port: 12345
132    priority: 0
133    weight: 0
134    ttl: 7200
135    lease: 7200
136    key-lease: 1209600
137    TXT: []
138    host: my-host.default.service.arpa.
139    addresses: [fded:5114:8263:1fe1:44f9:cc06:4a2d:534]
140Done
141```
142
143Make sure it shows `deleted: false` for both host and service commands.
144
145### Remove the service
146
147A service can be removed through the client node:
148
149```bash
150> srp client service remove my-service _ipps._tcp
151Done
152```
153
154Confirm on the server node that the service has been removed:
155
156```bash
157> srp server service
158my-service._ipps._tcp.default.service.arpa.
159    deleted: true
160Done
161```
162
163The service entry is listed because the name of service is not removed.
164
165### Remove the host and service names
166
167A host and service, along with their names, can be removed through the client node:
168
169```bash
170> srp client host remove 1
171Done
172```
173
174Confirm on the server node that no host or service entries are listed:
175
176```bash
177> srp server host
178Done
179> srp server service
180Done
181>
182```
183
184## CLI Reference
185
186- [SRP Client CLI Reference](README_SRP_CLIENT.md)
187- [SRP Server CLI Reference](README_SRP_SERVER.md)
188

README_SRP_CLIENT.md

1# OpenThread CLI - SRP Client
2
3## Command List
4
5Usage : `srp client [command] ...`
6
7- [help](#help)
8- [autostart](#autostart)
9- [callback](#callback)
10- [host](#host)
11- [keyleaseinterval](#keyleaseinterval)
12- [leaseinterval](#leaseinterval)
13- [server](#server)
14- [service](#service)
15- [start](#start)
16- [state](#state)
17- [stop](#stop)
18- [ttl](#ttl)
19
20## Command Details
21
22### help
23
24Usage: `srp client help`
25
26Print SRP client help menu.
27
28```bash
29> srp client help
30autostart
31callback
32help
33host
34keyleaseinterval
35leaseinterval
36service
37start
38state
39stop
40ttl
41Done
42```
43
44### autostart
45
46Usage `srp client autostart [enable|disable]`
47
48Enable/Disable auto start mode in SRP client. This command requires `OPENTHREAD_CONFIG_SRP_CLIENT_AUTO_START_API_ENABLE` feature to be enabled.
49
50Get the current autostart mode.
51
52```bash
53> srp client autostart
54Disabled
55Done
56```
57
58Set the autostart mode.
59
60```bash
61> srp client autostart enable
62Done
63
64> srp client autostart
65Enabled
66Done
67```
68
69### callback
70
71Usage `srp client callback [enable|disable]`
72
73Enable/Disable printing callback events from SRP client.
74
75Get current callback mode
76
77```bash
78> srp client callback
79Disabled
80Done
81```
82
83Set callback mode
84
85```bash
86> srp client callback enable
87Done
88
89> srp client callback
90Enabled
91Done
92```
93
94#### Example
95
96When two services are successfully registered:
97
98```bash
99SRP client callback - error:OK
100Host info:
101    name:"dev4312", state:Registered, addrs:[fd00:0:0:0:0:0:0:1]
102Service list:
103    instance:"ins2", name:"_test2._udp", state:Registered, port:111, priority:1, weight:1
104    instance:"ins1", name:"_test1._udp,_sub1,_sub2", state:Registered, port:777, priority:0, weight:0
105```
106
107When service `ins2` is removed:
108
109```bash
110SRP client callback - error:OK
111Host info:
112    name:"dev4312", state:Registered, addrs:[fd00:0:0:0:0:0:0:1]
113Service list:
114    instance:"ins1", name:"_test1._udp", state:Registered, port:777, priority:0, weight:0
115Removed service list:
116    instance:"ins2", name:"_test2._udp,_sub1,_sub2", state:Removed, port:111, priority:1, weight:1
117```
118
119When host info (and all services) is removed:
120
121```bash
122SRP client callback - error:OK
123Host info:
124    name:"dev4312", state:Removed, addrs:[fd00:0:0:0:0:0:0:1]
125Service list:
126Removed service list:
127    instance:"ins1", name:"_test1._udp", state:Removed, port:777, priority:0, weight:0
128```
129
130### host
131
132Usage: `srp client host`
133
134Print the full host info (host name, state, list of host addresses).
135
136```bash
137> srp client host
138name:"dev4312", state:Registered, addrs:[fd00:0:0:0:0:0:0:1234, fd00:0:0:0:0:0:0:beef]
139Done
140```
141
142When auto host address mode is enabled.
143
144```bash
145srp client host
146name:"dev1234", state:Registered, addrs:auto
147Done
148```
149
150### host name
151
152Usage: `srp client host name [name]`
153
154Get the host name.
155
156```bash
157> srp client host name
158dev4312
159Done
160```
161
162Set host name (can be set when the host is removed or not yet registered with server).
163
164```bash
165srp client host name dev4312
166Done
167```
168
169### host address
170
171Usage : `srp client host address [auto | <address> ...]`
172
173Indicate auto address mode is enabled.
174
175```bash
176> srp client host address
177auto
178Done
179```
180
181Get the list of host addresses (when auto host address is not enabled).
182
183```bash
184> srp client host address
185fd00:0:0:0:0:0:0:1234
186fd00:0:0:0:0:0:0:beef
187Done
188```
189
190Enable auto host address mode. When enabled client will automatically use all preferred Thread netif unicast addresses excluding all link-local and mesh-local addresses. If there is no preferred address, then Mesh Local EID address is added. SRP client will automatically re-register if/when addresses on Thread netif get changed (e.g., new address is added or existing address is removed or marked as non-preferred).
191
192```bash
193> srp client host address auto
194Done
195```
196
197Explicitly set the list of host addresses (can be set while client is running to update the host addresses), also disabled auto host address mode.
198
199```bash
200> srp client host address fd00::cafe
201Done
202```
203
204### host state
205
206Usage: `srp client host state`
207
208Get the host state.
209
210```bash
211> srp client host state
212Registered
213Done
214```
215
216The possible states are (same value for service state):
217
218- `ToAdd`: item to be added/registered.
219- `Adding`: item is being added/registered.
220- `ToRefresh`: item to be refreshed (renew lease).
221- `Refreshing`: item is being refreshed.
222- `ToRemove`: item to be removed.
223- `Removing`: item is being removed.
224- `Registered`: item is registered with server.
225- `Removed`: item is removed.
226
227### host remove
228
229Usage: `srp client host remove [removekeylease] [sendunregtoserver]`
230
231Remove host info and all services from server.
232
233- `removekeylease` is an optional boolean value indicating whether or not the host key lease should also be removed (default is false).
234- `sendunregtoserver` is a another optional boolean value indicating whether or not to send an update message to the server when host info is not yet registered (default is false).
235
236```bash
237> srp client host remove 1
238Done
239```
240
241### host clear
242
243Usage: `srp client host clear`
244
245Clear host info and all services on client (unlike `host remove`, with `host clear` no update is sent to server).
246
247```bash
248> srp client host clear
249Done
250```
251
252### keyleaseinterval
253
254Usage: `srp client keyleaseinterval [interval]`
255
256Get the key lease interval (in seconds).
257
258```bash
259> srp client keyleaseinterval
2601209600
261Done
262>
263```
264
265Set the key lease interval.
266
267```bash
268> srp client keyleaseinterval 864000
269Done
270```
271
272### leaseinterval
273
274Usage: `srp client leaseinterval [interval]`
275
276Get the lease interval (in seconds).
277
278```bash
279> srp client leaseinterval
2807200
281Done
282>
283```
284
285Set the lease interval.
286
287```bash
288> srp client leaseinterval 3600
289Done
290```
291
292### server
293
294Usage: `srp client server`
295
296Print the server socket address (IPv6 address and port number).
297
298```bash
299> srp client server
300[fd00:0:0:0:d88a:618b:384d:e760]:4724
301Done
302```
303
304### server address
305
306Print the server IPv6 address.
307
308```bash
309> srp client server address
310fd00:0:0:0:d88a:618b:384d:e760
311Done
312```
313
314### server port
315
316Print the server port number
317
318```bash
319> srp client server port
3204724
321Done
322```
323
324### service
325
326Usage: `srp client service`
327
328Print the list of services.
329
330```bash
331> srp client service
332instance:"ins2", name:"_test2._udp,_sub1,_sub2", state:Registered, port:111, priority:1, weight:1
333instance:"ins1", name:"_test1._udp", state:Registered, port:777, priority:0, weight:0
334Done
335```
336
337### service add
338
339Usage: `srp client service add <instancename> <servicename> <port> [priority] [weight] [txt]`
340
341Add a service with a given instance name, service name, port number, priority, weight and txt values.
342
343The `<servicename>` can optionally include a list of service subtype labels separated by comma.
344
345The priority and weight are optional and if not provided zero will be used. The txt should follow hex-string format and is treated as an already encoded TXT data byte sequence. It is also optional and if not provided it is considered empty.
346
347```bash
348> srp client service add ins1 _test1._udp 777
349Done
350
351> srp client service add ins2 _test2._udp,_sub1,_sub2 111 1 1
352Done
353```
354
355### service remove
356
357Usage: `srp client service remove <instancename> <servicename>`
358
359Remove a service with a give instance name and service name.
360
361```bash
362> srp client service remove ins2 _test2._udp
363Done
364```
365
366### service clear
367
368Usage: `srp client service clear <instancename> <servicename>`
369
370Clear a service with a give instance name and service name (unlike `service remove`, with `service clear` no update is sent to server and the entry is immediately removed from client list).
371
372```bash
373> srp client service clear ins2 _test2._udp
374Done
375```
376
377### service key
378
379Usage `srp client service key [enable|disable]`
380
381Enable/Disable "service key record inclusion" mode in SRP client. This command requires `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` feature to be enabled.
382
383KEY record is optional in Service Description Instruction (it is required and always included in the Host Description Instruction). The default behavior of SRP client is to not include it. This command is intended to override the default behavior for testing only (in a `REFERENCE_DEVICE` build).
384
385Get the current "service key record inclusion" mode.
386
387```bash
388> srp client service key
389Disabled
390Done
391```
392
393Set the "service key record inclusion" mode.
394
395```bash
396> srp client service key enable
397Done
398
399> srp client service key
400Enabled
401Done
402```
403
404### start
405
406Usage: `srp client start <serveraddr> <serverport>`
407
408Start the SRP client with a given server IPv6 address and port number.
409
410```bash
411> srp client start fd00::d88a:618b:384d:e760 4724
412Done
413```
414
415### state
416
417Usage: `srp client state`
418
419Indicates the state of SRP client, i.e., whether it is enabled or disabled.
420
421```bash
422> srp client state
423Enabled
424Done
425```
426
427### stop
428
429Usage: `srp client stop`
430
431Stop the SRP client.
432
433```bash
434> srp client stop
435Done
436```
437
438### ttl
439
440Usage: `srp client ttl [value]`
441
442Get the TTL (in seconds).
443
444```bash
445> srp client ttl
4467200
447Done
448>
449```
450
451Set the TTL.
452
453```bash
454> srp client ttl 3600
455Done
456```
457

README_SRP_SERVER.md

1# OpenThread CLI - SRP Server
2
3## Quick Start
4
5See [README_SRP.md](README_SRP.md).
6
7## Command List
8
9- [help](#help)
10- [addrmode](#addrmode)
11- [auto](#auto)
12- [disable](#disable)
13- [domain](#domain)
14- [enable](#enable)
15- [host](#host)
16- [lease](#lease)
17- [seqnum](#seqnum)
18- [service](#service)
19- [state](#state)
20
21## Command Details
22
23### help
24
25Usage: `srp server help`
26
27Print SRP server help menu.
28
29```bash
30> srp server help
31addrmode
32auto
33disable
34domain
35enable
36faststart
37help
38host
39lease
40seqnum
41service
42state
43Done
44```
45
46### addrmode
47
48Usage: `srp server addrmode [unicast|anycast]`
49
50Get or set the address mode used by the SRP server.
51
52Address mode specifies how the address and port number are determined by the SRP server and this is published in the Thread Network Data.
53
54Get the address mode.
55
56```bash
57> srp server addrmode
58unicast
59Done
60```
61
62Set the address mode.
63
64```bash
65> srp server addrmode anycast
66Done
67
68> srp server addrmode
69anycast
70Done
71```
72
73### auto
74
75Usage: `srp server auto [enable|disable]`
76
77Enables or disables the auto-enable mode on the SRP server.
78
79When this mode is enabled, the Border Routing Manager controls if and when to enable or disable the SRP server.
80
81This command requires that `OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE` be enabled.
82
83```bash
84> srp server auto enable
85Done
86
87> srp server auto
88Enabled
89Done
90```
91
92### disable
93
94Usage: `srp server disable`
95
96Disable the SRP server.
97
98```bash
99> srp server disable
100Done
101```
102
103### domain
104
105Usage: `srp server domain [domain-name]`
106
107Get the domain.
108
109```bash
110> srp server domain
111default.service.arpa.
112Done
113```
114
115Set the domain.
116
117```bash
118> srp server domain thread.service.arpa.
119Done
120```
121
122### enable
123
124Usage: `srp server enable`
125
126Enable the SRP server.
127
128```bash
129> srp server enable
130Done
131```
132
133### faststart
134
135Usage: `srp server faststart [enable]`
136
137This command requires that `OPENTHREAD_CONFIG_SRP_SERVER_FAST_START_MODE_ENABLE` be enabled.
138
139Enables the "Fast Start Mode" on the SRP server.
140
141The Fast Start Mode is designed for scenarios where a device, often a mobile device, needs to act as a provisional SRP server (e.g., functioning as a temporary Border Router). The SRP server function is enabled only if no other Border Routers (BRs) are already providing the SRP service within the Thread network. Importantly, Fast Start Mode allows the device to quickly start its SRP server functionality upon joining the network, allowing other Thread devices to quickly connect and register their services without the typical delays associated with standard Border Router initialization (and SRP server startup).
142
143The Fast Start Mode can be enabled when the device is in the detached or disabled state, the SRP server is currently disabled, and "auto-enable mode" is not in use.
144
145After successfully enabling Fast Start Mode, it can be disabled by a direct command to enable/disable the SRP server, using `srp server [enable/disable]`.
146
147```bash
148> srp server faststart enable
149Done
150
151> srp server faststart
152Enabled
153Done
154```
155
156### host
157
158Usage: `srp server host`
159
160Print information of all registered hosts.
161
162```bash
163> srp server host
164srp-api-test-1.default.service.arpa.
165    deleted: false
166    addresses: [fdde:ad00:beef:0:0:ff:fe00:fc10]
167srp-api-test-0.default.service.arpa.
168    deleted: false
169    addresses: [fdde:ad00:beef:0:0:ff:fe00:fc10]
170Done
171```
172
173### lease
174
175Usage: `srp server lease [<min-lease>] [<max-lease>] [<min-key-lease>] [<max-key-lease>]`
176
177Get LEASE and KEY-LEASE values.
178
179```bash
180> srp server lease
181min lease: 1800
182max lease: 7200
183min key-lease: 86400
184max key-lease: 1209600
185Done
186```
187
188Set LEASE and KEY-LEASE values.
189
190```bash
191> srp server lease 1800 7200 86400 1209600
192Done
193```
194
195### seqnum
196
197Usage: `srp server seqnum [<seqnum>]`
198
199Get or set the sequence number used with anycast address mode.
200
201The sequence number is included in "DNS/SRP Service Anycast Address" entry published in the Network Data.
202
203```bash
204> srp server seqnum 20
205Done
206
207> srp server seqnum
20820
209Done
210```
211
212### service
213
214Usage: `srp server service`
215
216Print information of all registered services.
217
218The 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.
219
220```bash
221> srp server service
222srp-api-test-1._ipps._tcp.default.service.arpa.
223    deleted: false
224    subtypes: (null)
225    port: 49152
226    priority: 0
227    weight: 0
228    ttl: 7200
229    lease: 7200
230    key-lease: 1209600
231    TXT: [616263, xyz=585960]
232    host: srp-api-test-1.default.service.arpa.
233    addresses: [fdde:ad00:beef:0:0:ff:fe00:fc10]
234srp-api-test-0._ipps._tcp.default.service.arpa.
235    deleted: false
236    subtypes: _sub1,_sub2
237    port: 49152
238    priority: 0
239    weight: 0
240    ttl: 3600
241    lease: 3600
242    key-lease: 1209600
243    TXT: [616263, xyz=585960]
244    host: srp-api-test-0.default.service.arpa.
245    addresses: [fdde:ad00:beef:0:0:ff:fe00:fc10]
246Done
247```
248
249### state
250
251Usage: `srp server state`
252
253Print the state of the SRP server. It could be `disabled`, `stopped` or `running`.
254
255- disabled: The SRP server is not enabled.
256- 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.
257- running: The SRP server is active and will handle service registrations.
258
259```bash
260> srp server state
261running
262Done
263```
264

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\>]&nbsp;[\<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 stack network interface.
72  - `-u`: unspecified network interface.
73  - `-b`: Backbone network interface.
74  - `-h`: Host Thread network interface.
75- ip: the unicast IPv6 address or the unspecified IPv6 address (`::`).
76- port: the UDP port
77
78> Note: the netif parameter values (-u, -b, -h) are only valid if OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE is set.
79
80```bash
81> udp bind :: 1234
82Done
83> udp bind -u :: 1234
84Done
85> udp bind -b :: 1234
86Done
87> udp bind -h :: 1234
88Done
89```
90
91> 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.
92
93### close
94
95Closes the example socket.
96
97```bash
98> udp close
99Done
100```
101
102### connect \<ip\> \<port\>
103
104Specifies the peer with which the socket is to be associated.
105
106- ip: the peer's IP address.
107- port: the peer's UDP port.
108
109```bash
110> udp connect fdde:ad00:beef:0:bb1:ebd6:ad10:f33 1234
111Done
112```
113
114The address can be an IPv4 address, which will be synthesized to an IPv6 address using the preferred NAT64 prefix from the network data.
115
116> Note: The command will return `InvalidState` when the preferred NAT64 prefix is unavailable.
117
118```bash
119> udp connect 172.17.0.1 1234
120Connecting to synthesized IPv6 address: fdde:ad00:beef:2:0:0:ac11:1
121Done
122```
123
124### linksecurity
125
126Indicates whether the link security is enabled or disabled.
127
128```bash
129> udp linksecurity
130Enabled
131Done
132```
133
134### linksecurity enable
135
136Enable link security.
137
138```bash
139> udp linksecurity enable
140Done
141```
142
143### linksecurity disable
144
145Disable link security.
146
147```bash
148> udp linksecurity disable
149Done
150```
151
152### open
153
154Opens the example socket.
155
156```bash
157> udp open
158Done
159```
160
161### send \<ip\> \<port\> \<message\>
162
163Send a UDP message.
164
165- ip: the destination address.
166- port: the UDP destination port.
167- message: the message to send.
168
169```bash
170> udp send fdde:ad00:beef:0:bb1:ebd6:ad10:f33 1234 hello
171Done
172```
173
174The address can be an IPv4 address, which will be synthesized to an IPv6 address using the preferred NAT64 prefix from the network data.
175
176> Note: The command will return `InvalidState` when the preferred NAT64 prefix is unavailable.
177
178```bash
179> udp send 172.17.0.1 1234 hello
180Sending to synthesized IPv6 address: fdde:ad00:beef:2:0:0:ac11:1
181Done
182```
183
184### send \<ip\> \<port\> \<type\> \<value\>
185
186Send a few bytes over UDP.
187
188- ip: the IPv6 destination address.
189- port: the UDP destination port.
190- type: the type of the message:
191  - `-t`: text payload in the `value`, same as without specifying the type.
192  - `-s`: autogenerated payload with specified length indicated in the `value`.
193  - `-x`: binary data in hexadecimal representation in the `value`.
194
195```bash
196> udp send fdde:ad00:beef:0:bb1:ebd6:ad10:f33 1234 -t hello
197Done
198
199> udp send fdde:ad00:beef:0:bb1:ebd6:ad10:f33 1234 -x 68656c6c6f
200Done
201
202> udp send fdde:ad00:beef:0:bb1:ebd6:ad10:f33 1234 -s 800
203Done
204
205```
206
207### send \<message\>
208
209Send a UDP message on a connected socket.
210
211- message: the message to send.
212
213```bash
214> udp send hello
215Done
216```
217
218### send \<type\> \<value\>
219
220Send a few bytes over UDP.
221
222- type: the type of the message:
223  - `-t`: text payload in the `value`, same as without specifying the type.
224  - `-s`: autogenerated payload with specified length indicated in the `value`.
225  - `-x`: binary data in hexadecimal representation in the `value`.
226
227```bash
228> udp send -t hello
229Done
230
231> udp send -x 68656c6c6f
232Done
233
234> udp send -s 800
235Done
236```
237