README.md
1# OpenThread CLI Reference
2
3The OpenThread CLI exposes configuration and management APIs via a command line interface. Use the CLI to play with OpenThread, which can also be used with additional application code. The OpenThread test scripts use the CLI to execute test cases.
4
5## Separator and escaping characters
6
7The whitespace character (`' '`) is used to delimit the command name and the different arguments, together with tab (`'\t'`) and new line characters (`'\r'`, `'\n'`).
8
9Some arguments might require to accept whitespaces on them. For those cases the backslash character (`'\'`) can be used to escape separators or the backslash itself.
10
11Example:
12
13```bash
14> networkname Test\ Network
15Done
16> networkname
17Test Network
18Done
19>
20```
21
22## OpenThread Command List
23
24- [ba](#ba)
25- [bbr](#bbr)
26- [br](#br)
27- [bufferinfo](#bufferinfo)
28- [ccathreshold](#ccathreshold)
29- [channel](#channel)
30- [child](#child-list)
31- [childip](#childip)
32- [childmax](#childmax)
33- [childsupervision](#childsupervision-interval)
34- [childtimeout](#childtimeout)
35- [coap](README_COAP.md)
36- [coaps](README_COAPS.md)
37- [commissioner](README_COMMISSIONER.md)
38- [contextreusedelay](#contextreusedelay)
39- [counters](#counters)
40- [csl](#csl)
41- [dataset](README_DATASET.md)
42- [delaytimermin](#delaytimermin)
43- [diag](#diag)
44- [discover](#discover-channel)
45- [dns](#dns-config)
46- [domainname](#domainname)
47- [dua](#dua-iid)
48- [eidcache](#eidcache)
49- [eui64](#eui64)
50- [extaddr](#extaddr)
51- [extpanid](#extpanid)
52- [factoryreset](#factoryreset)
53- [fake](#fake)
54- [fem](#fem)
55- [history](README_HISTORY.md)
56- [ifconfig](#ifconfig)
57- [ipaddr](#ipaddr)
58- [ipmaddr](#ipmaddr)
59- [joiner](README_JOINER.md)
60- [joinerport](#joinerport-port)
61- [keysequence](#keysequence-counter)
62- [leaderdata](#leaderdata)
63- [leaderweight](#leaderweight)
64- [linkmetrics](#linkmetrics-mgmt-ipaddr-enhanced-ack-clear)
65- [locate](#locate)
66- [log](#log-filename-filename)
67- [mac](#mac-retries-direct)
68- [macfilter](#macfilter)
69- [mliid](#mliid-iid)
70- [mlr](#mlr-reg-ipaddr--timeout)
71- [mode](#mode)
72- [multiradio](#multiradio)
73- [neighbor](#neighbor-list)
74- [netdata](README_NETDATA.md)
75- [netstat](#netstat)
76- [networkdiagnostic](#networkdiagnostic-get-addr-type-)
77- [networkidtimeout](#networkidtimeout)
78- [networkkey](#networkkey)
79- [networkname](#networkname)
80- [networktime](#networktime)
81- [panid](#panid)
82- [parent](#parent)
83- [parentpriority](#parentpriority)
84- [partitionid](#partitionid)
85- [ping](#ping--i-source-ipaddr-size-count-interval-hoplimit-timeout)
86- [pollperiod](#pollperiod-pollperiod)
87- [preferrouterid](#preferrouterid-routerid)
88- [prefix](#prefix)
89- [promiscuous](#promiscuous)
90- [pskc](#pskc--p-keypassphrase)
91- [radiofilter](#radiofilter)
92- [rcp](#rcp)
93- [region](#region)
94- [releaserouterid](#releaserouterid-routerid)
95- [reset](#reset)
96- [rloc16](#rloc16)
97- [route](#route)
98- [router](#router-list)
99- [routerdowngradethreshold](#routerdowngradethreshold)
100- [routereligible](#routereligible)
101- [routerselectionjitter](#routerselectionjitter)
102- [routerupgradethreshold](#routerupgradethreshold)
103- [scan](#scan-channel)
104- [service](#service)
105- [singleton](#singleton)
106- [sntp](#sntp-query-sntp-server-ip-sntp-server-port)
107- [state](#state)
108- [srp](README_SRP.md)
109- [tcp](README_TCP.md)
110- [thread](#thread-start)
111- [trel](#trel)
112- [tvcheck](#tvcheck-enable)
113- [txpower](#txpower)
114- [udp](README_UDP.md)
115- [unsecureport](#unsecureport-add-port)
116- [uptime](#uptime)
117- [version](#version)
118
119## OpenThread Command Details
120
121### bbr
122
123Show current Primary Backbone Router information for Thread 1.2 device.
124
125```bash
126> bbr
127BBR Primary:
128server16: 0xE400
129seqno: 10
130delay: 120 secs
131timeout: 300 secs
132Done
133```
134
135```bash
136> bbr
137BBR Primary: None
138Done
139```
140
141### bbr mgmt dua \<status\|coap-code\> [meshLocalIid]
142
143Configure 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.
144
145Only for testing/reference device.
146
147known status value:
148
149- 0: ST_DUA_SUCCESS
150- 1: ST_DUA_REREGISTER
151- 2: ST_DUA_INVALID
152- 3: ST_DUA_DUPLICATE
153- 4: ST_DUA_NO_RESOURCES
154- 5: ST_DUA_BBR_NOT_PRIMARY
155- 6: ST_DUA_GENERAL_FAILURE
156- 160: COAP code 5.00
157
158```bash
159> bbr mgmt dua 1 2f7c235e5025a2fd
160Done
161> bbr mgmt dua 160
162Done
163```
164
165### bbr mgmt mlr listener
166
167Show the Multicast Listeners.
168
169Only for testing/reference Backbone Router device.
170
171```bash
172> bbr mgmt mlr listener
173ff04:0:0:0:0:0:0:abcd 3534000
174ff04:0:0:0:0:0:0:eeee 3537610
175Done
176```
177
178### bbr mgmt mlr listener add \<ipaddr\> \[\<timeout\>\]
179
180Add a Multicast Listener with a given IPv6 multicast address and timeout (in seconds).
181
182Only for testing/reference Backbone Router device.
183
184```bash
185> bbr mgmt mlr listener add ff04::1
186Done
187> bbr mgmt mlr listener add ff04::2 300
188Done
189> bbr mgmt mlr listener
190ff04:0:0:0:0:0:0:2 261
191ff04:0:0:0:0:0:0:1 3522
192Done
193```
194
195### bbr mgmt mlr listener clear
196
197Removes all the Multicast Listeners.
198
199Only for testing/reference Backbone Router device.
200
201```bash
202> bbr mgmt mlr listener clear
203Done
204> bbr mgmt mlr listener
205Done
206```
207
208### bbr mgmt mlr response \<status\>
209
210Configure the response status for the next MLR.req.
211
212Only for testing/reference device.
213
214Known status values:
215
216- 0: ST_MLR_SUCCESS
217- 2: ST_MLR_INVALID
218- 3: ST_MLR_NO_PERSISTENT
219- 4: ST_MLR_NO_RESOURCES
220- 5: ST_MLR_BBR_NOT_PRIMARY
221- 6: ST_MLR_GENERAL_FAILURE
222
223```bash
224> bbr mgmt mlr response 2
225Done
226```
227
228### bbr state
229
230Show local Backbone state ([`Disabled`,`Primary`, `Secondary`]) for Thread 1.2 FTD.
231
232`OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is required.
233
234```bash
235> bbr state
236Disabled
237Done
238
239> bbr state
240Primary
241Done
242
243> bbr state
244Secondary
245Done
246```
247
248### bbr enable
249
250Enable Backbone Router Service for Thread 1.2 FTD. `SRV_DATA.ntf` would be triggerred for attached device if there is no Backbone Router Service in Thread Network Data.
251
252`OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is required.
253
254```bash
255> bbr enable
256Done
257```
258
259### bbr disable
260
261Disable Backbone Router Service for Thread 1.2 FTD. `SRV_DATA.ntf` would be triggerred if Backbone Router is Primary state. o `OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is required.
262
263```bash
264> bbr disable
265Done
266```
267
268### bbr register
269
270Register Backbone Router Service for Thread 1.2 FTD. `SRV_DATA.ntf` would be triggerred for attached device.
271
272`OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is required.
273
274```bash
275> bbr register
276Done
277```
278
279### bbr config
280
281Show local Backbone Router configuration for Thread 1.2 FTD.
282
283`OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is required.
284
285```bash
286> bbr config
287seqno: 10
288delay: 120 secs
289timeout: 300 secs
290Done
291```
292
293### bbr config \[seqno \<seqno\>\] \[delay \<delay\>\] \[timeout \<timeout\>\]
294
295Configure 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.
296
297`OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is required.
298
299```bash
300> bbr config seqno 20 delay 30
301Done
302```
303
304### bbr jitter
305
306Show jitter (in seconds) for Backbone Router registration for Thread 1.2 FTD.
307
308`OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is required.
309
310```bash
311> bbr jitter
31220
313Done
314```
315
316### bbr jitter \<jitter\>
317
318Set jitter (in seconds) for Backbone Router registration for Thread 1.2 FTD.
319
320`OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is required.
321
322```bash
323> bbr jitter 10
324Done
325```
326
327### ba
328
329Show current Border Agent information.
330
331### ba port
332
333Print border agent service port.
334
335```bash
336> ba port
33749152
338Done
339```
340
341### ba state
342
343Print border agent state.
344
345```bash
346> ba state
347Started
348Done
349```
350
351### br
352
353Enbale/disable the Border Routing functionality.
354
355```bash
356> br enable
357Done
358```
359
360```bash
361> br disable
362Done
363```
364
365### br omrprefix
366
367Get the randomly generated off-mesh-routable prefix of the Border Router.
368
369```bash
370> br omrprefix
371fdfc:1ff5:1512:5622::/64
372Done
373```
374
375### br onlinkprefix
376
377Get the randomly generated on-link prefix of the Border Router.
378
379```bash
380> br onlinkprefix
381fd41:2650:a6f5:0::/64
382Done
383```
384
385### br nat64prefix
386
387Get the local NAT64 prefix of the Border Router.
388
389`OPENTHREAD_CONFIG_BORDER_ROUTING_NAT64_ENABLE` is required.
390
391```bash
392> br nat64prefix
393fd14:1078:b3d5:b0b0:0:0::/96
394Done
395```
396
397### br rioprf
398
399Get the preference used when advertising Route Info Options (e.g., for discovered OMR prefixes) in emitted Router Advertisement message.
400
401```bash
402> br rioprf
403med
404Done
405```
406
407### br rioprf \<prf\>
408
409Set 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.
410
411```bash
412> br rioprf low
413Done
414```
415
416### bufferinfo
417
418Show the current message buffer information.
419
420- The `total` shows total number of message buffers in pool.
421- The `free` shows the number of free message buffers.
422- This is then followed by info about different queues used by OpenThread stack, each line representing info about a queue.
423 - The first number shows number messages in the queue.
424 - The second number shows number of buffers used by all messages in the queue.
425 - The third number shows total number of bytes of all messages in the queue.
426
427```bash
428> bufferinfo
429total: 40
430free: 40
4316lo send: 0 0 0
4326lo reas: 0 0 0
433ip6: 0 0 0
434mpl: 0 0 0
435mle: 0 0 0
436coap: 0 0 0
437coap secure: 0 0 0
438application coap: 0 0 0
439Done
440```
441
442### ccathreshold
443
444Get the CCA threshold in dBm measured at antenna connector per IEEE 802.15.4 - 2015 section 10.1.4.
445
446```bash
447> ccathreshold
448-75 dBm
449Done
450```
451
452### ccathreshold \<ccathreshold\>
453
454Set the CCA threshold measured at antenna connector per IEEE 802.15.4 - 2015 section 10.1.4.
455
456```bash
457> ccathreshold -62
458Done
459```
460
461### channel
462
463Get the IEEE 802.15.4 Channel value.
464
465```bash
466> channel
46711
468Done
469```
470
471### channel \<channel\>
472
473Set the IEEE 802.15.4 Channel value.
474
475```bash
476> channel 11
477Done
478```
479
480### channel manager
481
482Get channel manager state.
483
484`OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` is required.
485
486```bash
487channel: 11
488auto: 1
489delay: 120
490interval: 10800
491supported: { 11-26}
492favored: { 11-26}
493Done
494```
495
496### channel manager change \<channel\>
497
498Initiate a channel change with the channel manager.
499
500`OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` is required.
501
502```bash
503> channel manager change 11
504channel manager change 11
505Done
506```
507
508### channel manager select \<skip quality check (boolean)\>
509
510Request a channel selection with the channel manager.
511
512`OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` and `OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE` are required.
513
514```bash
515> channel manager select 1
516channel manager select 1
517Done
518```
519
520### channel manager auto \<enable (boolean)\>
521
522Enable/disable the auto-channel-selection functionality.
523
524`OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` and `OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE` are required.
525
526```bash
527> channel manager auto 1
528channel manager auto 1
529Done
530```
531
532### channel manager delay \<delay\>
533
534Set the channel change delay (in seconds).
535
536`OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` and `OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE` are required.
537
538```bash
539> channel manager delay 120
540channel manager delay 120
541Done
542```
543
544### channel manager interval \<interval\>
545
546Set the auto-channel-selection interval (in seconds).
547
548`OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` and `OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE` are required.
549
550```bash
551> channel manager interval 10800
552channel manager interval 10800
553Done
554```
555
556### channel manager supported \<mask\>
557
558Set the supported channel mask for the auto-channel-selection.
559
560`OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` and `OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE` are required.
561
562```bash
563> channel manager supported 0x7fffc00
564channel manager supported 0x7fffc00
565Done
566```
567
568### channel manager favored \<mask\>
569
570Set the favored channel mask for the auto-channel-selection.
571
572`OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` and `OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE` are required.
573
574```bash
575> channel manager favored 0x7fffc00
576channel manager favored 0x7fffc00
577Done
578```
579
580### channel monitor
581
582Get current channel monitor state and channel occupancy.
583
584`OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE` is required.
585
586```bash
587> channel monitor
588channel monitor
589enabled: 1
590interval: 41000
591threshold: -75
592window: 960
593count: 10552
594occupancies:
595ch 11 (0x0cb7) 4.96% busy
596ch 12 (0x2e2b) 18.03% busy
597ch 13 (0x2f54) 18.48% busy
598ch 14 (0x0fef) 6.22% busy
599ch 15 (0x1536) 8.28% busy
600ch 16 (0x1746) 9.09% busy
601ch 17 (0x0b8b) 4.50% busy
602ch 18 (0x60a7) 37.75% busy
603ch 19 (0x0810) 3.14% busy
604ch 20 (0x0c2a) 4.75% busy
605ch 21 (0x08dc) 3.46% busy
606ch 22 (0x101d) 6.29% busy
607ch 23 (0x0092) 0.22% busy
608ch 24 (0x0028) 0.06% busy
609ch 25 (0x0063) 0.15% busy
610ch 26 (0x058c) 2.16% busy
611
612Done
613```
614
615### channel monitor start
616
617Start the channel monitor.
618
619`OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE` is required.
620
621```bash
622> channel monitor start
623channel monitor start
624Done
625```
626
627### channel monitor stop
628
629Stop the channel monitor.
630
631`OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE` is required.
632
633```bash
634> channel monitor stop
635channel monitor stop
636Done
637```
638
639### channel preferred
640
641Get preferred channel mask.
642
643```bash
644> channel preferred
6450x7fff800
646Done
647```
648
649### channel supported
650
651Get supported channel mask.
652
653```bash
654> channel supported
6550x7fff800
656Done
657```
658
659### child list
660
661List attached Child IDs.
662
663```bash
664> child list
6651 2 3 6 7 8
666Done
667```
668
669### child table
670
671Print table of attached children.
672
673```bash
674> child table
675| ID | RLOC16 | Timeout | Age | LQ In | C_VN |R|D|N|Ver|CSL|QMsgCnt| Extended MAC |
676+-----+--------+------------+------------+-------+------+-+-+-+---+---+-------+------------------+
677| 1 | 0xc801 | 240 | 24 | 3 | 131 |1|0|0| 3| 0 | 0 | 4ecede68435358ac |
678| 2 | 0xc802 | 240 | 2 | 3 | 131 |0|0|0| 3| 1 | 0 | a672a601d2ce37d8 |
679Done
680```
681
682### child \<id\>
683
684Print diagnostic information for an attached Thread Child. The `id` may be a Child ID or an RLOC16.
685
686```bash
687> child 1
688Child ID: 1
689Rloc: 9c01
690Ext Addr: e2b3540590b0fd87
691Mode: rn
692Net Data: 184
693Timeout: 100
694Age: 0
695Link Quality In: 3
696RSSI: -20
697Done
698```
699
700### childip
701
702Get the list of IP addresses stored for MTD children.
703
704```bash
705> childip
7063401: fdde:ad00:beef:0:3037:3e03:8c5f:bc0c
707Done
708```
709
710### childip max
711
712Get the maximum number of IP addresses that each MTD child may register with this device as parent.
713
714```bash
715> childip max
7164
717Done
718```
719
720### childip max \<count\>
721
722Set 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.
723
724`OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is required.
725
726```bash
727> childip max 2
728Done
729```
730
731### childmax
732
733Get the Thread maximum number of allowed children.
734
735```bash
736> childmax
7375
738Done
739```
740
741### childmax \<count\>
742
743Set the Thread maximum number of allowed children.
744
745```bash
746> childmax 2
747Done
748```
749
750### childsupervision interval
751
752Get the Child Supervision Interval value.
753
754Child 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 supervision message (a data message with empty payload) to the child. This command can only be used with FTD devices.
755
756```bash
757> childsupervision interval
75830
759Done
760```
761
762### childsupervision interval \<interval\>
763
764Set the Child Supervision Interval value. This command can only be used with FTD devices.
765
766```bash
767> childsupervision interval 30
768Done
769```
770
771### childsupervision checktimeout
772
773Get the Child Supervision Check Timeout value.
774
775If 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).
776
777```bash
778> childsupervision checktimeout
77930
780Done
781```
782
783### childsupervision checktimeout \<timeout\>
784
785Set the Child Supervision Check Timeout value.
786
787```bash
788> childsupervision checktimeout 30
789Done
790```
791
792### childtimeout
793
794Get the Thread Child Timeout value.
795
796```bash
797> childtimeout
798300
799Done
800```
801
802### childtimeout \<timeout\>
803
804Set the Thread Child Timeout value.
805
806```bash
807> childtimeout 300
808Done
809```
810
811### contextreusedelay
812
813Get the CONTEXT_ID_REUSE_DELAY value.
814
815```bash
816> contextreusedelay
81711
818Done
819```
820
821### contextreusedelay \<delay\>
822
823Set the CONTEXT_ID_REUSE_DELAY value.
824
825```bash
826> contextreusedelay 11
827Done
828```
829
830### counters
831
832Get the supported counter names.
833
834```bash
835> counters
836ip
837mac
838mle
839Done
840```
841
842### counters \<countername\>
843
844Get the counter value.
845
846```bash
847> counters mac
848TxTotal: 10
849 TxUnicast: 3
850 TxBroadcast: 7
851 TxAckRequested: 3
852 TxAcked: 3
853 TxNoAckRequested: 7
854 TxData: 10
855 TxDataPoll: 0
856 TxBeacon: 0
857 TxBeaconRequest: 0
858 TxOther: 0
859 TxRetry: 0
860 TxErrCca: 0
861 TxErrBusyChannel: 0
862RxTotal: 2
863 RxUnicast: 1
864 RxBroadcast: 1
865 RxData: 2
866 RxDataPoll: 0
867 RxBeacon: 0
868 RxBeaconRequest: 0
869 RxOther: 0
870 RxAddressFiltered: 0
871 RxDestAddrFiltered: 0
872 RxDuplicated: 0
873 RxErrNoFrame: 0
874 RxErrNoUnknownNeighbor: 0
875 RxErrInvalidSrcAddr: 0
876 RxErrSec: 0
877 RxErrFcs: 0
878 RxErrOther: 0
879Done
880> counters mle
881Role Disabled: 0
882Role Detached: 1
883Role Child: 0
884Role Router: 0
885Role Leader: 1
886Attach Attempts: 1
887Partition Id Changes: 1
888Better Partition Attach Attempts: 0
889Parent Changes: 0
890Done
891> counters ip
892TxSuccess: 10
893TxFailed: 0
894RxSuccess: 5
895RxFailed: 0
896Done
897```
898
899### counters \<countername\> reset
900
901Reset the counter value.
902
903```bash
904> counters mac reset
905Done
906> counters mle reset
907Done
908> counters ip reset
909Done
910```
911
912### csl
913
914Get the CSL configuration.
915
916```bash
917> csl
918Channel: 11
919Period: 1000 (in units of 10 symbols), 160ms
920Timeout: 1000s
921Done
922```
923
924### csl channel \<channel\>
925
926Set CSL channel.
927
928```bash
929> csl channel 20
930Done
931```
932
933### csl period \<period\>
934
935Set CSL period in units of 10 symbols. Disable CSL by setting this parameter to `0`.
936
937```bash
938> csl period 3000
939Done
940```
941
942### csl timeout \<timeout\>
943
944Set the CSL timeout in seconds.
945
946```bash
947> csl timeout 10
948Done
949```
950
951### networktime
952
953Get the Thread network time and the time sync parameters.
954
955```bash
956> networktime
957Network Time: 21084154us (synchronized)
958Time Sync Period: 100s
959XTAL Threshold: 300ppm
960Done
961```
962
963### networktime \<timesyncperiod\> \<xtalthreshold\>
964
965Set time sync parameters
966
967- timesyncperiod: The time synchronization period, in seconds.
968- xtalthreshold: The XTAL accuracy threshold for a device to become Router-Capable device, in PPM.
969
970```bash
971> networktime 100 300
972Done
973```
974
975### delaytimermin
976
977Get the minimal delay timer (in seconds).
978
979```bash
980> delaytimermin
98130
982Done
983```
984
985### delaytimermin \<delaytimermin\>
986
987Set the minimal delay timer (in seconds).
988
989```bash
990> delaytimermin 60
991Done
992```
993
994### discover \[channel\]
995
996Perform an MLE Discovery operation.
997
998- channel: The channel to discover on. If no channel is provided, the discovery will cover all valid channels.
999
1000```bash
1001> discover
1002| J | Network Name | Extended PAN | PAN | MAC Address | Ch | dBm | LQI |
1003+---+------------------+------------------+------+------------------+----+-----+-----+
1004| 0 | OpenThread | dead00beef00cafe | ffff | f1d92a82c8d8fe43 | 11 | -20 | 0 |
1005Done
1006```
1007
1008### dns config
1009
1010Get the default query config used by DNS client.
1011
1012The config includes the server IPv6 address and port, response timeout in msec (wait time to rx response), maximum tx attempts before reporting failure, boolean flag to indicate whether the server can resolve the query recursively or not.
1013
1014```bash
1015> dns config
1016Server: [fd00:0:0:0:0:0:0:1]:1234
1017ResponseTimeout: 5000 ms
1018MaxTxAttempts: 2
1019RecursionDesired: no
1020Done
1021>
1022```
1023
1024### dns config \[DNS server IP\] \[DNS server port\] \[response timeout (ms)\] \[max tx attempts\] \[recursion desired (boolean)\]
1025
1026Set the default query config.
1027
1028```bash
1029> dns config fd00::1 1234 5000 2 0
1030Done
1031
1032> dns config
1033Server: [fd00:0:0:0:0:0:0:1]:1234
1034ResponseTimeout: 5000 ms
1035MaxTxAttempts: 2
1036RecursionDesired: no
1037Done
1038```
1039
1040We 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.
1041
1042```bash
1043> dns config fd00::2
1044Done
1045
1046> dns config
1047Server: [fd00:0:0:0:0:0:0:2]:53
1048ResponseTimeout: 3000 ms
1049MaxTxAttempts: 3
1050RecursionDesired: yes
1051Done
1052```
1053
1054### dns resolve \<hostname\> \[DNS server IP\] \[DNS server port\] \[response timeout (ms)\] \[max tx attempts\] \[recursion desired (boolean)\]
1055
1056Send DNS Query to obtain IPv6 address for given hostname.
1057
1058The 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`).
1059
1060```bash
1061> dns resolve ipv6.google.com
1062> DNS response for ipv6.google.com - 2a00:1450:401b:801:0:0:0:200e TTL: 300
1063```
1064
1065### dns browse \<service-name\> \[DNS server IP\] \[DNS server port\] \[response timeout (ms)\] \[max tx attempts\] \[recursion desired (boolean)\]
1066
1067Send a browse (service instance enumeration) DNS query to get the list of services for given service-name.
1068
1069The 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`).
1070
1071```bash
1072> dns browse _service._udp.example.com
1073DNS browse response for _service._udp.example.com.
1074inst1
1075 Port:1234, Priority:1, Weight:2, TTL:7200
1076 Host:host.example.com.
1077 HostAddress:fd00:0:0:0:0:0:0:abcd TTL:7200
1078 TXT:[a=6531, b=6c12] TTL:7300
1079instance2
1080 Port:1234, Priority:1, Weight:2, TTL:7200
1081 Host:host.example.com.
1082 HostAddress:fd00:0:0:0:0:0:0:abcd TTL:7200
1083 TXT:[a=1234] TTL:7300
1084Done
1085```
1086
1087### dns service \<service-instance-label\> \<service-name\> \[DNS server IP\] \[DNS server port\] \[response timeout (ms)\] \[max tx attempts\] \[recursion desired (boolean)\]
1088
1089Send 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).
1090
1091The 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`).
1092
1093### dns compression \[enable|disable\]
1094
1095Enable/Disable the "DNS name compression" mode.
1096
1097By 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.
1098
1099This is intended for testing only and available under `REFERENCE_DEVICE` config.
1100
1101Get the current "DNS name compression" mode.
1102
1103```
1104> dns compression
1105Enabled
1106```
1107
1108Set the "DNS name compression" mode.
1109
1110```
1111> dns compression disable
1112Done
1113>
1114>
1115> dns compression
1116Disabled
1117Done
1118```
1119
1120### domainname
1121
1122Get the Thread Domain Name for Thread 1.2 device.
1123
1124```bash
1125> domainname
1126Thread
1127Done
1128```
1129
1130### domainname \<name\>
1131
1132Set the Thread Domain Name for Thread 1.2 device.
1133
1134```bash
1135> domainname Test\ Thread
1136Done
1137```
1138
1139### dua iid
1140
1141Get the Interface Identifier mannually specified for Thread Domain Unicast Address on Thread 1.2 device.
1142
1143```bash
1144> dua iid
11450004000300020001
1146Done
1147```
1148
1149### dua iid \<iid\>
1150
1151Set the Interface Identifier mannually specified for Thread Domain Unicast Address on Thread 1.2 device.
1152
1153```bash
1154> dua iid 0004000300020001
1155Done
1156```
1157
1158### dua iid clear
1159
1160Clear the Interface Identifier mannually specified for Thread Domain Unicast Address on Thread 1.2 device.
1161
1162```bash
1163> dua iid clear
1164Done
1165```
1166
1167### eidcache
1168
1169Print the EID-to-RLOC cache entries.
1170
1171```bash
1172> eidcache
1173fd49:caf4:a29f:dc0e:97fc:69dd:3c16:df7d 2000 cache canEvict=1 transTime=0 eid=fd49:caf4:a29f:dc0e:97fc:69dd:3c16:df7d
1174fd49:caf4:a29f:dc0e:97fc:69dd:3c16:df7f fffe retry canEvict=1 timeout=10 retryDelay=30
1175Done
1176```
1177
1178### eui64
1179
1180Get the factory-assigned IEEE EUI-64.
1181
1182```bash
1183> eui64
11840615aae900124b00
1185Done
1186```
1187
1188### extaddr
1189
1190Get the IEEE 802.15.4 Extended Address.
1191
1192```bash
1193> extaddr
1194dead00beef00cafe
1195Done
1196```
1197
1198### extaddr \<extaddr\>
1199
1200Set the IEEE 802.15.4 Extended Address.
1201
1202```bash
1203> extaddr dead00beef00cafe
1204dead00beef00cafe
1205Done
1206```
1207
1208### extpanid
1209
1210Get the Thread Extended PAN ID value.
1211
1212**NOTE** The current commissioning credential becomes stale after changing this value. Use [pskc](#pskc--p-keypassphrase) to reset.
1213
1214```bash
1215> extpanid
1216dead00beef00cafe
1217Done
1218```
1219
1220### extpanid \<extpanid\>
1221
1222Set the Thread Extended PAN ID value.
1223
1224```bash
1225> extpanid dead00beef00cafe
1226Done
1227```
1228
1229### factoryreset
1230
1231Delete all stored settings, and signal a platform reset.
1232
1233```bash
1234> factoryreset
1235```
1236
1237### fake
1238
1239Send fake Thread messages.
1240
1241Note: Only for certification test.
1242
1243#### fake /a/an \<dst-ipaddr\> \<target\> \<meshLocalIid\>
1244
1245```bash
1246> fake /a/an fdde:ad00:beef:0:0:ff:fe00:a800 fd00:7d03:7d03:7d03:55f2:bb6a:7a43:a03b 1111222233334444
1247Done
1248```
1249
1250### fem
1251
1252Get external FEM parameters.
1253
1254```bash
1255> fem
1256LNA gain 11 dBm
1257Done
1258```
1259
1260### fem lnagain
1261
1262Get the Rx LNA gain in dBm of the external FEM.
1263
1264```bash
1265> fem lnagain
126611
1267Done
1268```
1269
1270### fem lnagain \<LNA gain\>
1271
1272Set the Rx LNA gain in dBm of the external FEM.
1273
1274```bash
1275> fem lnagain 8
1276Done
1277```
1278
1279### ifconfig
1280
1281Show the status of the IPv6 interface.
1282
1283```bash
1284> ifconfig
1285down
1286Done
1287```
1288
1289### ifconfig up
1290
1291Bring up the IPv6 interface.
1292
1293```bash
1294> ifconfig up
1295Done
1296```
1297
1298### ifconfig down
1299
1300Bring down the IPv6 interface.
1301
1302```bash
1303> ifconfig down
1304Done
1305```
1306
1307### ipaddr
1308
1309List all IPv6 addresses assigned to the Thread interface.
1310
1311```bash
1312> ipaddr
1313fdde:ad00:beef:0:0:ff:fe00:0
1314fdde:ad00:beef:0:558:f56b:d688:799
1315fe80:0:0:0:f3d9:2a82:c8d8:fe43
1316Done
1317```
1318
1319Use `-v` to get more verbose informations about the address.
1320
1321```bash
1322> ipaddr -v
1323fdde:ad00:beef:0:0:ff:fe00:0 origin:thread
1324fdde:ad00:beef:0:558:f56b:d688:799 origin:thread
1325fe80:0:0:0:f3d9:2a82:c8d8:fe43 origin:thread
1326Done
1327```
1328
1329### ipaddr add \<ipaddr\>
1330
1331Add an IPv6 address to the Thread interface.
1332
1333```bash
1334> ipaddr add 2001::dead:beef:cafe
1335Done
1336```
1337
1338### ipaddr del \<ipaddr\>
1339
1340Delete an IPv6 address from the Thread interface.
1341
1342```bash
1343> ipaddr del 2001::dead:beef:cafe
1344Done
1345```
1346
1347### ipaddr linklocal
1348
1349Print Thread link-local IPv6 address.
1350
1351```bash
1352> ipaddr linklocal
1353fe80:0:0:0:f3d9:2a82:c8d8:fe43
1354Done
1355```
1356
1357### ipaddr mleid
1358
1359Print Thread Mesh Local EID address.
1360
1361```bash
1362> ipaddr mleid
1363fdde:ad00:beef:0:558:f56b:d688:799
1364Done
1365```
1366
1367### ipaddr rloc
1368
1369Print Thread Routing Locator (RLOC) address.
1370
1371```bash
1372> ipaddr rloc
1373fdde:ad00:beef:0:0:ff:fe00:0
1374Done
1375```
1376
1377### ipmaddr
1378
1379List all IPv6 multicast addresses subscribed to the Thread interface.
1380
1381```bash
1382> ipmaddr
1383ff05:0:0:0:0:0:0:1
1384ff33:40:fdde:ad00:beef:0:0:1
1385ff32:40:fdde:ad00:beef:0:0:1
1386Done
1387```
1388
1389### ipmaddr add \<ipaddr\>
1390
1391Subscribe the Thread interface to the IPv6 multicast address.
1392
1393```bash
1394> ipmaddr add ff05::1
1395Done
1396```
1397
1398### ipmaddr del \<ipaddr\>
1399
1400Unsubscribe the Thread interface to the IPv6 multicast address.
1401
1402```bash
1403> ipmaddr del ff05::1
1404Done
1405```
1406
1407### ipmaddr llatn
1408
1409Get the Link-Local All Thread Nodes multicast address.
1410
1411```
1412> ipmaddr llatn
1413ff32:40:fdde:ad00:beef:0:0:1
1414Done
1415```
1416
1417### ipmaddr promiscuous
1418
1419Get multicast promiscuous mode.
1420
1421```bash
1422> ipmaddr promiscuous
1423Disabled
1424Done
1425```
1426
1427### ipmaddr promiscuous enable
1428
1429Enable multicast promiscuous mode.
1430
1431```bash
1432> ipmaddr promiscuous enable
1433Done
1434```
1435
1436### ipmaddr promiscuous disable
1437
1438Disable multicast promiscuous mode.
1439
1440```bash
1441> ipmaddr promiscuous disable
1442Done
1443```
1444
1445### ipmaddr rlatn
1446
1447Get the Realm-Local All Thread Nodes multicast address.
1448
1449```
1450> ipmaddr rlatn
1451ff33:40:fdde:ad00:beef:0:0:1
1452Done
1453```
1454
1455### joinerport \<port\>
1456
1457Set the Joiner port.
1458
1459```bash
1460> joinerport 1000
1461Done
1462```
1463
1464### keysequence counter
1465
1466Get the Thread Key Sequence Counter.
1467
1468```bash
1469> keysequence counter
147010
1471Done
1472```
1473
1474### keysequence counter \<counter\>
1475
1476Set the Thread Key Sequence Counter.
1477
1478```bash
1479> keysequence counter 10
1480Done
1481```
1482
1483### keysequence guardtime
1484
1485Get Thread Key Switch Guard Time (in hours)
1486
1487```bash
1488> keysequence guardtime
14890
1490Done
1491```
1492
1493### keysequence guardtime \<guardtime\>
1494
1495Set Thread Key Switch Guard Time (in hours) 0 means Thread Key Switch imediately if key index match
1496
1497```bash
1498> keysequence guardtime 0
1499Done
1500```
1501
1502### leaderdata
1503
1504Show the Thread Leader Data.
1505
1506```bash
1507> leaderdata
1508Partition ID: 1077744240
1509Weighting: 64
1510Data Version: 109
1511Stable Data Version: 211
1512Leader Router ID: 60
1513Done
1514```
1515
1516### leaderweight
1517
1518Get the Thread Leader Weight.
1519
1520```bash
1521> leaderweight
1522128
1523Done
1524```
1525
1526### leaderweight \<weight\>
1527
1528Set the Thread Leader Weight.
1529
1530```bash
1531> leaderweight 128
1532Done
1533```
1534
1535### linkmetrics mgmt \<ipaddr\> enhanced-ack clear
1536
1537Send a Link Metrics Management Request to clear an Enhanced-ACK Based Probing.
1538
1539- ipaddr: Peer address (SHOULD be link local address of the neighboring device).
1540
1541```bash
1542> linkmetrics mgmt fe80:0:0:0:3092:f334:1455:1ad2 enhanced-ack clear
1543Done
1544> Received Link Metrics Management Response from: fe80:0:0:0:3092:f334:1455:1ad2
1545Status: Success
1546```
1547
1548### linkmetrics mgmt \<ipaddr\> enhanced-ack register [qmr][r]
1549
1550Send a Link Metrics Management Request to register an Enhanced-ACK Based Probing.
1551
1552- ipaddr: Peer address.
1553- qmr: This specifies what metrics to query. At most two options are allowed to select (per spec 4.11.3.4.4.6).
1554 - q: Layer 2 LQI.
1555 - m: Link Margin.
1556 - r: RSSI.
1557- 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.
1558
1559```bash
1560> linkmetrics mgmt fe80:0:0:0:3092:f334:1455:1ad2 enhanced-ack register qm
1561Done
1562> Received Link Metrics Management Response from: fe80:0:0:0:3092:f334:1455:1ad2
1563Status: Success
1564
1565> linkmetrics mgmt fe80:0:0:0:3092:f334:1455:1ad2 enhanced-ack register qm r
1566Done
1567> Received Link Metrics Management Response from: fe80:0:0:0:3092:f334:1455:1ad2
1568Status: Cannot support new series
1569```
1570
1571### linkmetrics mgmt \<ipaddr\> forward \<seriesid\> [ldraX][pqmr]
1572
1573Send a Link Metrics Management Request to configure a Forward Tracking Series.
1574
1575- ipaddr: Peer address.
1576- seriesid: The Series ID.
1577- ldraX: This specifies which frames are to be accounted.
1578 - l: MLE Link Probe.
1579 - d: MAC Data.
1580 - r: MAC Data Request.
1581 - a: MAC Ack.
1582 - 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.
1583- pqmr: This specifies what metrics to query.
1584 - p: Layer 2 Number of PDUs received.
1585 - q: Layer 2 LQI.
1586 - m: Link Margin.
1587 - r: RSSI.
1588
1589```bash
1590> linkmetrics mgmt fe80:0:0:0:3092:f334:1455:1ad2 forward 1 dra pqmr
1591Done
1592> Received Link Metrics Management Response from: fe80:0:0:0:3092:f334:1455:1ad2
1593Status: SUCCESS
1594```
1595
1596### linkmetrics probe \<ipaddr\> \<seriesid\> \<length\>
1597
1598Send a MLE Link Probe message to the peer.
1599
1600- ipaddr: Peer address.
1601- seriesid: The Series ID for which this Probe message targets at.
1602- length: The length of the Probe message, valid range: [0, 64].
1603
1604```bash
1605> linkmetrics probe fe80:0:0:0:3092:f334:1455:1ad2 1 10
1606Done
1607```
1608
1609### linkmetrics query \<ipaddr\> single [pqmr]
1610
1611Perform a Link Metrics query (Single Probe).
1612
1613- ipaddr: Peer address.
1614- pqmr: This specifies what metrics to query.
1615- p: Layer 2 Number of PDUs received.
1616- q: Layer 2 LQI.
1617- m: Link Margin.
1618- r: RSSI.
1619
1620```bash
1621> linkmetrics query fe80:0:0:0:3092:f334:1455:1ad2 single qmr
1622Done
1623> Received Link Metrics Report from: fe80:0:0:0:3092:f334:1455:1ad2
1624
1625 - LQI: 76 (Exponential Moving Average)
1626 - Margin: 82 (dB) (Exponential Moving Average)
1627 - RSSI: -18 (dBm) (Exponential Moving Average)
1628```
1629
1630### linkmetrics query \<ipaddr\> forward \<seriesid\>
1631
1632Perform a Link Metrics query (Forward Tracking Series).
1633
1634- ipaddr: Peer address.
1635- seriesid: The Series ID.
1636
1637```bash
1638> linkmetrics query fe80:0:0:0:3092:f334:1455:1ad2 forward 1
1639Done
1640> Received Link Metrics Report from: fe80:0:0:0:3092:f334:1455:1ad2
1641
1642 - PDU Counter: 2 (Count/Summation)
1643 - LQI: 76 (Exponential Moving Average)
1644 - Margin: 82 (dB) (Exponential Moving Average)
1645 - RSSI: -18 (dBm) (Exponential Moving Average)
1646```
1647
1648### locate
1649
1650Gets the current state (`In Progress` or `Idle`) of anycast locator.
1651
1652`OPENTHREAD_CONFIG_TMF_ANYCAST_LOCATOR_ENABLE` is required.
1653
1654```bash
1655> locate
1656Idle
1657Done
1658
1659> locate fdde:ad00:beef:0:0:ff:fe00:fc10
1660
1661> locate
1662In Progress
1663Done
1664```
1665
1666### locate \<anycastaddr\>
1667
1668Locate the closest destination of an anycast address (i.e., find the destination's mesh local EID and RLOC16).
1669
1670`OPENTHREAD_CONFIG_TMF_ANYCAST_LOCATOR_ENABLE` is required.
1671
1672The closest destination is determined based on the the current routing table and path costs within the Thread mesh.
1673
1674Locate the leader using its anycast address:
1675
1676```bash
1677> locate fdde:ad00:beef:0:0:ff:fe00:fc00
1678fdde:ad00:beef:0:d9d3:9000:16b:d03b 0xc800
1679Done
1680```
1681
1682Locate the closest destination of a service anycast address:
1683
1684```bash
1685
1686> srp server enable
1687Done
1688
1689> netdata show
1690Prefixes:
1691Routes:
1692Services:
169344970 5d c002 s c800
169444970 5d c002 s cc00
1695Done
1696
1697> locate fdde:ad00:beef:0:0:ff:fe00:fc10
1698fdde:ad00:beef:0:a477:dc98:a4e4:71ea 0xcc00
1699done
1700```
1701
1702### log filename \<filename\>
1703
1704- Note: Simulation Only, ie: `OPENTHREAD_EXAMPLES_SIMULATION`
1705- Requires `OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_DEBUG_UART`
1706
1707Specifies filename to capture otPlatLog() messages, useful when debugging automated test scripts on Linux when logging disrupts the automated test scripts.
1708
1709### log level
1710
1711Get the log level.
1712
1713```bash
1714> log level
17151
1716Done
1717```
1718
1719### log level \<level\>
1720
1721Set the log level.
1722
1723```bash
1724> log level 4
1725Done
1726```
1727
1728### mliid \<iid\>
1729
1730Set the Mesh Local IID.
1731
1732It must be used before Thread stack is enabled.
1733
1734Only for testing/reference device.
1735
1736```bash
1737> mliid 1122334455667788
1738Done
1739```
1740
1741### mlr reg \<ipaddr\> ... [timeout]
1742
1743Register Multicast Listeners to Primary Backbone Router, with an optional `timeout` (in seconds).
1744
1745Omit `timeout` to use the default MLR timeout on the Primary Backbone Router.
1746
1747Use `timeout = 0` to deregister Multicast Listeners.
1748
1749NOTE: Only for Thread 1.2 Commissioner FTD device.
1750
1751```bash
1752> mlr reg ff04::1
1753status 0, 0 failed
1754Done
1755> mlr reg ff04::1 ff04::2 ff02::1
1756status 2, 1 failed
1757ff02:0:0:0:0:0:0:1
1758Done
1759> mlr reg ff04::1 ff04::2 1000
1760status 0, 0 failed
1761Done
1762> mlr reg ff04::1 ff04::2 0
1763status 0, 0 failed
1764Done
1765```
1766
1767### mode
1768
1769Get the Thread Device Mode value.
1770
1771- -: no flags set (rx-off-when-idle, minimal Thread device, stable network data)
1772- r: rx-on-when-idle
1773- d: Full Thread Device
1774- n: Full Network Data
1775
1776```bash
1777> mode
1778rdn
1779Done
1780```
1781
1782### mode [rdn]
1783
1784Set the Thread Device Mode value.
1785
1786- -: no flags set (rx-off-when-idle, minimal Thread device, stable network data)
1787- r: rx-on-when-idle
1788- d: Full Thread Device
1789- n: Full Network Data
1790
1791```bash
1792> mode rdn
1793Done
1794```
1795
1796```bash
1797> mode -
1798Done
1799```
1800
1801### multiradio
1802
1803Get the list of supported radio links by the device.
1804
1805This command is always available, even when only a single radio is supported by the device.
1806
1807```bash
1808> multiradio
1809[15.4, TREL]
1810Done
1811```
1812
1813### multiradio neighbor list
1814
1815Get the list of neighbors and their supported radios and their preference.
1816
1817This command is only available when device supports more than one radio link.
1818
1819```bash
1820> multiradio neighbor list
1821ExtAddr:3a65bc38dbe4a5be, RLOC16:0xcc00, Radios:[15.4(255), TREL(255)]
1822ExtAddr:17df23452ee4a4be, RLOC16:0x1300, Radios:[15.4(255)]
1823Done
1824```
1825
1826### multiradio neighbor \<ext address\>
1827
1828Get the radio info for specific neighbor with a given extended address.
1829
1830This command is only available when device supports more than one radio link.
1831
1832```bash
1833> multiradio neighbor 3a65bc38dbe4a5be
1834[15.4(255), TREL(255)]
1835Done
1836```
1837
1838### neighbor list
1839
1840List RLOC16 of neighbors.
1841
1842```bash
1843> neighbor list
18440xcc01 0xc800 0xf000
1845Done
1846```
1847
1848### neighbor table
1849
1850Print table of neighbors.
1851
1852```bash
1853> neighbor table
1854| Role | RLOC16 | Age | Avg RSSI | Last RSSI |R|D|N| Extended MAC |
1855+------+--------+-----+----------+-----------+-+-+-+------------------+
1856| C | 0xcc01 | 96 | -46 | -46 |1|1|1| 1eb9ba8a6522636b |
1857| R | 0xc800 | 2 | -29 | -29 |1|1|1| 9a91556102c39ddb |
1858| R | 0xf000 | 3 | -28 | -28 |1|1|1| 0ad7ed6beaa6016d |
1859Done
1860```
1861
1862### netstat
1863
1864List all UDP sockets.
1865
1866```bash
1867> netstat
1868| Local Address | Peer Address |
1869+-------------------------------------------------+-------------------------------------------------+
1870| [0:0:0:0:0:0:0:0]:49153 | [0:0:0:0:0:0:0:0]:0 |
1871| [0:0:0:0:0:0:0:0]:49152 | [0:0:0:0:0:0:0:0]:0 |
1872| [0:0:0:0:0:0:0:0]:61631 | [0:0:0:0:0:0:0:0]:0 |
1873| [0:0:0:0:0:0:0:0]:19788 | [0:0:0:0:0:0:0:0]:0 |
1874Done
1875```
1876
1877### networkdiagnostic get \<addr\> \<type\> ..
1878
1879Send network diagnostic request to retrieve tlv of \<type\>s.
1880
1881If \<addr\> is unicast address, `Diagnostic Get` will be sent. if \<addr\> is multicast address, `Diagnostic Query` will be sent.
1882
1883```bash
1884> networkdiagnostic get fdde:ad00:beef:0:0:ff:fe00:fc00 0 1 6
1885> DIAG_GET.rsp/ans: 00080e336e1c41494e1c01020c000608640b0f674074c503
1886Ext Address: '0e336e1c41494e1c'
1887Rloc16: 0x0c00
1888Leader Data:
1889 PartitionId: 0x640b0f67
1890 Weighting: 64
1891 DataVersion: 116
1892 StableDataVersion: 197
1893 LeaderRouterId: 0x03
1894Done
1895
1896> networkdiagnostic get ff02::1 0 1
1897> DIAG_GET.rsp/ans: 00080e336e1c41494e1c01020c00
1898Ext Address: '0e336e1c41494e1c'
1899Rloc16: 0x0c00
1900Done
1901DIAG_GET.rsp/ans: 00083efcdb7e3f9eb0f201021800
1902Ext Address: '3efcdb7e3f9eb0f2'
1903Rloc16: 0x1800
1904Done
1905```
1906
1907### networkdiagnostic reset \<addr\> \<type\> ..
1908
1909Send network diagnostic request to reset \<addr\>'s tlv of \<type\>s. Currently only `MAC Counters`(9) is supported.
1910
1911```bash
1912> diagnostic reset fd00:db8::ff:fe00:0 9
1913Done
1914```
1915
1916### networkidtimeout
1917
1918Get the NETWORK_ID_TIMEOUT parameter used in the Router role.
1919
1920```bash
1921> networkidtimeout
1922120
1923Done
1924```
1925
1926### networkidtimeout \<timeout\>
1927
1928Set the NETWORK_ID_TIMEOUT parameter used in the Router role.
1929
1930```bash
1931> networkidtimeout 120
1932Done
1933```
1934
1935### networkkey
1936
1937Get the Thread Network Key value.
1938
1939```bash
1940> networkkey
194100112233445566778899aabbccddeeff
1942Done
1943```
1944
1945### networkkey \<key\>
1946
1947Set the Thread Network Key value.
1948
1949```bash
1950> networkkey 00112233445566778899aabbccddeeff
1951Done
1952```
1953
1954### networkname
1955
1956Get the Thread Network Name.
1957
1958```bash
1959> networkname
1960OpenThread
1961Done
1962```
1963
1964### networkname \<name\>
1965
1966Set the Thread Network Name.
1967
1968**NOTE** The current commissioning credential becomes stale after changing this value. Use [pskc](#pskc--p-keypassphrase) to reset.
1969
1970```bash
1971> networkname OpenThread
1972Done
1973```
1974
1975### panid
1976
1977Get the IEEE 802.15.4 PAN ID value.
1978
1979```bash
1980> panid
19810xdead
1982Done
1983```
1984
1985### panid \<panid\>
1986
1987Set the IEEE 802.15.4 PAN ID value.
1988
1989```bash
1990> panid 0xdead
1991Done
1992```
1993
1994### parent
1995
1996Get the diagnostic information for a Thread Router as parent.
1997
1998Note: When operating as a Thread Router, 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.
1999
2000```bash
2001> parent
2002Ext Addr: be1857c6c21dce55
2003Rloc: 5c00
2004Link Quality In: 3
2005Link Quality Out: 3
2006Age: 20
2007Done
2008```
2009
2010### parentpriority
2011
2012Get the assigned parent priority value, -2 means not assigned.
2013
2014```bash
2015> parentpriority
20161
2017Done
2018```
2019
2020### parentpriority \<parentpriority\>
2021
2022Set the assigned parent priority value: 1, 0, -1 or -2.
2023
2024```bash
2025> parentpriority 1
2026Done
2027```
2028
2029### partitionid
2030
2031Get the Thread Network Partition ID.
2032
2033```bash
2034> partitionid
20354294967295
2036Done
2037```
2038
2039### partitionid preferred
2040
2041Get the preferred Thread Leader Partition ID.
2042
2043`OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is required.
2044
2045```bash
2046> partitionid preferred
20474294967295
2048Done
2049```
2050
2051### partitionid preferred \<partitionid\>
2052
2053Set the preferred Thread Leader Partition ID.
2054
2055`OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is required.
2056
2057```bash
2058> partitionid preferred 0xffffffff
2059Done
2060```
2061
2062### ping \[-I source\] \<ipaddr\> \[size\] \[count\] \[interval\] \[hoplimit\] \[timeout\]
2063
2064Send an ICMPv6 Echo Request.
2065
2066- source: The source IPv6 address of the echo request.
2067- size: The number of data bytes to be sent.
2068- count: The number of ICMPv6 Echo Requests to be sent.
2069- interval: The interval between two consecutive ICMPv6 Echo Requests in seconds. The value may have fractional form, for example `0.5`.
2070- hoplimit: The hoplimit of ICMPv6 Echo Request to be sent.
2071- 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`.
2072
2073```bash
2074> ping fd00:db8:0:0:76b:6a05:3ae9:a61a
2075> 16 bytes from fd00:db8:0:0:76b:6a05:3ae9:a61a: icmp_seq=5 hlim=64 time=0ms
20761 packets transmitted, 1 packets received. Packet loss = 0.0%. Round-trip min/avg/max = 0/0.0/0 ms.
2077Done
2078
2079> ping -I fd00:db8:0:0:76b:6a05:3ae9:a61a ff02::1 100 1 1 1
2080> 108 bytes from fd00:db8:0:0:f605:fb4b:d429:d59a: icmp_seq=4 hlim=64 time=7ms
20811 packets transmitted, 1 packets received. Round-trip min/avg/max = 7/7.0/7 ms.
2082Done
2083```
2084
2085### ping stop
2086
2087Stop sending ICMPv6 Echo Requests.
2088
2089```bash
2090> ping stop
2091Done
2092```
2093
2094### pollperiod
2095
2096Get the customized data poll period of sleepy end device (milliseconds). Only for certification test
2097
2098```bash
2099> pollperiod
21000
2101Done
2102```
2103
2104### pollperiod \<pollperiod\>
2105
2106Set the customized data poll period for sleepy end device (milliseconds >= 10ms). Only for certification test
2107
2108```bash
2109> pollperiod 10
2110Done
2111```
2112
2113### pskc [-p] \<key\>|\<passphrase\>
2114
2115With `-p` generate pskc from \<passphrase\> (UTF-8 encoded) together with **current** network name and extended PAN ID, otherwise set pskc as \<key\> (hex format).
2116
2117```bash
2118> pskc 67c0c203aa0b042bfb5381c47aef4d9e
2119Done
2120> pskc -p 123456
2121Done
2122```
2123
2124### preferrouterid \<routerid\>
2125
2126Prefer a Router ID when solicit router id from Leader.
2127
2128```bash
2129> preferrouterid 16
2130Done
2131```
2132
2133### prefix
2134
2135Get 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 preceeding `-` if backbone functionality is disabled.
2136
2137```bash
2138> prefix
21392001:dead:beef:cafe::/64 paros med
2140- fd00:7d03:7d03:7d03::/64 prosD med
2141Done
2142```
2143
2144### prefix add \<prefix\> [padcrosnD][prf]
2145
2146Add a valid prefix to the Network Data.
2147
2148Note: The Domain Prefix flag (`D`) is only available for Thread 1.2.
2149
2150- p: Preferred flag
2151- a: Stateless IPv6 Address Autoconfiguration flag
2152- d: DHCPv6 IPv6 Address Configuration flag
2153- c: DHCPv6 Other Configuration flag
2154- r: Default Route flag
2155- o: On Mesh flag
2156- s: Stable flag
2157- n: Nd Dns flag
2158- D: Domain Prefix flag
2159- prf: Default router preference, which may be 'high', 'med', or 'low'.
2160
2161```bash
2162> prefix add 2001:dead:beef:cafe::/64 paros med
2163Done
2164
2165> prefix add fd00:7d03:7d03:7d03::/64 prosD med
2166Done
2167```
2168
2169### prefix meshlocal
2170
2171Get the mesh local prefix.
2172
2173```bash
2174> prefix meshlocal
2175fdde:ad00:beef:0::/64
2176Done
2177```
2178
2179### prefix meshlocal <prefix>
2180
2181Set the mesh local prefix.
2182
2183```bash
2184> prefix meshlocal fdde:ad00:beef:0::/64
2185Done
2186```
2187
2188### prefix remove \<prefix\>
2189
2190Invalidate a prefix in the Network Data.
2191
2192```bash
2193> prefix remove 2001:dead:beef:cafe::/64
2194Done
2195```
2196
2197### promiscuous
2198
2199Get radio promiscuous property.
2200
2201```bash
2202> promiscuous
2203Disabled
2204Done
2205```
2206
2207### promiscuous enable
2208
2209Enable radio promiscuous operation and print raw packet content.
2210
2211```bash
2212> promiscuous enable
2213Done
2214```
2215
2216### promiscuous disable
2217
2218Disable radio promiscuous operation.
2219
2220```bash
2221> promiscuous disable
2222Done
2223```
2224
2225### radiofilter
2226
2227`OPENTHREAD_CONFIG_MAC_FILTER_ENABLE` is required.
2228
2229The radio filter is mainly intended for testing. It can be used to temporarily block all tx/rx on the IEEE 802.15.4 radio.
2230
2231When 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).
2232
2233Get radio filter status (enabled or disabled).
2234
2235```bash
2236> radiofilter
2237Disabled
2238Done
2239```
2240
2241### radiofilter enable
2242
2243`OPENTHREAD_CONFIG_MAC_FILTER_ENABLE` is required.
2244
2245Enable radio radio filter.
2246
2247```bash
2248> radiofilter enable
2249Done
2250```
2251
2252### radiofilter disable
2253
2254`OPENTHREAD_CONFIG_MAC_FILTER_ENABLE` is required.
2255
2256Disable radio radio filter.
2257
2258```bash
2259> radiofilter disable
2260Done
2261```
2262
2263### rcp
2264
2265RCP-related commands.
2266
2267### region
2268
2269Set the radio region, this can affect the transmit power limit.
2270
2271```bash
2272> region US
2273Done
2274> region
2275US
2276Done
2277```
2278
2279### rcp version
2280
2281Print RCP version string.
2282
2283```bash
2284> rcp version
2285OPENTHREAD/20191113-00825-g82053cc9d-dirty; SIMULATION; Jun 4 2020 17:53:16
2286Done
2287```
2288
2289### releaserouterid \<routerid\>
2290
2291Release a Router ID that has been allocated by the device in the Leader role.
2292
2293```bash
2294> releaserouterid 16
2295Done
2296```
2297
2298### reset
2299
2300Signal a platform reset.
2301
2302```bash
2303> reset
2304```
2305
2306### rloc16
2307
2308Get the Thread RLOC16 value.
2309
2310```bash
2311> rloc16
23120xdead
2313Done
2314```
2315
2316### route
2317
2318Get the external route list in the local Network Data.
2319
2320```bash
2321> route
23222001:dead:beef:cafe::/64 s med
2323Done
2324```
2325
2326### route add \<prefix\> [sn][prf]
2327
2328Add a valid external route to the Network Data.
2329
2330- s: Stable flag
2331- n: NAT64 flag
2332- prf: Default Router Preference, which may be: 'high', 'med', or 'low'.
2333
2334```bash
2335> route add 2001:dead:beef:cafe::/64 s med
2336Done
2337```
2338
2339### route remove \<prefix\>
2340
2341Invalidate a external route in the Network Data.
2342
2343```bash
2344> route remove 2001:dead:beef:cafe::/64
2345Done
2346```
2347
2348### router list
2349
2350List allocated Router IDs.
2351
2352```bash
2353> router list
23548 24 50
2355Done
2356```
2357
2358### router table
2359
2360Print table of routers.
2361
2362```bash
2363> router table
2364| ID | RLOC16 | Next Hop | Path Cost | LQ In | LQ Out | Age | Extended MAC | Link |
2365+----+--------+----------+-----------+-------+--------+-----+------------------+------+
2366| 22 | 0x5800 | 63 | 0 | 0 | 0 | 0 | 0aeb8196c9f61658 | 0 |
2367| 49 | 0xc400 | 63 | 0 | 3 | 3 | 0 | faa1c03908e2dbf2 | 1 |
2368Done
2369```
2370
2371### router \<id\>
2372
2373Print diagnostic information for a Thread Router. The `id` may be a Router ID or an RLOC16.
2374
2375```bash
2376> router 50
2377Alloc: 1
2378Router ID: 50
2379Rloc: c800
2380Next Hop: c800
2381Link: 1
2382Ext Addr: e2b3540590b0fd87
2383Cost: 0
2384Link Quality In: 3
2385Link Quality Out: 3
2386Age: 3
2387Done
2388```
2389
2390```bash
2391> router 0xc800
2392Alloc: 1
2393Router ID: 50
2394Rloc: c800
2395Next Hop: c800
2396Link: 1
2397Ext Addr: e2b3540590b0fd87
2398Cost: 0
2399Link Quality In: 3
2400Link Quality Out: 3
2401Age: 7
2402Done
2403```
2404
2405### routerdowngradethreshold
2406
2407Get the ROUTER_DOWNGRADE_THRESHOLD value.
2408
2409```bash
2410> routerdowngradethreshold
241123
2412Done
2413```
2414
2415### routerdowngradethreshold \<threshold\>
2416
2417Set the ROUTER_DOWNGRADE_THRESHOLD value.
2418
2419```bash
2420> routerdowngradethreshold 23
2421Done
2422```
2423
2424### routereligible
2425
2426Indicates whether the router role is enabled or disabled.
2427
2428```bash
2429> routereligible
2430Enabled
2431Done
2432```
2433
2434### routereligible enable
2435
2436Enable the router role.
2437
2438```bash
2439> routereligible enable
2440Done
2441```
2442
2443### routereligible disable
2444
2445Disable the router role.
2446
2447```bash
2448> routereligible disable
2449Done
2450```
2451
2452### routerselectionjitter
2453
2454Get the ROUTER_SELECTION_JITTER value.
2455
2456```bash
2457> routerselectionjitter
2458120
2459Done
2460```
2461
2462### routerselectionjitter \<jitter\>
2463
2464Set the ROUTER_SELECTION_JITTER value.
2465
2466```bash
2467> routerselectionjitter 120
2468Done
2469```
2470
2471### routerupgradethreshold
2472
2473Get the ROUTER_UPGRADE_THRESHOLD value.
2474
2475```bash
2476> routerupgradethreshold
247716
2478Done
2479```
2480
2481### routerupgradethreshold \<threshold\>
2482
2483Set the ROUTER_UPGRADE_THRESHOLD value.
2484
2485```bash
2486> routerupgradethreshold 16
2487Done
2488```
2489
2490### scan \[channel\]
2491
2492Perform an IEEE 802.15.4 Active Scan.
2493
2494- channel: The channel to scan on. If no channel is provided, the active scan will cover all valid channels.
2495
2496```bash
2497> scan
2498| PAN | MAC Address | Ch | dBm | LQI |
2499+------+------------------+----+-----+-----+
2500| ffff | f1d92a82c8d8fe43 | 11 | -20 | 0 |
2501Done
2502```
2503
2504### scan energy \[duration\] \[channel\]
2505
2506Perform an IEEE 802.15.4 Energy Scan.
2507
2508- duration: The time in milliseconds to spend scanning each channel.
2509
2510```bash
2511> scan energy 10
2512| Ch | RSSI |
2513+----+------+
2514| 11 | -59 |
2515| 12 | -62 |
2516| 13 | -67 |
2517| 14 | -61 |
2518| 15 | -87 |
2519| 16 | -86 |
2520| 17 | -86 |
2521| 18 | -52 |
2522| 19 | -58 |
2523| 20 | -82 |
2524| 21 | -76 |
2525| 22 | -82 |
2526| 23 | -74 |
2527| 24 | -81 |
2528| 25 | -88 |
2529| 26 | -71 |
2530Done
2531```
2532
2533```bash
2534> scan energy 10 20
2535| Ch | RSSI |
2536+----+------+
2537| 20 | -82 |
2538Done
2539```
2540
2541### service
2542
2543Module for controlling service registration in Network Data. Each change in service registration must be sent to leader by `netdata register` command before taking effect.
2544
2545### service add \<enterpriseNumber\> \<serviceData\> \<serverData\>
2546
2547Add service to the Network Data.
2548
2549- enterpriseNumber: IANA enterprise number
2550- serviceData: hex-encoded binary service data
2551- serverData: hex-encoded binary server data
2552
2553```bash
2554> service add 44970 112233 aabbcc
2555Done
2556> netdata register
2557Done
2558```
2559
2560### service remove \<enterpriseNumber\> \<serviceData\>
2561
2562Remove service from Network Data.
2563
2564- enterpriseNumber: IANA enterprise number
2565- serviceData: hext-encoded binary service data
2566
2567```bash
2568> service remove 44970 112233
2569Done
2570> netdata register
2571Done
2572```
2573
2574### singleton
2575
2576Return true when there are no other nodes in the network, otherwise return false.
2577
2578```bash
2579> singleton
2580true or false
2581Done
2582```
2583
2584### sntp query \[SNTP server IP\] \[SNTP server port\]
2585
2586Send SNTP Query to obtain current unix epoch time (from 1st January 1970). The latter two parameters have following default values:
2587
2588- NTP server IP: 2001:4860:4806:8:: (Google IPv6 NTP Server)
2589- NTP server port: 123
2590
2591```bash
2592> sntp query
2593> SNTP response - Unix time: 1540894725 (era: 0)
2594```
2595
2596You can use NAT64 of OpenThread Border Router to reach e.g. Google IPv4 NTP Server:
2597
2598```bash
2599> sntp query 64:ff9b::d8ef:2308
2600> SNTP response - Unix time: 1540898611 (era: 0)
2601```
2602
2603### state
2604
2605Return state of current state.
2606
2607```bash
2608> state
2609offline, disabled, detached, child, router or leader
2610Done
2611```
2612
2613### state <state>
2614
2615Try to switch to state `detached`, `child`, `router` or `leader`.
2616
2617```bash
2618> state leader
2619Done
2620```
2621
2622### thread start
2623
2624Enable Thread protocol operation and attach to a Thread network.
2625
2626```bash
2627> thread start
2628Done
2629```
2630
2631### thread stop
2632
2633Disable Thread protocol operation and detach from a Thread network.
2634
2635```bash
2636> thread stop
2637Done
2638```
2639
2640### thread version
2641
2642Get the Thread Version number.
2643
2644```bash
2645> thread version
26462
2647Done
2648```
2649
2650### trel
2651
2652Indicate whether TREL radio operation is enabled or not.
2653
2654`OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE` is required for all `trel` sub-commands.
2655
2656```bash
2657> trel
2658Enabled
2659Done
2660```
2661
2662### trel enable
2663
2664Enable TREL operation.
2665
2666```bash
2667> trel enable
2668Done
2669```
2670
2671### trel disable
2672
2673Disable TREL operation.
2674
2675```bash
2676> trel disable
2677Done
2678```
2679
2680### trel filter
2681
2682Indicate whether TREL filter mode is enabled or not
2683
2684When filter mode is enabled, any rx and tx traffic through TREL interface is silently dropped. This is mainly intended for use during testing.
2685
2686```bash
2687> trel filter
2688Disabled
2689Done
2690```
2691
2692### trel filter enable
2693
2694Enable TREL filter mode.
2695
2696```bash
2697> trel filter enable
2698Done
2699```
2700
2701### trel filter disable
2702
2703Disable TREL filter mode.
2704
2705```bash
2706> trel filter disable
2707Done
2708```
2709
2710### trel peers [list]
2711
2712Get the TREL peer table in table format or as a list.
2713
2714```bash
2715> trel peers
2716| No | Ext MAC Address | Ext PAN Id | IPv6 Socket Address |
2717+-----+------------------+------------------+--------------------------------------------------+
2718| 1 | 5e5785ba3a63adb9 | f0d9c001f00d2e43 | [fe80:0:0:0:cc79:2a29:d311:1aea]:9202 |
2719| 2 | ce792a29d3111aea | dead00beef00cafe | [fe80:0:0:0:5c57:85ba:3a63:adb9]:9203 |
2720Done
2721
2722> trel peers list
2723001 ExtAddr:5e5785ba3a63adb9 ExtPanId:f0d9c001f00d2e43 SockAddr:[fe80:0:0:0:cc79:2a29:d311:1aea]:9202
2724002 ExtAddr:ce792a29d3111aea ExtPanId:dead00beef00cafe SockAddr:[fe80:0:0:0:5c57:85ba:3a63:adb9]:9203
2725>>>>>>> [trel] implement new TREL model using DNS-SD
2726Done
2727```
2728
2729### tvcheck enable
2730
2731Enable thread version check when upgrading to router or leader.
2732
2733Note: Thread version check is enabled by default.
2734
2735`OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is required.
2736
2737```bash
2738> tvcheck enable
2739Done
2740```
2741
2742### tvcheck disable
2743
2744Enable thread version check when upgrading to router or leader.
2745
2746Note: Thread version check is enabled by default.
2747
2748`OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is required.
2749
2750```bash
2751> tvcheck disable
2752Done
2753```
2754
2755### txpower
2756
2757Get the transmit power in dBm.
2758
2759```bash
2760> txpower
2761-10 dBm
2762Done
2763```
2764
2765### txpower \<txpower\>
2766
2767Set the transmit power in dBm.
2768
2769```bash
2770> txpower -10
2771Done
2772```
2773
2774### unsecureport add \<port\>
2775
2776Add a port to the allowed unsecured port list.
2777
2778```bash
2779> unsecureport add 1234
2780Done
2781```
2782
2783### unsecureport remove \<port\>
2784
2785Remove a port from the allowed unsecured port list.
2786
2787```bash
2788> unsecureport remove 1234
2789Done
2790```
2791
2792### unsecureport remove all
2793
2794Remove all ports from the allowed unsecured port list.
2795
2796```bash
2797> unsecureport remove all
2798Done
2799```
2800
2801### unsecureport get
2802
2803Print all ports from the allowed unsecured port list.
2804
2805```bash
2806> unsecureport get
28071234
2808Done
2809```
2810
2811### uptime
2812
2813This command requires `OPENTHREAD_CONFIG_UPTIME_ENABLE` to be enabled.
2814
2815Print the OpenThread stack uptime (duration since OpenThread stack initialization).
2816
2817```bash
2818> uptime
281912:46:35.469
2820Done
2821>
2822```
2823
2824### uptime ms
2825
2826This command requires `OPENTHREAD_CONFIG_UPTIME_ENABLE` to be enabled.
2827
2828Print the OpenThread stack uptime in msec.
2829
2830```bash
2831> uptime ms
2832426238
2833Done
2834>
2835```
2836
2837### version
2838
2839Print the build version information.
2840
2841```bash
2842> version
2843OPENTHREAD/gf4f2f04; Jul 1 2016 17:00:09
2844Done
2845```
2846
2847### version api
2848
2849Print API version number.
2850
2851```bash
2852> version api
285328
2854Done
2855```
2856
2857### mac retries direct
2858
2859Get the number of direct TX retries on the MAC layer.
2860
2861```bash
2862> mac retries direct
28633
2864Done
2865```
2866
2867### mac retries direct \<number\>
2868
2869Set the number of direct TX retries on the MAC layer.
2870
2871```bash
2872> mac retries direct 5
2873Done
2874```
2875
2876### mac retries indirect
2877
2878Get the number of indirect TX retries on the MAC layer.
2879
2880```bash
2881> mac retries indirect
28823
2883Done
2884```
2885
2886### mac retries indirect \<number\>
2887
2888Set the number of indirect TX retries on the MAC layer.
2889
2890```bash
2891> mac retries indirect 5
2892Done
2893```
2894
2895### mac send \<op\>
2896
2897Instruct 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.
2898
2899```bash
2900> mac send datarequest
2901Done
2902```
2903
2904```bash
2905> mac send emptydata
2906Done
2907```
2908
2909### macfilter
2910
2911List the macfilter status, including address and received signal strength filter settings.
2912
2913```bash
2914> macfilter
2915Address Mode: Allowlist
29160f6127e33af6b403 : rss -95 (lqi 1)
29170f6127e33af6b402
2918RssIn List:
29190f6127e33af6b403 : rss -95 (lqi 1)
2920Default rss : -50 (lqi 3)
2921Done
2922```
2923
2924### macfilter addr
2925
2926List the address filter status.
2927
2928```bash
2929> macfilter addr
2930Allowlist
29310f6127e33af6b403 : rss -95 (lqi 1)
29320f6127e33af6b402
2933Done
2934```
2935
2936### macfilter addr disable
2937
2938Disable address filter mode.
2939
2940```bash
2941> macfilter addr disable
2942Done
2943```
2944
2945### macfilter addr allowlist
2946
2947Enable allowlist address filter mode.
2948
2949```bash
2950> macfilter addr allowlist
2951Done
2952```
2953
2954### macfilter addr denylist
2955
2956Enable denylist address filter mode.
2957
2958```bash
2959> macfilter addr denylist
2960Done
2961```
2962
2963### macfilter addr add \<extaddr\> \[rss\]
2964
2965Add an IEEE 802.15.4 Extended Address to the address filter, and fixed the received singal strength for the messages from the address if rss is specified.
2966
2967```bash
2968> macfilter addr add 0f6127e33af6b403 -95
2969Done
2970```
2971
2972```bash
2973> macfilter addr add 0f6127e33af6b402
2974Done
2975```
2976
2977### macfilter addr remove \<extaddr\>
2978
2979Remove the IEEE802.15.4 Extended Address from the address filter.
2980
2981```bash
2982> macfilter addr remove 0f6127e33af6b402
2983Done
2984```
2985
2986### macfilter addr clear
2987
2988Clear all the IEEE802.15.4 Extended Addresses from the address filter.
2989
2990```bash
2991> macfilter addr clear
2992Done
2993```
2994
2995### macfilter rss
2996
2997List the rss filter status
2998
2999```bash
3000> macfilter rss
30010f6127e33af6b403 : rss -95 (lqi 1)
3002Default rss: -50 (lqi 3)
3003Done
3004```
3005
3006### macfilter rss add \<extaddr\> \<rss\>
3007
3008Set 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.
3009
3010```bash
3011> macfilter rss add * -50
3012Done
3013```
3014
3015```bash
3016> macfilter rss add 0f6127e33af6b404 -85
3017Done
3018```
3019
3020### macfilter rss add-lqi \<extaddr\> \<lqi\>
3021
3022Set 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
3023
3024```bash
3025> macfilter rss add-lqi * 3
3026Done
3027```
3028
3029```bash
3030> macfilter rss add 0f6127e33af6b404 2
3031Done
3032```
3033
3034### macfilter rss remove \<extaddr\>
3035
3036Removes 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.
3037
3038```bash
3039> macfilter rss remove *
3040Done
3041```
3042
3043```bash
3044> macfilter rss remove 0f6127e33af6b404
3045Done
3046```
3047
3048### macfilter rss clear
3049
3050Clear all the received signal strength or received link quality settings.
3051
3052```bash
3053> macfilter rss clear
3054Done
3055```
3056
3057### diag
3058
3059Factory Diagnostics module is enabled only when building OpenThread with `OPENTHREAD_CONFIG_DIAG_ENABLE=1` option. Go [diagnostics module][diag] for more information.
3060
3061[diag]: ../../src/core/diags/README.md
3062
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- [post](#post-uri-path-type-payload)
91- [psk](#psk-psk-pskid)
92- [put](#put-uri-path-type-payload)
93- [resource](#resource-uri-path)
94- [set](#set-new-content)
95- [start](#start)
96- [stop](#stop)
97- [x509](#x509)
98
99## Command Details
100
101### help
102
103```bash
104> coaps help
105help
106connect
107delete
108disconnect
109get
110post
111psk
112put
113resource
114set
115start
116stop
117x509
118Done
119```
120
121List the CoAPS CLI commands.
122
123### connect \<address\>
124
125Establish DTLS session.
126
127- address: IPv6 address of the peer.
128
129```bash
130> coaps connect fdde:ad00:beef:0:9903:14b:27e0:5744
131Done
132coaps connected
133```
134
135### delete \<uri-path\> \[type\] \[payload\]
136
137- uri-path: URI path of the resource.
138- type: "con" for Confirmable or "non-con" for Non-confirmable (default).
139- payload: CoAPS request payload.
140
141```bash
142> coaps delete test-resource con payload
143Done
144```
145
146### disconnect
147
148```bash
149> coaps disconnect
150coaps disconnected
151Done
152```
153
154### get \<uri-path\> \[type\]
155
156- uri-path: URI path of the resource.
157- 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")
158
159```bash
160> coaps get test-resource
161Done
162```
163
164```bash
165> coaps get test-resource block-1024
166Done
167```
168
169### post \<uri-path\> \[type\] \[payload\]
170
171- uri-path: URI path of the resource.
172- 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")
173- payload: CoAP request payload. If \[type\] is "block-<block-size>", the amount of blocks to be sent can be set here.
174
175```bash
176> coaps post test-resource con payload
177Done
178```
179
180```bash
181> coaps post test-resource block-1024 10
182Done
183```
184
185### psk \<psk\> \<pskid\>
186
187Set DTLS ciphersuite to `TLS_PSK_WITH_AES_128_CCM_8`.
188
189- psk: pre-shared key
190- pskid: pre-shared key identifier
191
192```bash
193> coaps psk 123 pskid
194Done
195```
196
197### put \<uri-path\> \[type\] \[payload\]
198
199- uri-path: URI path of the resource.
200- 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")
201- payload: CoAP request payload. If \[type\] is "block-<block-size>", the amount of blocks to be sent can be set here.
202
203```bash
204> coaps put test-resource con payload
205Done
206```
207
208```bash
209> coaps put test-resource block-1024 10
210Done
211```
212
213### resource \[uri-path\]
214
215Sets the URI path for the test resource.
216
217```bash
218> coaps resource test-resource
219Done
220> coaps resource
221test-resource
222Done
223```
224
225### set \[new-content\]
226
227Sets the content sent by the test resource.
228
229```bash
230> coaps set Testing123
231Done
232```
233
234### start
235
236Starts the application coaps service.
237
238- checkPeerCert: Peer Certificate Check can be disabled by typing false.
239
240```bash
241> coaps start
242Done
243```
244
245### stop
246
247Stops the application coaps service.
248
249```bash
250> coaps stop
251Done
252```
253
254### x509
255
256Set DTLS ciphersuite to `TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8`.
257
258The X.509 certificate stored in [`src/cli/x509_cert_key.hpp`](x509_cert_key.hpp).
259
260```bash
261> coaps x509
262Done
263```
264
README_COMMISSIONER.md
1# OpenThread CLI - Commissioner
2
3## Quick Start
4
5See [README_COMMISSIONING.md](README_COMMISSIONING.md).
6
7## Command List
8
9- [help](#help)
10- [announce](#announce)
11- [energy](#energy)
12- [joiner add](#joiner-add)
13- [joiner remove](#joiner-remove)
14- [joiner table](#joiner-table)
15- [mgmtget](#mgmtget)
16- [mgmtset](#mgmtset)
17- [panid](#panid)
18- [provisioningurl](#provisioningurl)
19- [sessionid](#sessionid)
20- [start](#start)
21- [state](#state)
22- [stop](#stop)
23
24## Command Details
25
26### help
27
28Usage: `commissioner help`
29
30Print commissioner help menu.
31
32```bash
33> commissioner help
34help
35announce
36energy
37joiner
38mgmtget
39mgmtset
40panid
41provisioningurl
42sessionid
43start
44stop
45Done
46```
47
48### announce
49
50Usage: `commissioner announce <mask> <count> <period> <destination>`
51
52Send a `MGMT_ANNOUNCE_BEGIN` message.
53
54- mask: Bitmask identifying channels to send MLE Announce messages.
55- count: Number of MLE Announce transmissions per channel.
56- period: Period between successive MLE Announce transmissions (milliseconds).
57- destination: IPv6 destination for the message (may be multicast).
58
59```bash
60> commissioner announce 0x00050000 2 32 fdde:ad00:beef:0:0:ff:fe00:c00
61Done
62```
63
64### energy
65
66Usage: `commissioner energy <mask> <count> <period> <scanDuration> <destination>`
67
68Send a `MGMT_ED_SCAN` message.
69
70- mask: Bitmask identifying channels to perform IEEE 802.15.4 ED Scans.
71- count: Number of IEEE 802.15.4 ED Scans per channel.
72- period: Period between successive IEEE 802.15.4 ED Scans (milliseconds).
73- scanDuration: IEEE 802.15.4 ScanDuration to use when performing an IEEE 802.15.4 ED Scan (milliseconds).
74- destination: IPv6 destination for the message (may be multicast).
75
76The contents of `MGMT_ED_REPORT` messages (i.e. Channel Mask and Energy List) are printed as they are received.
77
78```bash
79> commissioner energy 0x00050000 2 32 1000 fdde:ad00:beef:0:0:ff:fe00:c00
80Done
81Energy: 00050000 0 0 0 0
82```
83
84### joiner add
85
86Usage: `commissioner joiner add <eui64>|<discerner> <pskd> [timeout]`
87
88Add a Joiner entry.
89
90- eui64: The IEEE EUI-64 of the Joiner or '\*' to match any Joiner.
91- discerner: The Joiner discerner in format `number/length`.
92- pskd: Pre-Shared Key for the Joiner.
93- timeout: joiner timeout in seconds.
94
95```bash
96> commissioner joiner add d45e64fa83f81cf7 J01NME
97Done
98```
99
100```bash
101> commissioner joiner add 0xabc/12 J01NME
102Done
103```
104
105### joiner remove
106
107Usage: `commissioner joiner remove <eui64>|<discerner>`
108
109Remove a Joiner entry.
110
111- eui64: The IEEE EUI-64 of the Joiner or '\*' to match any Joiner.
112- discerner: The Joiner discerner in format `number/length`.
113
114```bash
115> commissioner joiner remove d45e64fa83f81cf7
116Done
117```
118
119```bash
120> commissioner joiner remove 0xabc/12
121Done
122```
123
124### joiner table
125
126Usage: `commissioner joiner table`
127
128List all Joiner entries.
129
130```bash
131> commissioner joiner table
132| ID | PSKd | Expiration |
133+-----------------------+----------------------------------+------------+
134| * | J01NME | 81015 |
135| d45e64fa83f81cf7 | J01NME | 101204 |
136| 0x0000000000000abc/12 | J01NME | 114360 |
137Done
138```
139
140### mgmtget
141
142Usage: `commissioner mgmtget [locator] [sessionid] [steeringdata] [joinerudpport] [-x <TLV Types>]`
143
144Send a `MGMT_GET` message to the Leader.
145
146```bash
147> commissioner mgmtget locator sessionid
148Done
149```
150
151### mgmtset
152
153Usage: `commissioner mgmtset [locator <locator>] [sessionid <sessionid>] [steeringdata <steeringdata>] [joinerudpport <joinerudpport>] [-x <TLVs>]`
154
155Send a `MGMT_SET` message to the Leader.
156
157```bash
158> commissioner mgmtset joinerudpport 9988
159Done
160```
161
162### panid
163
164Usage: `commissioner panid <panid> <mask> <destination>`
165
166Send a `MGMT_PANID_QUERY` message.
167
168- panid: PAN ID to check for conflicts.
169- mask: Bitmask identifying channels to perform IEEE 802.15.4 Active Scans.
170- destination: IPv6 destination for the message (may be multicast).
171
172The contents of `MGMT_PANID_CONFLICT` messages (i.e. PAN ID and Channel Mask) are printed as they are received.
173
174```bash
175> commissioner panid 0xdead 0x7fff800 fdde:ad00:beef:0:0:ff:fe00:c00
176Done
177Conflict: dead, 00000800
178```
179
180### provisioningurl
181
182Usage: `commissioner provisioningurl <provisioningurl>`
183
184Set the Provisioning URL.
185
186```bash
187> commissioner provisioningurl http://github.com/openthread/openthread
188Done
189```
190
191### sessionid
192
193Usage: `commissioner sessionid`
194
195Get current commissioner session id.
196
197```bash
198> commissioner sessionid
1990
200Done
201```
202
203### id
204
205Usage: `commissioner id`
206
207Get the commissioner id.
208
209```bash
210> commissioner id
211OpenThread Commissioner
212Done
213```
214
215### id \<name\>
216
217Set the commissioner id.
218
219```bash
220> commissioner id "Custom Commissioner Id"
221Done
222```
223
224### start
225
226Usage: `commissioner start`
227
228Start the Commissioner role.
229
230This command will cause the device to send `LEAD_PET` and `LEAD_KA` messages.
231
232```bash
233> commissioner start
234Commissioner: petitioning
235Done
236Commissioner: active
237```
238
239### state
240
241Usage: `commissioner state`
242
243Get Commissioner state.
244
245This command will return the current Commissioner state.
246
247```bash
248> commissioner state
249active
250Done
251```
252
253### stop
254
255Usage: `commissioner stop`
256
257Stop the Commissioner role.
258
259This command will cause the device to send `LEAD_KA[Reject]` messages.
260
261```bash
262> commissioner stop
263Done
264```
265
README_COMMISSIONING.md
1# OpenThread CLI - Commissioning
2
3## Quick Start
4
5### Form Network
6
7Form a network with the device that has Commissioner support.
8
91. Generate and view new network configuration.
10
11 ```bash
12 > dataset init new
13 Done
14 > dataset
15 Active Timestamp: 1
16 Channel: 13
17 Channel Mask: 0x07fff800
18 Ext PAN ID: d63e8e3e495ebbc3
19 Mesh Local Prefix: fd3d:b50b:f96d:722d::/64
20 Network Key: dfd34f0f05cad978ec4e32b0413038ff
21 Network Name: OpenThread-8f28
22 PAN ID: 0x8f28
23 PSKc: c23a76e98f1a6483639b1ac1271e2e27
24 Security Policy: 0, onrc
25 Done
26 ```
27
282. Commit new dataset to the Active Operational Dataset in non-volatile storage.
29
30 ```bash
31 dataset commit active
32 Done
33 ```
34
353. Enable Thread interface
36
37 ```bash
38 > ifconfig up
39 Done
40 > thread start
41 Done
42 ```
43
44### Obtain Joiner IEEE EUI-64
45
461. Start the Joiner node and obtain the Joiner's IEEE EUI-64.
47
48 ```bash
49 > eui64
50 18b4300000000002
51 Done
52 ```
53
54### Start Commissioner
55
561. Start the Commissioner Role
57
58 ```bash
59 > commissioner start
60 Commissioner: petitioning
61 Done
62 Commissioner: active
63 ```
64
652. Add the Joiner with the device-specific pre-shared key (PSKd)
66
67 ```bash
68 > commissioner joiner add 18b4300000000002 J01NME
69 Done
70 ```
71
72### Start Joiner
73
741. Factory reset the device.
75
76 ```bash
77 > factoryreset
78 ```
79
802. Start the Joiner process.
81
82 ```bash
83 > ifconfig up
84 Done
85 > joiner start J01NME
86 Done
87 Join success
88 ```
89
903. Attach to Thread network
91
92 ```bash
93 > thread start
94 Done
95 ```
96
974. After successful attach, validate the device has the same Active Operational Dataset as above.
98
99 ```bash
100 > dataset active
101 Active Timestamp: 1
102 Channel: 13
103 Channel Mask: 0x07fff800
104 Ext PAN ID: d63e8e3e495ebbc3
105 Mesh Local Prefix: fd3d:b50b:f96d:722d::/64
106 Network Key: dfd34f0f05cad978ec4e32b0413038ff
107 Network Name: OpenThread-8f28
108 PAN ID: 0x8f28
109 PSKc: c23a76e98f1a6483639b1ac1271e2e27
110 Security Policy: 0, onrc
111 Done
112 ```
113
114## CLI Reference
115
116- [Commissioner CLI Reference](README_COMMISSIONER.md)
117- [Joiner CLI Reference](README_JOINER.md)
118
README_DATASET.md
1# OpenThread CLI - Operational Datasets
2
3## Overview
4
5Thread network configuration parameters are managed using Active and Pending Operational Dataset objects.
6
7### Active Operational Dataset
8
9The Active Operational Dataset includes parameters that are currently in use across an entire Thread network. The Active Operational Dataset contains:
10
11- Active Timestamp
12- Channel
13- Channel Mask
14- Extended PAN ID
15- Mesh-Local Prefix
16- Network Name
17- PAN ID
18- PSKc
19- Security Policy
20
21### Pending Operational Dataset
22
23The Pending Operational Dataset is used to communicate changes to the Active Operational Dataset before they take effect. The Pending Operational Dataset contains all the parameters from the Active Operational Dataset, with the addition of:
24
25- Delay Timer
26- Pending Timestamp
27
28## Quick Start
29
30### Form Network
31
321. Generate and view new network configuration.
33
34 ```bash
35 > dataset init new
36 Done
37 > dataset
38 Active Timestamp: 1
39 Channel: 13
40 Channel Mask: 0x07fff800
41 Ext PAN ID: d63e8e3e495ebbc3
42 Mesh Local Prefix: fd3d:b50b:f96d:722d::/64
43 Network Key: dfd34f0f05cad978ec4e32b0413038ff
44 Network Name: OpenThread-8f28
45 PAN ID: 0x8f28
46 PSKc: c23a76e98f1a6483639b1ac1271e2e27
47 Security Policy: 0, onrc
48 Done
49 ```
50
512. Commit new dataset to the Active Operational Dataset in non-volatile storage.
52
53 ```bash
54 dataset commit active
55 Done
56 ```
57
583. Enable Thread interface
59
60 ```bash
61 > ifconfig up
62 Done
63 > thread start
64 Done
65 ```
66
67### Attach to Existing Network
68
69Only the Network Key is required for a device to attach to a Thread network.
70
71While not required, specifying the channel avoids the need to search across multiple channels, improving both latency and efficiency of the attach process.
72
73After the device successfully attaches to a Thread network, the device will retrieve the complete Active Operational Dataset.
74
751. Create a partial Active Operational Dataset.
76
77 ```bash
78 > dataset networkkey dfd34f0f05cad978ec4e32b0413038ff
79 Done
80 > dataset commit active
81 Done
82 ```
83
842. Enable Thread interface.
85
86 ```bash
87 > ifconfig up
88 Done
89 > thread start
90 Done
91 ```
92
933. After attaching, validate that the device received the complete Active Operational Dataset.
94
95 ```bash
96 > dataset active
97 Active Timestamp: 1
98 Channel: 13
99 Channel Mask: 0x07fff800
100 Ext PAN ID: d63e8e3e495ebbc3
101 Mesh Local Prefix: fd3d:b50b:f96d:722d::/64
102 Network Key: dfd34f0f05cad978ec4e32b0413038ff
103 Network Name: OpenThread-8f28
104 PAN ID: 0x8f28
105 PSKc: c23a76e98f1a6483639b1ac1271e2e27
106 Security Policy: 0, onrc
107 Done
108 ```
109
110## Command List
111
112- [help](#help)
113- [active](#active)
114- [activetimestamp](#activetimestamp)
115- [channel](#channel)
116- [channelmask](#channelmask)
117- [clear](#clear)
118- [commit](#commit)
119- [delay](#delay)
120- [extpanid](#extpanid)
121- [init](#init)
122- [meshlocalprefix](#meshlocalprefix)
123- [mgmtgetcommand](#mgmtgetcommand)
124- [mgmtsetcommand](#mgmtsetcommand)
125- [networkkey](#networkkey)
126- [networkname](#networkname)
127- [panid](#panid)
128- [pending](#pending)
129- [pendingtimestamp](#pendingtimestamp)
130- [pskc](#pskc)
131- [securitypolicy](#securitypolicy)
132
133## Command Details
134
135### help
136
137Usage: `dataset help`
138
139Print dataset help menu.
140
141```bash
142> dataset help
143help
144active
145activetimestamp
146channel
147channelmask
148clear
149commit
150delay
151extpanid
152init
153meshlocalprefix
154mgmtgetcommand
155mgmtsetcommand
156networkkey
157networkname
158panid
159pending
160pendingtimestamp
161pskc
162securitypolicy
163Done
164```
165
166### active
167
168Usage: `dataset active [-x]`
169
170Print Active Operational Dataset in human-readable form.
171
172```bash
173> dataset active
174Active Timestamp: 1
175Channel: 13
176Channel Mask: 0x07fff800
177Ext PAN ID: d63e8e3e495ebbc3
178Mesh Local Prefix: fd3d:b50b:f96d:722d::/64
179Network Key: dfd34f0f05cad978ec4e32b0413038ff
180Network Name: OpenThread-8f28
181PAN ID: 0x8f28
182PSKc: c23a76e98f1a6483639b1ac1271e2e27
183Security Policy: 0, onrc
184Done
185```
186
187Print Active Operational Dataset as hex-encoded TLVs.
188
189```bash
190> dataset active -x
1910e080000000000010000000300001035060004001fffe002084eb74ab03c56e6d00708fdc7fe165c83a67805108e2104f183e698da87e96efc1e45aa51030f4f70656e5468726561642d383631310102861104108d6273023d82c841eff0e68db86f35740c030000ff
192Done
193```
194
195### activetimestamp
196
197Usage: `dataset activetimestamp [timestamp]`
198
199Get active timestamp seconds.
200
201```bash
202> dataset activetimestamp
203123456789
204Done
205```
206
207Set active timestamp seconds.
208
209```bash
210> dataset activetimestamp 123456789
211Done
212```
213
214### channel
215
216Usage: `channel [channel]`
217
218Get channel.
219
220```bash
221> dataset channel
22212
223Done
224```
225
226Set channel.
227
228```bash
229> dataset channel 12
230Done
231```
232
233### channelmask
234
235Usage: `dataset channelmask [channelmask]`
236
237Get channel mask.
238
239```bash
240> dataset channelmask
2410x07fff800
242Done
243```
244
245Set channel mask.
246
247```bash
248> dataset channelmask 0x07fff800
249Done
250```
251
252### clear
253
254Usage: `dataset clear`
255
256Reset operational dataset buffer.
257
258```bash
259> dataset clear
260Done
261```
262
263### commit
264
265Usage: `dataset commit <active|pending>`
266
267Commit operational dataset buffer to active/pending operational dataset.
268
269```bash
270> dataset commit active
271Done
272```
273
274### delay
275
276Usage: `dataset delay [delay]`
277
278Get delay timer value.
279
280```bash
281> dataset delay
2821000
283Done
284```
285
286Set delay timer value.
287
288```bash
289> dataset delay 1000
290Done
291```
292
293### extpanid
294
295Usage: `dataset extpanid [extpanid]`
296
297Get extended panid.
298
299```bash
300> dataset extpanid
301000db80123456789
302Done
303```
304
305Set extended panid.
306
307**NOTE** The commissioning credential in the dataset buffer becomes stale after changing this value. Use [pskc](#pskc) to reset.
308
309```bash
310> dataset extpanid 000db80123456789
311Done
312```
313
314### init
315
316Usage: `dataset init <active|new|pending|tlvs <hex-encoded TLVs>>`
317
318Initialize operational dataset buffer.
319
320```bash
321> dataset init new
322Done
323```
324
325### meshlocalprefix
326
327Usage: `dataset meshlocalprefix [prefix]`
328
329Get mesh local prefix.
330
331```bash
332> dataset meshlocalprefix
333fd00:db8:0:0::/64
334Done
335```
336
337Set mesh local prefix.
338
339```bash
340> dataset meshlocalprefix fd00:db8::
341Done
342```
343
344### mgmtgetcommand
345
346Usage: `dataset mgmtgetcommand <active|pending> [address <destination>] [TLV list] [-x]`
347
348Send MGMT_ACTIVE_GET or MGMT_PENDING_GET.
349
350```bash
351> dataset mgmtgetcommand active address fdde:ad00:beef:0:558:f56b:d688:799 activetimestamp securitypolicy
352Done
353```
354
355### mgmtsetcommand
356
357Usage: `dataset mgmtsetcommand <active|pending> [TLV Type list] [-x]`
358
359Send MGMT_ACTIVE_SET or MGMT_PENDING_SET.
360
361```bash
362> dataset mgmtsetcommand active activetimestamp 123 securitypolicy 1 onrc
363Done
364```
365
366### networkkey
367
368Usage: `dataset networkkey [key]`
369
370Get network key
371
372```bash
373> dataset networkkey
37400112233445566778899aabbccddeeff
375Done
376```
377
378Set network key.
379
380```bash
381> dataset networkkey 00112233445566778899aabbccddeeff
382Done
383```
384
385### networkname
386
387Usage: `dataset networkname [name]`
388
389Get network name.
390
391```bash
392> datset networkname
393OpenThread
394Done
395```
396
397Set network name.
398
399**NOTE** The commissioning credential in the dataset buffer becomes stale after changing this value. Use [pskc](#pskc) to reset.
400
401```bash
402> dataset networkname OpenThread
403Done
404```
405
406### panid
407
408Usage: `dataset panid [panid]`
409
410Get panid.
411
412```bash
413> dataset panid
4140x1234
415Done
416```
417
418Set panid.
419
420```bash
421> dataset panid 0x1234
422Done
423```
424
425### pending
426
427Usage: `dataset pending [-x]`
428
429Print Pending Operational Dataset in human-readable form.
430
431```bash
432> dataset pending
433Pending Timestamp: 2
434Active Timestamp: 15
435Channel: 16
436Channel Mask: 0x07fff800
437Delay: 58706
438Ext PAN ID: d63e8e3e495ebbc3
439Mesh Local Prefix: fd3d:b50b:f96d:722d::/64
440Network Key: dfd34f0f05cad978ec4e32b0413038ff
441Network Name: OpenThread-8f28
442PAN ID: 0x8f28
443PSKc: c23a76e98f1a6483639b1ac1271e2e27
444Security Policy: 0, onrc
445Done
446```
447
448Print Pending Operational Dataset as hex-encoded TLVs.
449
450```bash
451> dataset pending -x
4520e080000000000010000000300001035060004001fffe002084eb74ab03c56e6d00708fdc7fe165c83a67805108e2104f183e698da87e96efc1e45aa51030f4f70656e5468726561642d383631310102861104108d6273023d82c841eff0e68db86f35740c030000ff
453Done
454```
455
456### pendingtimestamp
457
458Usage: `dataset pendingtimestamp [timestamp]`
459
460Get pending timestamp seconds.
461
462```bash
463> dataset pendingtimestamp
464123456789
465Done
466```
467
468Set pending timestamp seconds.
469
470```bash
471> dataset pendingtimestamp 123456789
472Done
473```
474
475### pskc
476
477Usage: `pskc [-p] [<key>|<passphrase>]`
478
479Get pskc.
480
481```bash
482> dataset pskc
48367c0c203aa0b042bfb5381c47aef4d9e
484Done
485```
486
487Set pskc.
488
489With `-p`(**only for FTD**) generate pskc from \<passphrase\> (UTF-8 encoded) together with network name and extended PAN ID in the dataset buffer if set or values in the current stack if not, otherwise set pskc as \<key\> (hex format).
490
491```bash
492> dataset pskc 67c0c203aa0b042bfb5381c47aef4d9e
493Done
494> dataset pskc -p 123456
495Done
496```
497
498### securitypolicy
499
500Usage: `dataset securitypolicy [<rotationtime> [onrcCepR]]`
501
502Get security policy.
503
504```bash
505> dataset securitypolicy
506672 onrc
507Done
508```
509
510Set security policy.
511
512- o: Obtaining the Network Key for out-of-band commissioning is enabled.
513- n: Native Commissioning using PSKc is allowed.
514- r: Thread 1.x Routers are enabled.
515- c: External Commissioner authentication is allowed using PSKc.
516- C: Thread 1.2 Commercial Commissioning is enabled.
517- e: Thread 1.2 Autonomous Enrollment is enabled.
518- p: Thread 1.2 Network Key Provisioning is enabled.
519- R: Non-CCM routers are allowed in Thread 1.2 CCM networks.
520
521```bash
522> dataset securitypolicy 672 onrc
523Done
524```
525
526### set
527
528Usage: `dataset set <active|pending> <dataset>`
529
530Set the Active Operational Dataset using hex-encoded TLVs.
531
532```bash
533dataset set active 0e080000000000010000000300001035060004001fffe002084eb74ab03c56e6d00708fdc7fe165c83a67805108e2104f183e698da87e96efc1e45aa51030f4f70656e5468726561642d383631310102861104108d6273023d82c841eff0e68db86f35740c030000ff
534Done
535```
536
537Set the Pending Operational Dataset using hex-encoded TLVs.
538
539```bash
540dataset set pending 0e080000000000010000000300001035060004001fffe002084eb74ab03c56e6d00708fdc7fe165c83a67805108e2104f183e698da87e96efc1e45aa51030f4f70656e5468726561642d383631310102861104108d6273023d82c841eff0e68db86f35740c030000ff
541Done
542```
543
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- [rx](#rx)
21- [rxtx](#rxtx)
22- [tx](#tx)
23
24## Timestamp Format
25
26Recorded 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.
27
28```bash
29> history netinfo
30| Age | Role | Mode | RLOC16 | Partition ID |
31+----------------------+----------+------+--------+--------------+
32| 02:31:50.628 | leader | rdn | 0x2000 | 151029327 |
33| 02:31:53.262 | detached | rdn | 0xfffe | 0 |
34| 02:31:54.663 | detached | rdn | 0x2000 | 0 |
35Done
36```
37
38For 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`.
39
40Timestamps 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`.
41
42## Command Details
43
44### help
45
46Usage: `history help`
47
48Print SRP client help menu.
49
50```bash
51> history help
52help
53ipaddr
54ipmaddr
55neighbor
56netinfo
57prefix
58route
59rx
60rxtx
61tx
62Done
63>
64```
65
66### ipaddr
67
68Usage `history ipaddr [list] [<num-entries>]`
69
70Print the unicast IPv6 address history. Each entry provides:
71
72- Event: Added or Removed.
73- Address: Unicast address along with its prefix length (in bits).
74- Origin: thread, slaac, dhcp6, or manual.
75- Address Scope.
76- Flags: Preferred, Valid, and RLOC (whether the address is RLOC).
77
78Print the unicast IPv6 address history as table.
79
80```bash
81> history ipaddr
82| Age | Event | Address / PrefixLength | Origin |Scope| P | V | R |
83+----------------------+---------+---------------------------------------------+--------+-----+---+---+---+
84| 00:00:04.991 | Removed | 2001:dead:beef:cafe:c4cb:caba:8d55:e30b/64 | slaac | 14 | Y | Y | N |
85| 00:00:44.647 | Added | 2001:dead:beef:cafe:c4cb:caba:8d55:e30b/64 | slaac | 14 | Y | Y | N |
86| 00:01:07.199 | Added | fd00:0:0:0:0:0:0:1/64 | manual | 14 | Y | Y | N |
87| 00:02:17.885 | Added | fdde:ad00:beef:0:0:ff:fe00:fc00/64 | thread | 3 | N | Y | N |
88| 00:02:17.885 | Added | fdde:ad00:beef:0:0:ff:fe00:5400/64 | thread | 3 | N | Y | Y |
89| 00:02:20.107 | Removed | fdde:ad00:beef:0:0:ff:fe00:5400/64 | thread | 3 | N | Y | Y |
90| 00:02:21.575 | Added | fdde:ad00:beef:0:0:ff:fe00:5400/64 | thread | 3 | N | Y | Y |
91| 00:02:21.575 | Added | fdde:ad00:beef:0:ecea:c4fc:ad96:4655/64 | thread | 3 | N | Y | N |
92| 00:02:23.904 | Added | fe80:0:0:0:3c12:a4d2:fbe0:31ad/64 | thread | 2 | Y | Y | N |
93Done
94```
95
96Print the unicast IPv6 address history as a list (the last 5 entries).
97
98```bash
99> history ipaddr list 5
10000: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
10100: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
10200: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
10300: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
10400: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
105Done
106```
107
108### ipmaddr
109
110Usage `history ipmaddr [list] [<num-entries>]`
111
112Print the multicast IPv6 address history. Each entry provides:
113
114- Event: Subscribed or Unsubscribed.
115- Address: Multicast address.
116- Origin: Thread, or Manual.
117
118Print the multicast IPv6 address history as table.
119
120```bash
121> history ipmaddr
122| Age | Event | Multicast Address | Origin |
123+----------------------+--------------+-----------------------------------------+--------+
124| 00:00:08.592 | Unsubscribed | ff05:0:0:0:0:0:0:1 | Manual |
125| 00:01:25.353 | Subscribed | ff05:0:0:0:0:0:0:1 | Manual |
126| 00:01:54.953 | Subscribed | ff03:0:0:0:0:0:0:2 | Thread |
127| 00:01:54.953 | Subscribed | ff02:0:0:0:0:0:0:2 | Thread |
128| 00:01:59.329 | Subscribed | ff33:40:fdde:ad00:beef:0:0:1 | Thread |
129| 00:01:59.329 | Subscribed | ff32:40:fdde:ad00:beef:0:0:1 | Thread |
130| 00:02:01.129 | Subscribed | ff03:0:0:0:0:0:0:fc | Thread |
131| 00:02:01.129 | Subscribed | ff03:0:0:0:0:0:0:1 | Thread |
132| 00:02:01.129 | Subscribed | ff02:0:0:0:0:0:0:1 | Thread |
133Done
134```
135
136Print the multicast IPv6 address history as a list.
137
138```bash
139> history ipmaddr list
14000:00:25.447 -> event:Unsubscribed address:ff05:0:0:0:0:0:0:1 origin:Manual
14100:01:42.208 -> event:Subscribed address:ff05:0:0:0:0:0:0:1 origin:Manual
14200:02:11.808 -> event:Subscribed address:ff03:0:0:0:0:0:0:2 origin:Thread
14300:02:11.808 -> event:Subscribed address:ff02:0:0:0:0:0:0:2 origin:Thread
14400:02:16.184 -> event:Subscribed address:ff33:40:fdde:ad00:beef:0:0:1 origin:Thread
14500:02:16.184 -> event:Subscribed address:ff32:40:fdde:ad00:beef:0:0:1 origin:Thread
14600:02:17.984 -> event:Subscribed address:ff03:0:0:0:0:0:0:fc origin:Thread
14700:02:17.984 -> event:Subscribed address:ff03:0:0:0:0:0:0:1 origin:Thread
14800:02:17.984 -> event:Subscribed address:ff02:0:0:0:0:0:0:1 origin:Thread
149Done
150```
151
152### neighbor
153
154Usage `history neighbor [list] [<num-entries>]`
155
156Print the neighbor table history. Each entry provides:
157
158- Type: Child or Router
159- Event: Added, Removed, Changed (e.g., mode change).
160- Extended Address
161- RLOC16
162- MLE Link Mode
163- Average RSS (in dBm) of received frames from neighbor at the time the entry was recorded
164
165Print the neighbor history as a table.
166
167```bash
168> history neighbor
169| Age | Type | Event | Extended Address | RLOC16 | Mode | Ave RSS |
170+----------------------+--------+-----------+------------------+--------+------+---------+
171| 00:00:29.233 | Child | Added | ae5105292f0b9169 | 0x8404 | - | -20 |
172| 00:01:38.368 | Child | Removed | ae5105292f0b9169 | 0x8401 | - | -20 |
173| 00:04:27.181 | Child | Changed | ae5105292f0b9169 | 0x8401 | - | -20 |
174| 00:04:51.236 | Router | Added | 865c7ca38a5fa960 | 0x9400 | rdn | -20 |
175| 00:04:51.587 | Child | Removed | 865c7ca38a5fa960 | 0x8402 | rdn | -20 |
176| 00:05:22.764 | Child | Changed | ae5105292f0b9169 | 0x8401 | rn | -20 |
177| 00:06:40.764 | Child | Added | 4ec99efc874a1841 | 0x8403 | r | -20 |
178| 00:06:44.060 | Child | Added | 865c7ca38a5fa960 | 0x8402 | rdn | -20 |
179| 00:06:49.515 | Child | Added | ae5105292f0b9169 | 0x8401 | - | -20 |
180Done
181```
182
183Print the neighbor history as a list.
184
185```bash
186
187> history neighbor list
18800:00:34.753 -> type:Child event:Added extaddr:ae5105292f0b9169 rloc16:0x8404 mode:- rss:-20
18900:01:43.888 -> type:Child event:Removed extaddr:ae5105292f0b9169 rloc16:0x8401 mode:- rss:-20
19000:04:32.701 -> type:Child event:Changed extaddr:ae5105292f0b9169 rloc16:0x8401 mode:- rss:-20
19100:04:56.756 -> type:Router event:Added extaddr:865c7ca38a5fa960 rloc16:0x9400 mode:rdn rss:-20
19200:04:57.107 -> type:Child event:Removed extaddr:865c7ca38a5fa960 rloc16:0x8402 mode:rdn rss:-20
19300:05:28.284 -> type:Child event:Changed extaddr:ae5105292f0b9169 rloc16:0x8401 mode:rn rss:-20
19400:06:46.284 -> type:Child event:Added extaddr:4ec99efc874a1841 rloc16:0x8403 mode:r rss:-20
19500:06:49.580 -> type:Child event:Added extaddr:865c7ca38a5fa960 rloc16:0x8402 mode:rdn rss:-20
19600:06:55.035 -> type:Child event:Added extaddr:ae5105292f0b9169 rloc16:0x8401 mode:- rss:-20
197Done
198```
199
200### netinfo
201
202Usage `history netinfo [list] [<num-entries>]`
203
204Print the Network Info history. Each Network Info provides:
205
206- Device Role
207- MLE Link Mode
208- RLOC16
209- Partition ID
210
211Print the Network Info history as a table.
212
213```bash
214> history netinfo
215| Age | Role | Mode | RLOC16 | Partition ID |
216+----------------------+----------+------+--------+--------------+
217| 00:00:10.069 | router | rdn | 0x6000 | 151029327 |
218| 00:02:09.337 | child | rdn | 0x2001 | 151029327 |
219| 00:02:09.338 | child | rdn | 0x2001 | 151029327 |
220| 00:07:40.806 | child | - | 0x2001 | 151029327 |
221| 00:07:42.297 | detached | - | 0x6000 | 0 |
222| 00:07:42.968 | disabled | - | 0x6000 | 0 |
223Done
224```
225
226Print the Network Info history as a list.
227
228```bash
229> history netinfo list
23000:00:59.467 -> role:router mode:rdn rloc16:0x6000 partition-id:151029327
23100:02:58.735 -> role:child mode:rdn rloc16:0x2001 partition-id:151029327
23200:02:58.736 -> role:child mode:rdn rloc16:0x2001 partition-id:151029327
23300:08:30.204 -> role:child mode:- rloc16:0x2001 partition-id:151029327
23400:08:31.695 -> role:detached mode:- rloc16:0x6000 partition-id:0
23500:08:32.366 -> role:disabled mode:- rloc16:0x6000 partition-id:0
236Done
237```
238
239Print only the latest 2 entries.
240
241```bash
242> history netinfo 2
243| Age | Role | Mode | RLOC16 | Partition ID |
244+----------------------+----------+------+--------+--------------+
245| 00:02:05.451 | router | rdn | 0x6000 | 151029327 |
246| 00:04:04.719 | child | rdn | 0x2001 | 151029327 |
247Done
248```
249
250### prefix
251
252Usage `history prefix [list] [<num-entries>]`
253
254Print the Network Data on mesh prefix history. Each item provides:
255
256- Event (`Added` or `Removed`)
257- Prefix
258- Flags
259- Preference (`high`, `med`, `low`)
260- RLOC16
261
262The flags are as follows:
263
264- `p`: Preferred flag
265- `a`: Stateless IPv6 Address Autoconfiguration flag
266- `d`: DHCPv6 IPv6 Address Configuration flag
267- `c`: DHCPv6 Other Configuration flag
268- `r`: Default Route flag
269- `o`: On Mesh flag
270- `s`: Stable flag
271- `n`: Nd Dns flag
272- `D`: Domain Prefix flag
273
274Print the history as a table.
275
276```bash
277> history prefix
278| Age | Event | Prefix | Flags | Pref | RLOC16 |
279+----------------------+---------+---------------------------------------------+-----------+------+--------+
280| 00:00:10.663 | Added | fd00:1111:2222:3333::/64 | paro | med | 0x5400 |
281| 00:01:02.054 | Removed | fd00:dead:beef:1::/64 | paros | high | 0x5400 |
282| 00:01:21.136 | Added | fd00:abba:cddd:0::/64 | paos | med | 0x5400 |
283| 00:01:45.144 | Added | fd00:dead:beef:1::/64 | paros | high | 0x3c00 |
284| 00:01:50.944 | Added | fd00:dead:beef:1::/64 | paros | high | 0x5400 |
285| 00:01:59.887 | Added | fd00:dead:beef:1::/64 | paros | med | 0x8800 |
286Done
287```
288
289Print the history as a list.
290
291```bash
292> history prefix list
29300:04:12.487 -> event:Added prefix:fd00:1111:2222:3333::/64 flags:paro pref:med rloc16:0x5400
29400:05:03.878 -> event:Removed prefix:fd00:dead:beef:1::/64 flags:paros pref:high rloc16:0x5400
29500:05:22.960 -> event:Added prefix:fd00:abba:cddd:0::/64 flags:paos pref:med rloc16:0x5400
29600:05:46.968 -> event:Added prefix:fd00:dead:beef:1::/64 flags:paros pref:high rloc16:0x3c00
29700:05:52.768 -> event:Added prefix:fd00:dead:beef:1::/64 flags:paros pref:high rloc16:0x5400
29800:06:01.711 -> event:Added prefix:fd00:dead:beef:1::/64 flags:paros pref:med rloc16:0x8800
299```
300
301### prefix
302
303Usage `history route [list] [<num-entries>]`
304
305Print the Network Data external route history. Each item provides:
306
307- Event (`Added` or `Removed`)
308- Route
309- Flags
310- Preference (`high`, `med`, `low`)
311- RLOC16
312
313The flags are as follows:
314
315- `s`: Stable flag
316- `n`: NAT64 flag
317
318Print the history as a table.
319
320```bash
321history route
322| Age | Event | Route | Flags | Pref | RLOC16 |
323+----------------------+---------+---------------------------------------------+-----------+------+--------+
324| 00:00:05.456 | Removed | fd00:1111:0::/48 | s | med | 0x3c00 |
325| 00:00:29.310 | Added | fd00:1111:0::/48 | s | med | 0x3c00 |
326| 00:00:42.822 | Added | fd00:1111:0::/48 | s | med | 0x5400 |
327| 00:01:27.688 | Added | fd00:aaaa:bbbb:cccc::/64 | s | med | 0x8800 |
328Done
329```
330
331Print the history as a list (last two entries).
332
333```bash
334> history route list 2
33500:00:48.704 -> event:Removed route:fd00:1111:0::/48 flags:s pref:med rloc16:0x3c00
33600:01:12.558 -> event:Added route:fd00:1111:0::/48 flags:s pref:med rloc16:0x3c00
337Done
338```
339
340### rx
341
342Usage `history rx [list] [<num-entries>]`
343
344Print the IPv6 message RX history in either table or list format. Entries provide same information and follow same format as in `history rxtx` command.
345
346Print the IPv6 message RX history as a table:
347
348```bash
349> history rx
350| Age | Type | Len | Chksum | Sec | Prio | RSS |Dir | Neighb | Radio |
351+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
352| | UDP | 50 | 0xbd26 | no | net | -20 | RX | 0x4800 | 15.4 |
353| 00:00:07.640 | src: [fe80:0:0:0:d03d:d3e7:cc5e:7cd7]:19788 |
354| | dst: [ff02:0:0:0:0:0:0:1]:19788 |
355+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
356| | HopOpts | 44 | 0x0000 | yes | norm | -20 | RX | 0x4800 | 15.4 |
357| 00:00:09.263 | src: [fdde:ad00:beef:0:0:ff:fe00:4800]:0 |
358| | dst: [ff03:0:0:0:0:0:0:2]:0 |
359+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
360| | UDP | 12 | 0x3f7d | yes | net | -20 | RX | 0x4800 | 15.4 |
361| 00:00:09.302 | src: [fdde:ad00:beef:0:0:ff:fe00:4800]:61631 |
362| | dst: [fdde:ad00:beef:0:0:ff:fe00:4801]:61631 |
363+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
364| | ICMP6(EchoReqst) | 16 | 0x942c | yes | norm | -20 | RX | 0x4800 | 15.4 |
365| 00:00:09.304 | src: [fdde:ad00:beef:0:ac09:a16b:3204:dc09]:0 |
366| | dst: [fdde:ad00:beef:0:dc0e:d6b3:f180:b75b]:0 |
367+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
368| | HopOpts | 44 | 0x0000 | yes | norm | -20 | RX | 0x4800 | 15.4 |
369| 00:00:09.304 | src: [fdde:ad00:beef:0:0:ff:fe00:4800]:0 |
370| | dst: [ff03:0:0:0:0:0:0:2]:0 |
371+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
372| | UDP | 50 | 0x2e37 | no | net | -20 | RX | 0x4800 | 15.4 |
373| 00:00:21.622 | src: [fe80:0:0:0:d03d:d3e7:cc5e:7cd7]:19788 |
374| | dst: [ff02:0:0:0:0:0:0:1]:19788 |
375+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
376| | UDP | 50 | 0xe177 | no | net | -20 | RX | 0x4800 | 15.4 |
377| 00:00:26.640 | src: [fe80:0:0:0:d03d:d3e7:cc5e:7cd7]:19788 |
378| | dst: [ff02:0:0:0:0:0:0:1]:19788 |
379+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
380| | UDP | 165 | 0x82ee | yes | net | -20 | RX | 0x4800 | 15.4 |
381| 00:00:30.000 | src: [fe80:0:0:0:d03d:d3e7:cc5e:7cd7]:19788 |
382| | dst: [fe80:0:0:0:a4a5:bbac:a8e:bd07]:19788 |
383+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
384| | UDP | 93 | 0x52df | no | net | -20 | RX | unknwn | 15.4 |
385| 00:00:30.480 | src: [fe80:0:0:0:d03d:d3e7:cc5e:7cd7]:19788 |
386| | dst: [fe80:0:0:0:a4a5:bbac:a8e:bd07]:19788 |
387+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
388| | UDP | 50 | 0x5ccf | no | net | -20 | RX | unknwn | 15.4 |
389| 00:00:30.772 | src: [fe80:0:0:0:d03d:d3e7:cc5e:7cd7]:19788 |
390| | dst: [ff02:0:0:0:0:0:0:1]:19788 |
391Done
392
393```
394
395Print the latest 5 entries of the IPv6 message RX history as a list:
396
397```bash
398> history rx list 4
39900:00:13.368
400 type:UDP len:50 cheksum:0xbd26 sec:no prio:net rss:-20 from:0x4800 radio:15.4
401 src:[fe80:0:0:0:d03d:d3e7:cc5e:7cd7]:19788
402 dst:[ff02:0:0:0:0:0:0:1]:19788
40300:00:14.991
404 type:HopOpts len:44 cheksum:0x0000 sec:yes prio:norm rss:-20 from:0x4800 radio:15.4
405 src:[fdde:ad00:beef:0:0:ff:fe00:4800]:0
406 dst:[ff03:0:0:0:0:0:0:2]:0
40700:00:15.030
408 type:UDP len:12 cheksum:0x3f7d sec:yes prio:net rss:-20 from:0x4800 radio:15.4
409 src:[fdde:ad00:beef:0:0:ff:fe00:4800]:61631
410 dst:[fdde:ad00:beef:0:0:ff:fe00:4801]:61631
41100:00:15.032
412 type:ICMP6(EchoReqst) len:16 cheksum:0x942c sec:yes prio:norm rss:-20 from:0x4800 radio:15.4
413 src:[fdde:ad00:beef:0:ac09:a16b:3204:dc09]:0
414 dst:[fdde:ad00:beef:0:dc0e:d6b3:f180:b75b]:0
415Done
416```
417
418### rxtx
419
420Usage `history rxtx [list] [<num-entries>]`
421
422Print the combined IPv6 message RX and TX history in either table or list format. Each entry provides:
423
424- IPv6 message type: UDP, TCP, ICMP6 (and its subtype), etc.
425- IPv6 payload length (excludes the IPv6 header).
426- Source IPv6 address and port number.
427- Destination IPv6 address and port number (port number is valid for UDP/TCP, it is zero otherwise).
428- Whether or not link-layer security was used.
429- Message priority: low, norm, high, net (for Thread control messages).
430- Message checksum (valid for UDP, TCP, or ICMP6 message)
431- RSS: Received Signal Strength (in dBm) - averaged over all received fragment frames that formed the message. For TX history `NA` (not applicable) is used.
432- 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.
433- 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.
434- 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).
435
436Print the IPv6 message RX and TX history as a table:
437
438```bash
439> history rxtx
440| Age | Type | Len | Chksum | Sec | Prio | RSS |Dir | Neighb | Radio |
441+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
442| | HopOpts | 44 | 0x0000 | yes | norm | -20 | RX | 0x0800 | 15.4 |
443| 00:00:09.267 | src: [fdde:ad00:beef:0:0:ff:fe00:800]:0 |
444| | dst: [ff03:0:0:0:0:0:0:2]:0 |
445+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
446| | UDP | 12 | 0x6c6b | yes | net | -20 | RX | 0x0800 | 15.4 |
447| 00:00:09.290 | src: [fdde:ad00:beef:0:0:ff:fe00:800]:61631 |
448| | dst: [fdde:ad00:beef:0:0:ff:fe00:801]:61631 |
449+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
450| | ICMP6(EchoReqst) | 16 | 0xc6a2 | yes | norm | -20 | RX | 0x0800 | 15.4 |
451| 00:00:09.292 | src: [fdde:ad00:beef:0:efe8:4910:cf95:dee9]:0 |
452| | dst: [fdde:ad00:beef:0:af4c:3644:882a:3698]:0 |
453+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
454| | ICMP6(EchoReply) | 16 | 0xc5a2 | yes | norm | NA | TX | 0x0800 | 15.4 |
455| 00:00:09.292 | src: [fdde:ad00:beef:0:af4c:3644:882a:3698]:0 |
456| | dst: [fdde:ad00:beef:0:efe8:4910:cf95:dee9]:0 |
457+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
458| | UDP | 50 | 0xaa0d | yes | net | NA | TX | 0x0800 | 15.4 |
459| 00:00:09.294 | src: [fdde:ad00:beef:0:0:ff:fe00:801]:61631 |
460| | dst: [fdde:ad00:beef:0:0:ff:fe00:800]:61631 |
461+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
462| | HopOpts | 44 | 0x0000 | yes | norm | -20 | RX | 0x0800 | 15.4 |
463| 00:00:09.296 | src: [fdde:ad00:beef:0:0:ff:fe00:800]:0 |
464| | dst: [ff03:0:0:0:0:0:0:2]:0 |
465+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
466| | UDP | 50 | 0xc1d8 | no | net | -20 | RX | 0x0800 | 15.4 |
467| 00:00:09.569 | src: [fe80:0:0:0:54d9:5153:ffc6:df26]:19788 |
468| | dst: [ff02:0:0:0:0:0:0:1]:19788 |
469+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
470| | UDP | 50 | 0x3cb1 | no | net | -20 | RX | 0x0800 | 15.4 |
471| 00:00:16.519 | src: [fe80:0:0:0:54d9:5153:ffc6:df26]:19788 |
472| | dst: [ff02:0:0:0:0:0:0:1]:19788 |
473+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
474| | UDP | 50 | 0xeda0 | no | net | -20 | RX | 0x0800 | 15.4 |
475| 00:00:20.599 | src: [fe80:0:0:0:54d9:5153:ffc6:df26]:19788 |
476| | dst: [ff02:0:0:0:0:0:0:1]:19788 |
477+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
478| | UDP | 165 | 0xbdfa | yes | net | -20 | RX | 0x0800 | 15.4 |
479| 00:00:21.059 | src: [fe80:0:0:0:54d9:5153:ffc6:df26]:19788 |
480| | dst: [fe80:0:0:0:8893:c2cc:d983:1e1c]:19788 |
481+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
482| | UDP | 64 | 0x1c11 | no | net | NA | TX | 0x0800 | 15.4 |
483| 00:00:21.062 | src: [fe80:0:0:0:8893:c2cc:d983:1e1c]:19788 |
484| | dst: [fe80:0:0:0:54d9:5153:ffc6:df26]:19788 |
485+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
486| | UDP | 93 | 0xedff | no | net | -20 | RX | unknwn | 15.4 |
487| 00:00:21.474 | src: [fe80:0:0:0:54d9:5153:ffc6:df26]:19788 |
488| | dst: [fe80:0:0:0:8893:c2cc:d983:1e1c]:19788 |
489+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
490| | UDP | 44 | 0xd383 | no | net | NA | TX | bcast | 15.4 |
491| 00:00:21.811 | src: [fe80:0:0:0:8893:c2cc:d983:1e1c]:19788 |
492| | dst: [ff02:0:0:0:0:0:0:2]:19788 |
493Done
494```
495
496Print the latest 5 entries of the IPv6 message RX history as a list:
497
498```bash
499> history rxtx list 5
500
50100:00:02.100
502 type:UDP len:50 cheksum:0xd843 sec:no prio:net rss:-20 from:0x0800 radio:15.4
503 src:[fe80:0:0:0:54d9:5153:ffc6:df26]:19788
504 dst:[ff02:0:0:0:0:0:0:1]:19788
50500:00:15.331
506 type:HopOpts len:44 cheksum:0x0000 sec:yes prio:norm rss:-20 from:0x0800 radio:15.4
507 src:[fdde:ad00:beef:0:0:ff:fe00:800]:0
508 dst:[ff03:0:0:0:0:0:0:2]:0
50900:00:15.354
510 type:UDP len:12 cheksum:0x6c6b sec:yes prio:net rss:-20 from:0x0800 radio:15.4
511 src:[fdde:ad00:beef:0:0:ff:fe00:800]:61631
512 dst:[fdde:ad00:beef:0:0:ff:fe00:801]:61631
51300:00:15.356
514 type:ICMP6(EchoReqst) len:16 cheksum:0xc6a2 sec:yes prio:norm rss:-20 from:0x0800 radio:15.4
515 src:[fdde:ad00:beef:0:efe8:4910:cf95:dee9]:0
516 dst:[fdde:ad00:beef:0:af4c:3644:882a:3698]:0
51700:00:15.356
518 type:ICMP6(EchoReply) len:16 cheksum:0xc5a2 sec:yes prio:norm tx-success:yes to:0x0800 radio:15.4
519 src:[fdde:ad00:beef:0:af4c:3644:882a:3698]:0
520 dst:[fdde:ad00:beef:0:efe8:4910:cf95:dee9]:0
521```
522
523### tx
524
525Usage `history tx [list] [<num-entries>]`
526
527Print the IPv6 message TX history in either table or list format. Entries provide same information and follow same format as in `history rxtx` command.
528
529Print the IPv6 message TX history as a table (10 latest entries):
530
531```bash
532> history tx
533| Age | Type | Len | Chksum | Sec | Prio | RSS |Dir | Neighb | Radio |
534+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
535| | ICMP6(EchoReply) | 16 | 0x932c | yes | norm | NA | TX | 0x4800 | 15.4 |
536| 00:00:18.798 | src: [fdde:ad00:beef:0:dc0e:d6b3:f180:b75b]:0 |
537| | dst: [fdde:ad00:beef:0:ac09:a16b:3204:dc09]:0 |
538+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
539| | UDP | 50 | 0xce87 | yes | net | NA | TX | 0x4800 | 15.4 |
540| 00:00:18.800 | src: [fdde:ad00:beef:0:0:ff:fe00:4801]:61631 |
541| | dst: [fdde:ad00:beef:0:0:ff:fe00:4800]:61631 |
542+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
543| | UDP | 64 | 0xf7ba | no | net | NA | TX | 0x4800 | 15.4 |
544| 00:00:39.499 | src: [fe80:0:0:0:a4a5:bbac:a8e:bd07]:19788 |
545| | dst: [fe80:0:0:0:d03d:d3e7:cc5e:7cd7]:19788 |
546+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
547| | UDP | 44 | 0x26d4 | no | net | NA | TX | bcast | 15.4 |
548| 00:00:40.256 | src: [fe80:0:0:0:a4a5:bbac:a8e:bd07]:19788 |
549| | dst: [ff02:0:0:0:0:0:0:2]:19788 |
550Done
551```
552
553Print the IPv6 message TX history as a list:
554
555```bash
556history tx list
55700:00:23.957
558 type:ICMP6(EchoReply) len:16 cheksum:0x932c sec:yes prio:norm tx-success:yes to:0x4800 radio:15.4
559 src:[fdde:ad00:beef:0:dc0e:d6b3:f180:b75b]:0
560 dst:[fdde:ad00:beef:0:ac09:a16b:3204:dc09]:0
56100:00:23.959
562 type:UDP len:50 cheksum:0xce87 sec:yes prio:net tx-success:yes to:0x4800 radio:15.4
563 src:[fdde:ad00:beef:0:0:ff:fe00:4801]:61631
564 dst:[fdde:ad00:beef:0:0:ff:fe00:4800]:61631
56500:00:44.658
566 type:UDP len:64 cheksum:0xf7ba sec:no prio:net tx-success:yes to:0x4800 radio:15.4
567 src:[fe80:0:0:0:a4a5:bbac:a8e:bd07]:19788
568 dst:[fe80:0:0:0:d03d:d3e7:cc5e:7cd7]:19788
56900:00:45.415
570 type:UDP len:44 cheksum:0x26d4 sec:no prio:net tx-success:yes to:0xffff radio:15.4
571 src:[fe80:0:0:0:a4a5:bbac:a8e:bd07]:19788
572 dst:[ff02:0:0:0:0:0:0:2]:19788
573Done
574```
575
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 inteface.
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- [publish](#publish)
146- [register](#register)
147- [show](#show)
148- [steeringdata](#steeringdata-check-eui64discerner)
149- [unpublish](#unpublish)
150
151## Command Details
152
153### help
154
155Usage: `netdata help`
156
157Print netdata help menu.
158
159```bash
160> netdata help
161help
162publish
163register
164show
165steeringdata
166unpublish
167Done
168```
169
170### publish
171
172The 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.
173
174The Publisher requires `OPENTHREAD_CONFIG_NETDATA_PUBLISHER_ENABLE`.
175
176### publish dnssrp
177
178Publish DNS/SRP service entry.
179
180This command requires `OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE`.
181
182The following formats are available: :
183
184- `netdata publish dnssrp anycast <seq-num>` to publish "DNS/SRP Service Anycast Address" with a given sequence number.
185- `netdata publish dnssrp unicast <address> <port>` to publish "DNS/SRP Service Unicast Address" with given address and port number info. The address/port info is included in Service TLV data.
186- `netdata publish dnssrp unicast <port>` to publish "DNS/SRP Service Unicast Address" with given port number and the device's mesh-local EID for the address. The address and port info is included in Server TLV data.
187
188A 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).
189
190```bash
191> netdata publish dnssrp anycast 1
192Done
193
194> netdata publish dnssrp unicast fd00::1234 51525
195Done
196
197> netdata publish dnssrp unicast 50152
198Done
199```
200
201### publish prefix \<prefix\> [padcrosnD][prf]
202
203Publish an on-mesh prefix entry.
204
205- p: Preferred flag
206- a: Stateless IPv6 Address Autoconfiguration flag
207- d: DHCPv6 IPv6 Address Configuration flag
208- c: DHCPv6 Other Configuration flag
209- r: Default Route flag
210- o: On Mesh flag
211- s: Stable flag
212- n: Nd Dns flag
213- D: Domain Prefix flag (only available for Thread 1.2).
214- prf: Preference, which may be 'high', 'med', or 'low'.
215
216```bash
217> netdata publish prefix fd00:1234:5678::/64 paos med
218Done
219```
220
221### publish route \<prefix\> [sn][prf]
222
223Publish an external route entry.
224
225- s: Stable flag
226- n: NAT64 flag
227- prf: Preference, which may be: 'high', 'med', or 'low'.
228
229```bash
230> netdata publish route fd00:1234:5678::/64 s high
231Done
232```
233
234### register
235
236Usage: `netdata register`
237
238Register configured prefixes, routes, and services with the Leader.
239
240```bash
241> netdata register
242Done
243```
244
245### show
246
247Usage: `netdata show [local] [-x]`
248
249Print Network Data received from the Leader.
250
251```bash
252> netdata show
253Prefixes:
254fd00:dead:beef:cafe::/64 paros med dc00
255Routes:
256Services:
257Done
258```
259
260Print Network Data received from the Leader as hex-encoded TLVs.
261
262```bash
263> netdata show -x
26408040b02174703140040fd00deadbeefcafe0504dc00330007021140
265Done
266```
267
268Print local Network Data to sync with Leader.
269
270```bash
271> netdata show local
272Prefixes:
273fd00:dead:beef:cafe::/64 paros med dc00
274Routes:
275Services:
276Done
277```
278
279Print local Network Data to sync with Leader as hex-encoded TLVs.
280
281```bash
282> netdata show local -x
28308040b02174703140040fd00deadbeefcafe0504dc00330007021140
284Done
285```
286
287### netdata steeringdata check \<eui64\>|\<discerner\>
288
289Check whether the steering data includes a joiner.
290
291- eui64: The IEEE EUI-64 of the Joiner.
292- discerner: The Joiner discerner in format `number/length`.
293
294```bash
295> netdata steeringdata check d45e64fa83f81cf7
296Done
297> netdata steeringdata check 0xabc/12
298Done
299> netdata steeringdata check 0xdef/12
300Error 23: NotFound
301```
302
303### unpublish
304
305This command unpublishes a previously published Network Data entry.
306
307This command requires `OPENTHREAD_CONFIG_NETDATA_PUBLISHER_ENABLE`.
308
309### unpublish dnssrp
310
311Unpublishes DNS/SRP Service entry (available when `OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE` is enabled):
312
313- `netdata unpublish dnssrp` to unpublish "DNS/SRP Service" entry (anycast or unciast).
314
315```bash
316> netdata unpublish dnssrp
317Done
318```
319
320### unpublish \<prefix\>
321
322Unpublishes a previously published on-mesh prefix or external route entry.
323
324```bash
325> netdata unpublish fd00:1234:5678::/64
326Done
327```
328
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
101srp 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 TXT: 00
135 host: my-host.default.service.arpa.
136 addresses: [fded:5114:8263:1fe1:44f9:cc06:4a2d:534]
137Done
138```
139
140Make sure it shows `deleted: false` for both host and service commands.
141
142### Remove the service
143
144A service can be removed through the client node:
145
146```bash
147> srp client service remove my-service _ipps._tcp
148Done
149```
150
151Confirm on the server node that the service has been removed:
152
153```bash
154> srp server service
155my-service._ipps._tcp.default.service.arpa.
156 deleted: true
157Done
158```
159
160The service entry is listed because the name of service is not removed.
161
162### Remove the host and service names
163
164A host and service, along with their names, can be removed through the client node:
165
166```bash
167> srp client host remove 1
168Done
169```
170
171Confirm on the server node that no host or service entries are listed:
172
173```bash
174> srp server host
175Done
176> srp server service
177Done
178>
179```
180
181## CLI Reference
182
183- [SRP Client CLI Reference](README_SRP_CLIENT.md)
184- [SRP Server CLI Reference](README_SRP_SERVER.md)
185
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 Thread netif unicast addresses excluding all link-local and mesh-local addresses. If there is no valid 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).
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_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 1, you should see a printout on node 1 similar to below:
35
36```bash
37TCP: Connection established
38```
39
40In addition, you should also see a printout on node 2 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 1, you should see a printout on node 2 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)
62- [send](#send-message)
63- [benchmark](#benchmark-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 [\<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
89Done
90TCP Benchmark Complete: Transferred 73728 bytes in 7233 milliseconds
91TCP Goodput: 81.546 kb/s
92```
93
94### bind \<ip\> \<port\>
95
96Associates a name (i.e. IPv6 address and port) to the example TCP endpoint.
97
98- ip: the IPv6 address or the unspecified IPv6 address (`::`).
99- port: the TCP port.
100
101```bash
102> tcp bind :: 30000
103Done
104```
105
106### connect \<ip\> \<port\>
107
108Establishes a connection with the specified peer.
109
110If the connection establishment is successful, the resulting TCP connection is associated with the example TCP endpoint.
111
112- ip: the peer's IPv6 address.
113- port: the peer's TCP port.
114
115```bash
116> tcp connect fe80:0:0:0:a8df:580a:860:ffa4 30000
117Done
118TCP: Connection established
119```
120
121### deinit
122
123Deinitializes the example TCP listener and the example TCP endpoint.
124
125```bash
126> tcp deinit
127Done
128```
129
130### help
131
132List the TCP CLI commands.
133
134```bash
135> tcp help
136abort
137benchmark
138bind
139connect
140deinit
141help
142init
143listen
144send-message
145sendend
146stoplistening
147Done
148```
149
150### init [\<size\>]
151
152Initializes the example TCP listener and the example TCP endpoint.
153
154- size: the size of the receive buffer to associate with the example TCP endpoint. If left unspecified, the maximum size is used.
155
156```bash
157> tcp init
158Done
159```
160
161### listen \<ip\> \<port\>
162
163Uses the example TCP listener to listen for incoming connections on the specified name (i.e. IPv6 address and port).
164
165If 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.
166
167- ip: the IPv6 address or the unspecified IPv6 address (`::`).
168- port: the TCP port.
169
170```bash
171> tcp listen :: 30000
172Done
173```
174
175### send \<message\>
176
177Send data over the TCP connection associated with the example TCP endpoint.
178
179- message: the message to send.
180
181```bash
182> tcp send hello
183Done
184```
185
186### sendend
187
188Sends 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.
189
190```bash
191> tcp sendend
192Done
193```
194
195### stoplistening
196
197Stops listening for incoming TCP connections using the example TCP listener.
198
199```bash
200> tcp stoplistening
201Done
202```
203
README_UDP.md
1# OpenThread CLI - UDP Example
2
3The OpenThread UDP APIs may be invoked via the OpenThread CLI.
4
5## Quick Start
6
7### Form Network
8
9Form a network with at least two devices.
10
11### Node 1
12
13On node 1, open and bind the example UDP socket.
14
15```bash
16> udp open
17> udp bind :: 1234
18```
19
20The `::` specifies the IPv6 Unspecified Address.
21
22### Node 2
23
24On node 2, open the example UDP socket and send a simple message.
25
26```bash
27> udp open
28> udp send fdde:ad00:beef:0:bb1:ebd6:ad10:f33 1234 hello
29```
30
31### Result
32
33On node 1, you should see a print out similar to below:
34
35```bash
365 bytes from fdde:ad00:beef:0:dac3:6792:e2e:90d8 49153 hello
37```
38
39## Command List
40
41- [help](#help)
42- [bind](#bind-netif-ip-port)
43- [close](#close)
44- [connect](#connect-ip-port)
45- [linksecurity](#linksecurity)
46- [open](#open)
47- [send](#send-ip-port-message)
48
49## Command Details
50
51### help
52
53List the UDP CLI commands.
54
55```bash
56> udp help
57help
58bind
59close
60connect
61open
62send
63Done
64```
65
66### bind [netif] \<ip\> \<port\>
67
68Assigns a name (i.e. IPv6 address and port) to the example socket.
69
70- netif: the network interface to bind to.
71 - not specified: Thread network interface.
72 - `-u`: unspecified network interface.
73 - `-b`: Backbone network interface.
74- ip: the IPv6 address or the unspecified IPv6 address (`::`).
75- port: the UDP port
76
77```bash
78> udp bind :: 1234
79Done
80> udp bind -u :: 1234
81Done
82> udp bind -b :: 1234
83Done
84```
85
86### close
87
88Closes the example socket.
89
90```bash
91> udp close
92Done
93```
94
95### connect \<ip\> \<port\>
96
97Specifies the peer with which the socket is to be associated.
98
99- ip: the peer's IPv6 address.
100- port: the peer's UDP port.
101
102```bash
103> udp connect fdde:ad00:beef:0:bb1:ebd6:ad10:f33 1234
104Done
105```
106
107### linksecurity
108
109Indicates whether the link security is enabled or disabled.
110
111```bash
112> udp linksecurity
113Enabled
114Done
115```
116
117### linksecurity enable
118
119Enable link security.
120
121```bash
122> udp linksecurity enable
123Done
124```
125
126### linksecurity disable
127
128Disable link security.
129
130```bash
131> udp linksecurity disable
132Done
133```
134
135### open
136
137Opens the example socket.
138
139```bash
140> udp open
141Done
142```
143
144### send \<ip\> \<port\> \<message\>
145
146Send a UDP message.
147
148- ip: the IPv6 destination address.
149- port: the UDP destination port.
150- message: the message to send.
151
152```bash
153> udp send fdde:ad00:beef:0:bb1:ebd6:ad10:f33 1234 hello
154Done
155```
156
157### send \<ip\> \<port\> \<type\> \<value\>
158
159Send a few bytes over UDP.
160
161- ip: the IPv6 destination address.
162- port: the UDP destination port.
163- type: the type of the message:
164 - `-t`: text payload in the `value`, same as without specifying the type.
165 - `-s`: autogenerated payload with specified length indicated in the `value`.
166 - `-x`: binary data in hexadecimal representation in the `value`.
167
168```bash
169> udp send fdde:ad00:beef:0:bb1:ebd6:ad10:f33 1234 -t hello
170Done
171
172> udp send fdde:ad00:beef:0:bb1:ebd6:ad10:f33 1234 -x 68656c6c6f
173Done
174
175> udp send fdde:ad00:beef:0:bb1:ebd6:ad10:f33 1234 -s 800
176Done
177
178```
179
180### send \<message\>
181
182Send a UDP message on a connected socket.
183
184- message: the message to send.
185
186```bash
187> udp send hello
188Done
189```
190
191### send \<type\> \<value\>
192
193Send a few bytes over UDP.
194
195- type: the type of the message:
196 - `-t`: text payload in the `value`, same as without specifying the type.
197 - `-s`: autogenerated payload with specified length indicated in the `value`.
198 - `-x`: binary data in hexadecimal representation in the `value`.
199
200```bash
201> udp send -t hello
202Done
203
204> udp send -x 68656c6c6f
205Done
206
207> udp send -s 800
208Done
209```
210