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- [linkquality](#linkquality-extaddr)
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- [rcp](#rcp)
92- [region](#region)
93- [releaserouterid](#releaserouterid-routerid)
94- [reset](#reset)
95- [rloc16](#rloc16)
96- [route](#route-add-prefix-s-prf)
97- [router](#router-list)
98- [routerdowngradethreshold](#routerdowngradethreshold)
99- [routereligible](#routereligible)
100- [routerselectionjitter](#routerselectionjitter)
101- [routerupgradethreshold](#routerupgradethreshold)
102- [scan](#scan-channel)
103- [service](#service)
104- [singleton](#singleton)
105- [sntp](#sntp-query-sntp-server-ip-sntp-server-port)
106- [state](#state)
107- [srp](README_SRP.md)
108- [thread](#thread-start)
109- [trel](#trel-enable)
110- [txpower](#txpower)
111- [udp](README_UDP.md)
112- [unsecureport](#unsecureport-add-port)
113- [version](#version)
114
115## OpenThread Command Details
116
117### bbr
118
119Show current Primary Backbone Router information for Thread 1.2 device.
120
121```bash
122> bbr
123BBR Primary:
124server16: 0xE400
125seqno:    10
126delay:    120 secs
127timeout:  300 secs
128Done
129```
130
131```bash
132> bbr
133BBR Primary: None
134Done
135```
136
137### bbr mgmt dua \<status\|coap-code\> [meshLocalIid]
138
139Configure 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.
140
141Only for testing/reference device.
142
143known status value:
144
145- 0: ST_DUA_SUCCESS
146- 1: ST_DUA_REREGISTER
147- 2: ST_DUA_INVALID
148- 3: ST_DUA_DUPLICATE
149- 4: ST_DUA_NO_RESOURCES
150- 5: ST_DUA_BBR_NOT_PRIMARY
151- 6: ST_DUA_GENERAL_FAILURE
152- 160: COAP code 5.00
153
154```bash
155> bbr mgmt dua 1 2f7c235e5025a2fd
156Done
157> bbr mgmt dua 160
158Done
159```
160
161### bbr mgmt mlr listener
162
163Show the Multicast Listeners.
164
165Only for testing/reference Backbone Router device.
166
167```bash
168> bbr mgmt mlr listener
169ff04:0:0:0:0:0:0:abcd 3534000
170ff04:0:0:0:0:0:0:eeee 3537610
171Done
172```
173
174### bbr mgmt mlr listener add \<ipaddr\> \[\<timeout\>\]
175
176Add a Multicast Listener with a given IPv6 multicast address and timeout (in seconds).
177
178Only for testing/reference Backbone Router device.
179
180```bash
181> bbr mgmt mlr listener add ff04::1
182Done
183> bbr mgmt mlr listener add ff04::2 300
184Done
185> bbr mgmt mlr listener
186ff04:0:0:0:0:0:0:2 261
187ff04:0:0:0:0:0:0:1 3522
188Done
189```
190
191### bbr mgmt mlr listener clear
192
193Removes all the Multicast Listeners.
194
195Only for testing/reference Backbone Router device.
196
197```bash
198> bbr mgmt mlr listener clear
199Done
200> bbr mgmt mlr listener
201Done
202```
203
204### bbr mgmt mlr response \<status\>
205
206Configure the response status for the next MLR.req.
207
208Only for testing/reference device.
209
210Known status values:
211
212- 0: ST_MLR_SUCCESS
213- 2: ST_MLR_INVALID
214- 3: ST_MLR_NO_PERSISTENT
215- 4: ST_MLR_NO_RESOURCES
216- 5: ST_MLR_BBR_NOT_PRIMARY
217- 6: ST_MLR_GENERAL_FAILURE
218
219```bash
220> bbr mgmt mlr response 2
221Done
222```
223
224### bbr state
225
226Show local Backbone state ([`Disabled`,`Primary`, `Secondary`]) for Thread 1.2 FTD.
227
228`OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is required.
229
230```bash
231> bbr state
232Disabled
233Done
234
235> bbr state
236Primary
237Done
238
239> bbr state
240Secondary
241Done
242```
243
244### bbr enable
245
246Enable 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.
247
248`OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is required.
249
250```bash
251> bbr enable
252Done
253```
254
255### bbr disable
256
257Disable 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.
258
259```bash
260> bbr disable
261Done
262```
263
264### bbr register
265
266Register Backbone Router Service for Thread 1.2 FTD. `SRV_DATA.ntf` would be triggerred for attached device.
267
268`OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is required.
269
270```bash
271> bbr register
272Done
273```
274
275### bbr config
276
277Show local Backbone Router configuration for Thread 1.2 FTD.
278
279`OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is required.
280
281```bash
282> bbr config
283seqno:    10
284delay:    120 secs
285timeout:  300 secs
286Done
287```
288
289### bbr config \[seqno \<seqno\>\] \[delay \<delay\>\] \[timeout \<timeout\>\]
290
291Configure 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.
292
293`OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is required.
294
295```bash
296> bbr config seqno 20 delay 30
297Done
298```
299
300### bbr jitter
301
302Show jitter (in seconds) for Backbone Router registration for Thread 1.2 FTD.
303
304`OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is required.
305
306```bash
307> bbr jitter
30820
309Done
310```
311
312### bbr jitter \<jitter\>
313
314Set jitter (in seconds) for Backbone Router registration for Thread 1.2 FTD.
315
316`OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is required.
317
318```bash
319> bbr jitter 10
320Done
321```
322
323### ba
324
325Show current Border Agent information.
326
327### ba port
328
329Print border agent service port.
330
331```bash
332> ba port
33349152
334Done
335```
336
337### ba state
338
339Print border agent state.
340
341```bash
342> ba state
343Started
344Done
345```
346
347### br
348
349Enbale/disable the Border Routing functionality.
350
351```bash
352> br enable
353Done
354```
355
356```bash
357> br disable
358Done
359```
360
361### br omrprefix
362
363Get the randomly generated off-mesh-routable prefix of the Border Router.
364
365```bash
366> br omrprefix
367fdfc:1ff5:1512:5622::/64
368Done
369```
370
371### br onlinkprefix
372
373Get the randomly generated on-link prefix of the Border Router.
374
375```bash
376> br onlinkprefix
377fd41:2650:a6f5:0::/64
378Done
379```
380
381### bufferinfo
382
383Show the current message buffer information.
384
385```bash
386> bufferinfo
387total: 40
388free: 40
3896lo send: 0 0
3906lo reas: 0 0
391ip6: 0 0
392mpl: 0 0
393mle: 0 0
394arp: 0 0
395coap: 0 0
396coap secure: 0 0
397application coap: 0 0
398Done
399```
400
401### ccathreshold
402
403Get the CCA threshold in dBm measured at antenna connector per IEEE 802.15.4 - 2015 section 10.1.4.
404
405```bash
406> ccathreshold
407-75 dBm
408Done
409```
410
411### ccathreshold \<ccathreshold\>
412
413Set the CCA threshold measured at antenna connector per IEEE 802.15.4 - 2015 section 10.1.4.
414
415```bash
416> ccathreshold -62
417Done
418```
419
420### channel
421
422Get the IEEE 802.15.4 Channel value.
423
424```bash
425> channel
42611
427Done
428```
429
430### channel \<channel\>
431
432Set the IEEE 802.15.4 Channel value.
433
434```bash
435> channel 11
436Done
437```
438
439### channel manager
440
441Get channel manager state.
442
443`OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` is required.
444
445```bash
446channel: 11
447auto: 1
448delay: 120
449interval: 10800
450supported: { 11-26}
451favored: { 11-26}
452Done
453```
454
455### channel manager change \<channel\>
456
457Initiate a channel change with the channel manager.
458
459`OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` is required.
460
461```bash
462> channel manager change 11
463channel manager change 11
464Done
465```
466
467### channel manager select \<skip quality check (boolean)\>
468
469Request a channel selection with the channel manager.
470
471`OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` and `OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE` are required.
472
473```bash
474> channel manager select 1
475channel manager select 1
476Done
477```
478
479### channel manager auto \<enable (boolean)\>
480
481Enable/disable the auto-channel-selection functionality.
482
483`OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` and `OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE` are required.
484
485```bash
486> channel manager auto 1
487channel manager auto 1
488Done
489```
490
491### channel manager delay \<delay\>
492
493Set the channel change delay (in seconds).
494
495`OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` and `OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE` are required.
496
497```bash
498> channel manager delay 120
499channel manager delay 120
500Done
501```
502
503### channel manager interval \<interval\>
504
505Set the auto-channel-selection interval (in seconds).
506
507`OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` and `OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE` are required.
508
509```bash
510> channel manager interval 10800
511channel manager interval 10800
512Done
513```
514
515### channel manager supported \<mask\>
516
517Set the supported channel mask for the auto-channel-selection.
518
519`OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` and `OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE` are required.
520
521```bash
522> channel manager supported 0x7fffc00
523channel manager supported 0x7fffc00
524Done
525```
526
527### channel manager favored \<mask\>
528
529Set the favored channel mask for the auto-channel-selection.
530
531`OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` and `OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE` are required.
532
533```bash
534> channel manager favored 0x7fffc00
535channel manager favored 0x7fffc00
536Done
537```
538
539### channel monitor
540
541Get current channel monitor state and channel occupancy.
542
543`OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE` is required.
544
545```bash
546> channel monitor
547channel monitor
548enabled: 1
549interval: 41000
550threshold: -75
551window: 960
552count: 10552
553occupancies:
554ch 11 (0x0cb7)  4.96% busy
555ch 12 (0x2e2b) 18.03% busy
556ch 13 (0x2f54) 18.48% busy
557ch 14 (0x0fef)  6.22% busy
558ch 15 (0x1536)  8.28% busy
559ch 16 (0x1746)  9.09% busy
560ch 17 (0x0b8b)  4.50% busy
561ch 18 (0x60a7) 37.75% busy
562ch 19 (0x0810)  3.14% busy
563ch 20 (0x0c2a)  4.75% busy
564ch 21 (0x08dc)  3.46% busy
565ch 22 (0x101d)  6.29% busy
566ch 23 (0x0092)  0.22% busy
567ch 24 (0x0028)  0.06% busy
568ch 25 (0x0063)  0.15% busy
569ch 26 (0x058c)  2.16% busy
570
571Done
572```
573
574### channel monitor start
575
576Start the channel monitor.
577
578`OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE` is required.
579
580```bash
581> channel monitor start
582channel monitor start
583Done
584```
585
586### channel monitor stop
587
588Stop the channel monitor.
589
590`OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE` is required.
591
592```bash
593> channel monitor stop
594channel monitor stop
595Done
596```
597
598### channel preferred
599
600Get preferred channel mask.
601
602```bash
603> channel preferred
6040x7fff800
605Done
606```
607
608### channel supported
609
610Get supported channel mask.
611
612```bash
613> channel supported
6140x7fff800
615Done
616```
617
618### child list
619
620List attached Child IDs.
621
622```bash
623> child list
6241 2 3 6 7 8
625Done
626```
627
628### child table
629
630Print table of attached children.
631
632```bash
633> child table
634| ID  | RLOC16 | Timeout    | Age        | LQ In | C_VN |R|D|N|Ver|CSL|QMsgCnt| Extended MAC     |
635+-----+--------+------------+------------+-------+------+-+-+-+---+---+-------+------------------+
636|   1 | 0xc801 |        240 |         24 |     3 |  131 |1|0|0|  3| 0 |     0 | 4ecede68435358ac |
637|   2 | 0xc802 |        240 |          2 |     3 |  131 |0|0|0|  3| 1 |     0 | a672a601d2ce37d8 |
638Done
639```
640
641### child \<id\>
642
643Print diagnostic information for an attached Thread Child. The `id` may be a Child ID or an RLOC16.
644
645```bash
646> child 1
647Child ID: 1
648Rloc: 9c01
649Ext Addr: e2b3540590b0fd87
650Mode: rn
651Net Data: 184
652Timeout: 100
653Age: 0
654Link Quality In: 3
655RSSI: -20
656Done
657```
658
659### childip
660
661Get the list of IP addresses stored for MTD children.
662
663```bash
664> childip
6653401: fdde:ad00:beef:0:3037:3e03:8c5f:bc0c
666Done
667```
668
669### childip max
670
671Get the maximum number of IP addresses that each MTD child may register with this device as parent.
672
673```bash
674> childip max
6754
676Done
677```
678
679### childip max \<count\>
680
681Set 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.
682
683`OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is required.
684
685```bash
686> childip max 2
687Done
688```
689
690### childmax
691
692Get the Thread maximum number of allowed children.
693
694```bash
695> childmax
6965
697Done
698```
699
700### childmax \<count\>
701
702Set the Thread maximum number of allowed children.
703
704```bash
705> childmax 2
706Done
707```
708
709### childsupervision interval
710
711Get the Child Supervision Interval value.
712
713Child 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.
714
715```bash
716> childsupervision interval
71730
718Done
719```
720
721### childsupervision interval \<interval\>
722
723Set the Child Supervision Interval value. This command can only be used with FTD devices.
724
725```bash
726> childsupervision interval 30
727Done
728```
729
730### childsupervision checktimeout
731
732Get the Child Supervision Check Timeout value.
733
734If 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).
735
736```bash
737> childsupervision checktimeout
73830
739Done
740```
741
742### childsupervision checktimeout \<timeout\>
743
744Set the Child Supervision Check Timeout value.
745
746```bash
747> childsupervision checktimeout 30
748Done
749```
750
751### childtimeout
752
753Get the Thread Child Timeout value.
754
755```bash
756> childtimeout
757300
758Done
759```
760
761### childtimeout \<timeout\>
762
763Set the Thread Child Timeout value.
764
765```bash
766> childtimeout 300
767Done
768```
769
770### contextreusedelay
771
772Get the CONTEXT_ID_REUSE_DELAY value.
773
774```bash
775> contextreusedelay
77611
777Done
778```
779
780### contextreusedelay \<delay\>
781
782Set the CONTEXT_ID_REUSE_DELAY value.
783
784```bash
785> contextreusedelay 11
786Done
787```
788
789### counters
790
791Get the supported counter names.
792
793```bash
794> counters
795ip
796mac
797mle
798Done
799```
800
801### counters \<countername\>
802
803Get the counter value.
804
805```bash
806> counters mac
807TxTotal: 10
808    TxUnicast: 3
809    TxBroadcast: 7
810    TxAckRequested: 3
811    TxAcked: 3
812    TxNoAckRequested: 7
813    TxData: 10
814    TxDataPoll: 0
815    TxBeacon: 0
816    TxBeaconRequest: 0
817    TxOther: 0
818    TxRetry: 0
819    TxErrCca: 0
820    TxErrBusyChannel: 0
821RxTotal: 2
822    RxUnicast: 1
823    RxBroadcast: 1
824    RxData: 2
825    RxDataPoll: 0
826    RxBeacon: 0
827    RxBeaconRequest: 0
828    RxOther: 0
829    RxAddressFiltered: 0
830    RxDestAddrFiltered: 0
831    RxDuplicated: 0
832    RxErrNoFrame: 0
833    RxErrNoUnknownNeighbor: 0
834    RxErrInvalidSrcAddr: 0
835    RxErrSec: 0
836    RxErrFcs: 0
837    RxErrOther: 0
838Done
839> counters mle
840Role Disabled: 0
841Role Detached: 1
842Role Child: 0
843Role Router: 0
844Role Leader: 1
845Attach Attempts: 1
846Partition Id Changes: 1
847Better Partition Attach Attempts: 0
848Parent Changes: 0
849Done
850> counters ip
851TxSuccess: 10
852TxFailed: 0
853RxSuccess: 5
854RxFailed: 0
855Done
856```
857
858### counters \<countername\> reset
859
860Reset the counter value.
861
862```bash
863> counters mac reset
864Done
865> counters mle reset
866Done
867> counters ip reset
868Done
869```
870
871### csl
872
873Get the CSL configuration.
874
875```bash
876> csl
877Channel: 11
878Period: 1000 (in units of 10 symbols), 160ms
879Timeout: 1000s
880Done
881```
882
883### csl channel \<channel\>
884
885Set CSL channel.
886
887```bash
888> csl channel 20
889Done
890```
891
892### csl period \<period\>
893
894Set CSL period in units of 10 symbols. Disable CSL by setting this parameter to `0`.
895
896```bash
897> csl period 3000
898Done
899```
900
901### csl timeout \<timeout\>
902
903Set the CSL timeout in seconds.
904
905```bash
906> csl timeout 10
907Done
908```
909
910### networktime
911
912Get the Thread network time and the time sync parameters.
913
914```bash
915> networktime
916Network Time:     21084154us (synchronized)
917Time Sync Period: 100s
918XTAL Threshold:   300ppm
919Done
920```
921
922### networktime \<timesyncperiod\> \<xtalthreshold\>
923
924Set time sync parameters
925
926- timesyncperiod: The time synchronization period, in seconds.
927- xtalthreshold: The XTAL accuracy threshold for a device to become Router-Capable device, in PPM.
928
929```bash
930> networktime 100 300
931Done
932```
933
934### delaytimermin
935
936Get the minimal delay timer (in seconds).
937
938```bash
939> delaytimermin
94030
941Done
942```
943
944### delaytimermin \<delaytimermin\>
945
946Set the minimal delay timer (in seconds).
947
948```bash
949> delaytimermin 60
950Done
951```
952
953### discover \[channel\]
954
955Perform an MLE Discovery operation.
956
957- channel: The channel to discover on. If no channel is provided, the discovery will cover all valid channels.
958
959```bash
960> discover
961| J | Network Name     | Extended PAN     | PAN  | MAC Address      | Ch | dBm | LQI |
962+---+------------------+------------------+------+------------------+----+-----+-----+
963| 0 | OpenThread       | dead00beef00cafe | ffff | f1d92a82c8d8fe43 | 11 | -20 |   0 |
964Done
965```
966
967### dns config
968
969Get the default query config used by DNS client.
970
971The 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.
972
973```bash
974> dns config
975Server: [fd00:0:0:0:0:0:0:1]:1234
976ResponseTimeout: 5000 ms
977MaxTxAttempts: 2
978RecursionDesired: no
979Done
980>
981```
982
983### dns config \[DNS server IP\] \[DNS server port\] \[response timeout (ms)\] \[max tx attempts\] \[recursion desired (boolean)\]
984
985Set the default query config.
986
987```bash
988> dns config fd00::1 1234 5000 2 0
989Done
990
991> dns config
992Server: [fd00:0:0:0:0:0:0:1]:1234
993ResponseTimeout: 5000 ms
994MaxTxAttempts: 2
995RecursionDesired: no
996Done
997```
998
999We 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.
1000
1001```bash
1002> dns config fd00::2
1003Done
1004
1005> dns config
1006Server: [fd00:0:0:0:0:0:0:2]:53
1007ResponseTimeout: 3000 ms
1008MaxTxAttempts: 3
1009RecursionDesired: yes
1010Done
1011```
1012
1013### dns resolve \<hostname\> \[DNS server IP\] \[DNS server port\] \[response timeout (ms)\] \[max tx attempts\] \[recursion desired (boolean)\]
1014
1015Send DNS Query to obtain IPv6 address for given hostname.
1016
1017The 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`).
1018
1019```bash
1020> dns resolve ipv6.google.com
1021> DNS response for ipv6.google.com - 2a00:1450:401b:801:0:0:0:200e TTL: 300
1022```
1023
1024### dns browse \<service-name\> \[DNS server IP\] \[DNS server port\] \[response timeout (ms)\] \[max tx attempts\] \[recursion desired (boolean)\]
1025
1026Send a browse (service instance enumeration) DNS query to get the list of services for given service-name.
1027
1028The 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`).
1029
1030```bash
1031> dns browse _service._udp.example.com
1032DNS browse response for _service._udp.example.com.
1033inst1
1034    Port:1234, Priority:1, Weight:2, TTL:7200
1035    Host:host.example.com.
1036    HostAddress:fd00:0:0:0:0:0:0:abcd TTL:7200
1037    TXT:[a=6531, b=6c12] TTL:7300
1038instance2
1039    Port:1234, Priority:1, Weight:2, TTL:7200
1040    Host:host.example.com.
1041    HostAddress:fd00:0:0:0:0:0:0:abcd TTL:7200
1042    TXT:[a=1234] TTL:7300
1043Done
1044```
1045
1046### dns service \<service-instance-label\> \<service-name\> \[DNS server IP\] \[DNS server port\] \[response timeout (ms)\] \[max tx attempts\] \[recursion desired (boolean)\]
1047
1048Send 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).
1049
1050The 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`).
1051
1052### dns compression \[enable|disable\]
1053
1054Enable/Disable the "DNS name compression" mode.
1055
1056By 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.
1057
1058This is intended for testing only and available under `REFERENCE_DEVICE` config.
1059
1060Get the current "DNS name compression" mode.
1061
1062```
1063> dns compression
1064Enabled
1065```
1066
1067Set the "DNS name compression" mode.
1068
1069```
1070> dns compression disable
1071Done
1072>
1073>
1074> dns compression
1075Disabled
1076Done
1077```
1078
1079### domainname
1080
1081Get the Thread Domain Name for Thread 1.2 device.
1082
1083```bash
1084> domainname
1085Thread
1086Done
1087```
1088
1089### domainname \<name\>
1090
1091Set the Thread Domain Name for Thread 1.2 device.
1092
1093```bash
1094> domainname Test\ Thread
1095Done
1096```
1097
1098### dua iid
1099
1100Get the Interface Identifier mannually specified for Thread Domain Unicast Address on Thread 1.2 device.
1101
1102```bash
1103> dua iid
11040004000300020001
1105Done
1106```
1107
1108### dua iid \<iid\>
1109
1110Set the Interface Identifier mannually specified for Thread Domain Unicast Address on Thread 1.2 device.
1111
1112```bash
1113> dua iid 0004000300020001
1114Done
1115```
1116
1117### dua iid clear
1118
1119Clear the Interface Identifier mannually specified for Thread Domain Unicast Address on Thread 1.2 device.
1120
1121```bash
1122> dua iid clear
1123Done
1124```
1125
1126### eidcache
1127
1128Print the EID-to-RLOC cache entries.
1129
1130```bash
1131> eidcache
1132fd49:caf4:a29f:dc0e:97fc:69dd:3c16:df7d 2000 cache canEvict=1 transTime=0 eid=fd49:caf4:a29f:dc0e:97fc:69dd:3c16:df7d
1133fd49:caf4:a29f:dc0e:97fc:69dd:3c16:df7f fffe retry canEvict=1 timeout=10 retryDelay=30
1134Done
1135```
1136
1137### eui64
1138
1139Get the factory-assigned IEEE EUI-64.
1140
1141```bash
1142> eui64
11430615aae900124b00
1144Done
1145```
1146
1147### extaddr
1148
1149Get the IEEE 802.15.4 Extended Address.
1150
1151```bash
1152> extaddr
1153dead00beef00cafe
1154Done
1155```
1156
1157### extaddr \<extaddr\>
1158
1159Set the IEEE 802.15.4 Extended Address.
1160
1161```bash
1162> extaddr dead00beef00cafe
1163dead00beef00cafe
1164Done
1165```
1166
1167### extpanid
1168
1169Get the Thread Extended PAN ID value.
1170
1171**NOTE** The current commissioning credential becomes stale after changing this value. Use [pskc](#pskc--p-keypassphrase) to reset.
1172
1173```bash
1174> extpanid
1175dead00beef00cafe
1176Done
1177```
1178
1179### extpanid \<extpanid\>
1180
1181Set the Thread Extended PAN ID value.
1182
1183```bash
1184> extpanid dead00beef00cafe
1185Done
1186```
1187
1188### factoryreset
1189
1190Delete all stored settings, and signal a platform reset.
1191
1192```bash
1193> factoryreset
1194```
1195
1196### fake
1197
1198Send fake Thread messages.
1199
1200Note: Only for certification test.
1201
1202#### fake /a/an \<dst-ipaddr\> \<target\> \<meshLocalIid\>
1203
1204```bash
1205> fake /a/an fdde:ad00:beef:0:0:ff:fe00:a800 fd00:7d03:7d03:7d03:55f2:bb6a:7a43:a03b 1111222233334444
1206Done
1207```
1208
1209### fem
1210
1211Get external FEM parameters.
1212
1213```bash
1214> fem
1215LNA gain 11 dBm
1216Done
1217```
1218
1219### fem lnagain
1220
1221Get the Rx LNA gain in dBm of the external FEM.
1222
1223```bash
1224> fem lnagain
122511
1226Done
1227```
1228
1229### fem lnagain \<LNA gain\>
1230
1231Set the Rx LNA gain in dBm of the external FEM.
1232
1233```bash
1234> fem lnagain 8
1235Done
1236```
1237
1238### ifconfig
1239
1240Show the status of the IPv6 interface.
1241
1242```bash
1243> ifconfig
1244down
1245Done
1246```
1247
1248### ifconfig up
1249
1250Bring up the IPv6 interface.
1251
1252```bash
1253> ifconfig up
1254Done
1255```
1256
1257### ifconfig down
1258
1259Bring down the IPv6 interface.
1260
1261```bash
1262> ifconfig down
1263Done
1264```
1265
1266### ipaddr
1267
1268List all IPv6 addresses assigned to the Thread interface.
1269
1270```bash
1271> ipaddr
1272fdde:ad00:beef:0:0:ff:fe00:0
1273fdde:ad00:beef:0:558:f56b:d688:799
1274fe80:0:0:0:f3d9:2a82:c8d8:fe43
1275Done
1276```
1277
1278### ipaddr add \<ipaddr\>
1279
1280Add an IPv6 address to the Thread interface.
1281
1282```bash
1283> ipaddr add 2001::dead:beef:cafe
1284Done
1285```
1286
1287### ipaddr del \<ipaddr\>
1288
1289Delete an IPv6 address from the Thread interface.
1290
1291```bash
1292> ipaddr del 2001::dead:beef:cafe
1293Done
1294```
1295
1296### ipaddr linklocal
1297
1298Print Thread link-local IPv6 address.
1299
1300```bash
1301> ipaddr linklocal
1302fe80:0:0:0:f3d9:2a82:c8d8:fe43
1303Done
1304```
1305
1306### ipaddr mleid
1307
1308Print Thread Mesh Local EID address.
1309
1310```bash
1311> ipaddr mleid
1312fdde:ad00:beef:0:558:f56b:d688:799
1313Done
1314```
1315
1316### ipaddr rloc
1317
1318Print Thread Routing Locator (RLOC) address.
1319
1320```bash
1321> ipaddr rloc
1322fdde:ad00:beef:0:0:ff:fe00:0
1323Done
1324```
1325
1326### ipmaddr
1327
1328List all IPv6 multicast addresses subscribed to the Thread interface.
1329
1330```bash
1331> ipmaddr
1332ff05:0:0:0:0:0:0:1
1333ff33:40:fdde:ad00:beef:0:0:1
1334ff32:40:fdde:ad00:beef:0:0:1
1335Done
1336```
1337
1338### ipmaddr add \<ipaddr\>
1339
1340Subscribe the Thread interface to the IPv6 multicast address.
1341
1342```bash
1343> ipmaddr add ff05::1
1344Done
1345```
1346
1347### ipmaddr del \<ipaddr\>
1348
1349Unsubscribe the Thread interface to the IPv6 multicast address.
1350
1351```bash
1352> ipmaddr del ff05::1
1353Done
1354```
1355
1356### ipmaddr llatn
1357
1358Get the Link-Local All Thread Nodes multicast address.
1359
1360```
1361> ipmaddr llatn
1362ff32:40:fdde:ad00:beef:0:0:1
1363Done
1364```
1365
1366### ipmaddr promiscuous
1367
1368Get multicast promiscuous mode.
1369
1370```bash
1371> ipmaddr promiscuous
1372Disabled
1373Done
1374```
1375
1376### ipmaddr promiscuous enable
1377
1378Enable multicast promiscuous mode.
1379
1380```bash
1381> ipmaddr promiscuous enable
1382Done
1383```
1384
1385### ipmaddr promiscuous disable
1386
1387Disable multicast promiscuous mode.
1388
1389```bash
1390> ipmaddr promiscuous disable
1391Done
1392```
1393
1394### ipmaddr rlatn
1395
1396Get the Realm-Local All Thread Nodes multicast address.
1397
1398```
1399> ipmaddr rlatn
1400ff33:40:fdde:ad00:beef:0:0:1
1401Done
1402```
1403
1404### joinerport \<port\>
1405
1406Set the Joiner port.
1407
1408```bash
1409> joinerport 1000
1410Done
1411```
1412
1413### keysequence counter
1414
1415Get the Thread Key Sequence Counter.
1416
1417```bash
1418> keysequence counter
141910
1420Done
1421```
1422
1423### keysequence counter \<counter\>
1424
1425Set the Thread Key Sequence Counter.
1426
1427```bash
1428> keysequence counter 10
1429Done
1430```
1431
1432### keysequence guardtime
1433
1434Get Thread Key Switch Guard Time (in hours)
1435
1436```bash
1437> keysequence guardtime
14380
1439Done
1440```
1441
1442### keysequence guardtime \<guardtime\>
1443
1444Set Thread Key Switch Guard Time (in hours) 0 means Thread Key Switch imediately if key index match
1445
1446```bash
1447> keysequence guardtime 0
1448Done
1449```
1450
1451### leaderdata
1452
1453Show the Thread Leader Data.
1454
1455```bash
1456> leaderdata
1457Partition ID: 1077744240
1458Weighting: 64
1459Data Version: 109
1460Stable Data Version: 211
1461Leader Router ID: 60
1462Done
1463```
1464
1465### leaderweight
1466
1467Get the Thread Leader Weight.
1468
1469```bash
1470> leaderweight
1471128
1472Done
1473```
1474
1475### leaderweight \<weight\>
1476
1477Set the Thread Leader Weight.
1478
1479```bash
1480> leaderweight 128
1481Done
1482```
1483
1484### linkmetrics mgmt \<ipaddr\> enhanced-ack clear
1485
1486Send a Link Metrics Management Request to clear an Enhanced-ACK Based Probing.
1487
1488- ipaddr: Peer address (SHOULD be link local address of the neighboring device).
1489
1490```bash
1491> linkmetrics mgmt fe80:0:0:0:3092:f334:1455:1ad2 enhanced-ack clear
1492Done
1493> Received Link Metrics Management Response from: fe80:0:0:0:3092:f334:1455:1ad2
1494Status: Success
1495```
1496
1497### linkmetrics mgmt \<ipaddr\> enhanced-ack register [qmr][r]
1498
1499Send a Link Metrics Management Request to register an Enhanced-ACK Based Probing.
1500
1501- ipaddr: Peer address.
1502- qmr: This specifies what metrics to query. At most two options are allowed to select (per spec 4.11.3.4.4.6).
1503  - q: Layer 2 LQI.
1504  - m: Link Margin.
1505  - r: RSSI.
1506- 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.
1507
1508```bash
1509> linkmetrics mgmt fe80:0:0:0:3092:f334:1455:1ad2 enhanced-ack register qm
1510Done
1511> Received Link Metrics Management Response from: fe80:0:0:0:3092:f334:1455:1ad2
1512Status: Success
1513
1514> linkmetrics mgmt fe80:0:0:0:3092:f334:1455:1ad2 enhanced-ack register qm r
1515Done
1516> Received Link Metrics Management Response from: fe80:0:0:0:3092:f334:1455:1ad2
1517Status: Cannot support new series
1518```
1519
1520### linkmetrics mgmt \<ipaddr\> forward \<seriesid\> [ldraX][pqmr]
1521
1522Send a Link Metrics Management Request to configure a Forward Tracking Series.
1523
1524- ipaddr: Peer address.
1525- seriesid: The Series ID.
1526- ldraX: This specifies which frames are to be accounted.
1527  - l: MLE Link Probe.
1528  - d: MAC Data.
1529  - r: MAC Data Request.
1530  - a: MAC Ack.
1531  - 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.
1532- pqmr: This specifies what metrics to query.
1533  - p: Layer 2 Number of PDUs received.
1534  - q: Layer 2 LQI.
1535  - m: Link Margin.
1536  - r: RSSI.
1537
1538```bash
1539> linkmetrics mgmt fe80:0:0:0:3092:f334:1455:1ad2 forward 1 dra pqmr
1540Done
1541> Received Link Metrics Management Response from: fe80:0:0:0:3092:f334:1455:1ad2
1542Status: SUCCESS
1543```
1544
1545### linkmetrics probe \<ipaddr\> \<seriesid\> \<length\>
1546
1547Send a MLE Link Probe message to the peer.
1548
1549- ipaddr: Peer address.
1550- seriesid: The Series ID for which this Probe message targets at.
1551- length: The length of the Probe message, valid range: [0, 64].
1552
1553```bash
1554> linkmetrics probe fe80:0:0:0:3092:f334:1455:1ad2 1 10
1555Done
1556```
1557
1558### linkmetrics query \<ipaddr\> single [pqmr]
1559
1560Perform a Link Metrics query (Single Probe).
1561
1562- ipaddr: Peer address.
1563- pqmr: This specifies what metrics to query.
1564- p: Layer 2 Number of PDUs received.
1565- q: Layer 2 LQI.
1566- m: Link Margin.
1567- r: RSSI.
1568
1569```bash
1570> linkmetrics query fe80:0:0:0:3092:f334:1455:1ad2 single qmr
1571Done
1572> Received Link Metrics Report from: fe80:0:0:0:3092:f334:1455:1ad2
1573
1574 - LQI: 76 (Exponential Moving Average)
1575 - Margin: 82 (dB) (Exponential Moving Average)
1576 - RSSI: -18 (dBm) (Exponential Moving Average)
1577```
1578
1579### linkmetrics query \<ipaddr\> forward \<seriesid\>
1580
1581Perform a Link Metrics query (Forward Tracking Series).
1582
1583- ipaddr: Peer address.
1584- seriesid: The Series ID.
1585
1586```bash
1587> linkmetrics query fe80:0:0:0:3092:f334:1455:1ad2 forward 1
1588Done
1589> Received Link Metrics Report from: fe80:0:0:0:3092:f334:1455:1ad2
1590
1591 - PDU Counter: 2 (Count/Summation)
1592 - LQI: 76 (Exponential Moving Average)
1593 - Margin: 82 (dB) (Exponential Moving Average)
1594 - RSSI: -18 (dBm) (Exponential Moving Average)
1595```
1596
1597### linkquality \<extaddr\>
1598
1599Get the link quality on the link to a given extended address.
1600
1601```bash
1602> linkquality 36c1dd7a4f5201ff
16033
1604Done
1605```
1606
1607### linkquality \<extaddr\> \<linkquality\>
1608
1609Set the link quality on the link to a given extended address.
1610
1611```bash
1612> linkquality 36c1dd7a4f5201ff 3
1613Done
1614```
1615
1616### log filename \<filename\>
1617
1618- Note: Simulation Only, ie: `OPENTHREAD_EXAMPLES_SIMULATION`
1619- Requires `OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_DEBUG_UART`
1620
1621Specifies filename to capture otPlatLog() messages, useful when debugging automated test scripts on Linux when logging disrupts the automated test scripts.
1622
1623### log level
1624
1625Get the log level.
1626
1627```bash
1628> log level
16291
1630Done
1631```
1632
1633### log level \<level\>
1634
1635Set the log level.
1636
1637```bash
1638> log level 4
1639Done
1640```
1641
1642### mliid \<iid\>
1643
1644Set the Mesh Local IID.
1645
1646It must be used before Thread stack is enabled.
1647
1648Only for testing/reference device.
1649
1650```bash
1651> mliid 1122334455667788
1652Done
1653```
1654
1655### mlr reg \<ipaddr\> ... [timeout]
1656
1657Register Multicast Listeners to Primary Backbone Router, with an optional `timeout` (in seconds).
1658
1659Omit `timeout` to use the default MLR timeout on the Primary Backbone Router.
1660
1661Use `timeout = 0` to deregister Multicast Listeners.
1662
1663NOTE: Only for Thread 1.2 Commissioner FTD device.
1664
1665```bash
1666> mlr reg ff04::1
1667status 0, 0 failed
1668Done
1669> mlr reg ff04::1 ff04::2 ff02::1
1670status 2, 1 failed
1671ff02:0:0:0:0:0:0:1
1672Done
1673> mlr reg ff04::1 ff04::2 1000
1674status 0, 0 failed
1675Done
1676> mlr reg ff04::1 ff04::2 0
1677status 0, 0 failed
1678Done
1679```
1680
1681### mode
1682
1683Get the Thread Device Mode value.
1684
1685- -: no flags set (rx-off-when-idle, minimal Thread device, stable network data)
1686- r: rx-on-when-idle
1687- d: Full Thread Device
1688- n: Full Network Data
1689
1690```bash
1691> mode
1692rdn
1693Done
1694```
1695
1696### mode [rdn]
1697
1698Set the Thread Device Mode value.
1699
1700- -: no flags set (rx-off-when-idle, minimal Thread device, stable network data)
1701- r: rx-on-when-idle
1702- d: Full Thread Device
1703- n: Full Network Data
1704
1705```bash
1706> mode rdn
1707Done
1708```
1709
1710```bash
1711> mode -
1712Done
1713```
1714
1715### multiradio
1716
1717Get the list of supported radio links by the device.
1718
1719This command is always available, even when only a single radio is supported by the device.
1720
1721```bash
1722> multiradio
1723[15.4, TREL]
1724Done
1725```
1726
1727### multiradio neighbor list
1728
1729Get the list of neighbors and their supported radios and their preference.
1730
1731This command is only available when device supports more than one radio link.
1732
1733```bash
1734> multiradio neighbor list
1735ExtAddr:3a65bc38dbe4a5be, RLOC16:0xcc00, Radios:[15.4(255), TREL(255)]
1736ExtAddr:17df23452ee4a4be, RLOC16:0x1300, Radios:[15.4(255)]
1737Done
1738```
1739
1740### multiradio neighbor \<ext address\>
1741
1742Get the radio info for specific neighbor with a given extended address.
1743
1744This command is only available when device supports more than one radio link.
1745
1746```bash
1747> multiradio neighbor 3a65bc38dbe4a5be
1748[15.4(255), TREL(255)]
1749Done
1750```
1751
1752### neighbor list
1753
1754List RLOC16 of neighbors.
1755
1756```bash
1757> neighbor list
17580xcc01 0xc800 0xf000
1759Done
1760```
1761
1762### neighbor table
1763
1764Print table of neighbors.
1765
1766```bash
1767> neighbor table
1768| Role | RLOC16 | Age | Avg RSSI | Last RSSI |R|D|N| Extended MAC     |
1769+------+--------+-----+----------+-----------+-+-+-+------------------+
1770|   C  | 0xcc01 |  96 |      -46 |       -46 |1|1|1| 1eb9ba8a6522636b |
1771|   R  | 0xc800 |   2 |      -29 |       -29 |1|1|1| 9a91556102c39ddb |
1772|   R  | 0xf000 |   3 |      -28 |       -28 |1|1|1| 0ad7ed6beaa6016d |
1773Done
1774```
1775
1776### netstat
1777
1778List all UDP sockets.
1779
1780```bash
1781> netstat
1782| Local Address                                   | Peer Address                                    |
1783+-------------------------------------------------+-------------------------------------------------+
1784| [0:0:0:0:0:0:0:0]:49153                         | [0:0:0:0:0:0:0:0]:0                             |
1785| [0:0:0:0:0:0:0:0]:49152                         | [0:0:0:0:0:0:0:0]:0                             |
1786| [0:0:0:0:0:0:0:0]:61631                         | [0:0:0:0:0:0:0:0]:0                             |
1787| [0:0:0:0:0:0:0:0]:19788                         | [0:0:0:0:0:0:0:0]:0                             |
1788Done
1789```
1790
1791### networkdiagnostic get \<addr\> \<type\> ..
1792
1793Send network diagnostic request to retrieve tlv of \<type\>s.
1794
1795If \<addr\> is unicast address, `Diagnostic Get` will be sent. if \<addr\> is multicast address, `Diagnostic Query` will be sent.
1796
1797```bash
1798> networkdiagnostic get fdde:ad00:beef:0:0:ff:fe00:fc00 0 1 6
1799> DIAG_GET.rsp/ans: 00080e336e1c41494e1c01020c000608640b0f674074c503
1800Ext Address: '0e336e1c41494e1c'
1801Rloc16: 0x0c00
1802Leader Data:
1803    PartitionId: 0x640b0f67
1804    Weighting: 64
1805    DataVersion: 116
1806    StableDataVersion: 197
1807    LeaderRouterId: 0x03
1808Done
1809
1810> networkdiagnostic get ff02::1 0 1
1811> DIAG_GET.rsp/ans: 00080e336e1c41494e1c01020c00
1812Ext Address: '0e336e1c41494e1c'
1813Rloc16: 0x0c00
1814Done
1815DIAG_GET.rsp/ans: 00083efcdb7e3f9eb0f201021800
1816Ext Address: '3efcdb7e3f9eb0f2'
1817Rloc16: 0x1800
1818Done
1819```
1820
1821### networkdiagnostic reset \<addr\> \<type\> ..
1822
1823Send network diagnostic request to reset \<addr\>'s tlv of \<type\>s. Currently only `MAC Counters`(9) is supported.
1824
1825```bash
1826> diagnostic reset fd00:db8::ff:fe00:0 9
1827Done
1828```
1829
1830### networkidtimeout
1831
1832Get the NETWORK_ID_TIMEOUT parameter used in the Router role.
1833
1834```bash
1835> networkidtimeout
1836120
1837Done
1838```
1839
1840### networkidtimeout \<timeout\>
1841
1842Set the NETWORK_ID_TIMEOUT parameter used in the Router role.
1843
1844```bash
1845> networkidtimeout 120
1846Done
1847```
1848
1849### networkkey
1850
1851Get the Thread Network Key value.
1852
1853```bash
1854> networkkey
185500112233445566778899aabbccddeeff
1856Done
1857```
1858
1859### networkkey \<key\>
1860
1861Set the Thread Network Key value.
1862
1863```bash
1864> networkkey 00112233445566778899aabbccddeeff
1865Done
1866```
1867
1868### networkname
1869
1870Get the Thread Network Name.
1871
1872```bash
1873> networkname
1874OpenThread
1875Done
1876```
1877
1878### networkname \<name\>
1879
1880Set the Thread Network Name.
1881
1882**NOTE** The current commissioning credential becomes stale after changing this value. Use [pskc](#pskc--p-keypassphrase) to reset.
1883
1884```bash
1885> networkname OpenThread
1886Done
1887```
1888
1889### panid
1890
1891Get the IEEE 802.15.4 PAN ID value.
1892
1893```bash
1894> panid
18950xdead
1896Done
1897```
1898
1899### panid \<panid\>
1900
1901Set the IEEE 802.15.4 PAN ID value.
1902
1903```bash
1904> panid 0xdead
1905Done
1906```
1907
1908### parent
1909
1910Get the diagnostic information for a Thread Router as parent.
1911
1912Note: 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.
1913
1914```bash
1915> parent
1916Ext Addr: be1857c6c21dce55
1917Rloc: 5c00
1918Link Quality In: 3
1919Link Quality Out: 3
1920Age: 20
1921Done
1922```
1923
1924### parentpriority
1925
1926Get the assigned parent priority value, -2 means not assigned.
1927
1928```bash
1929> parentpriority
19301
1931Done
1932```
1933
1934### parentpriority \<parentpriority\>
1935
1936Set the assigned parent priority value: 1, 0, -1 or -2.
1937
1938```bash
1939> parentpriority 1
1940Done
1941```
1942
1943### partitionid
1944
1945Get the Thread Network Partition ID.
1946
1947```bash
1948> partitionid
19494294967295
1950Done
1951```
1952
1953### partitionid preferred
1954
1955Get the preferred Thread Leader Partition ID.
1956
1957`OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is required.
1958
1959```bash
1960> partitionid preferred
19614294967295
1962Done
1963```
1964
1965### partitionid preferred \<partitionid\>
1966
1967Set the preferred Thread Leader Partition ID.
1968
1969`OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is required.
1970
1971```bash
1972> partitionid preferred 0xffffffff
1973Done
1974```
1975
1976### ping \[-I source\] \<ipaddr\> \[size\] \[count\] \[interval\] \[hoplimit\] \[timeout\]
1977
1978Send an ICMPv6 Echo Request.
1979
1980- source: The source IPv6 address of the echo request.
1981- size: The number of data bytes to be sent.
1982- count: The number of ICMPv6 Echo Requests to be sent.
1983- interval: The interval between two consecutive ICMPv6 Echo Requests in seconds. The value may have fractional form, for example `0.5`.
1984- hoplimit: The hoplimit of ICMPv6 Echo Request to be sent.
1985- 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`.
1986
1987```bash
1988> ping fd00:db8:0:0:76b:6a05:3ae9:a61a
1989> 16 bytes from fd00:db8:0:0:76b:6a05:3ae9:a61a: icmp_seq=5 hlim=64 time=0ms
19901 packets transmitted, 1 packets received. Packet loss = 0.0%. Round-trip min/avg/max = 0/0.0/0 ms.
1991Done
1992
1993> ping -I fd00:db8:0:0:76b:6a05:3ae9:a61a ff02::1 100 1 1 1
1994> 108 bytes from fd00:db8:0:0:f605:fb4b:d429:d59a: icmp_seq=4 hlim=64 time=7ms
19951 packets transmitted, 1 packets received. Round-trip min/avg/max = 7/7.0/7 ms.
1996Done
1997```
1998
1999### ping stop
2000
2001Stop sending ICMPv6 Echo Requests.
2002
2003```bash
2004> ping stop
2005Done
2006```
2007
2008### pollperiod
2009
2010Get the customized data poll period of sleepy end device (milliseconds). Only for certification test
2011
2012```bash
2013> pollperiod
20140
2015Done
2016```
2017
2018### pollperiod \<pollperiod\>
2019
2020Set the customized data poll period for sleepy end device (milliseconds >= 10ms). Only for certification test
2021
2022```bash
2023> pollperiod 10
2024Done
2025```
2026
2027### pskc [-p] \<key\>|\<passphrase\>
2028
2029With `-p` generate pskc from \<passphrase\> (UTF-8 encoded) together with **current** network name and extended PAN ID, otherwise set pskc as \<key\> (hex format).
2030
2031```bash
2032> pskc 67c0c203aa0b042bfb5381c47aef4d9e
2033Done
2034> pskc -p 123456
2035Done
2036```
2037
2038### preferrouterid \<routerid\>
2039
2040Prefer a Router ID when solicit router id from Leader.
2041
2042```bash
2043> preferrouterid 16
2044Done
2045```
2046
2047### prefix
2048
2049Get 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.
2050
2051```bash
2052> prefix
20532001:dead:beef:cafe::/64 paros med
2054- fd00:7d03:7d03:7d03::/64 prosD med
2055Done
2056```
2057
2058### prefix add \<prefix\> [padcrosnD][prf]
2059
2060Add a valid prefix to the Network Data.
2061
2062Note: The Domain Prefix flag (`D`) is only available for Thread 1.2.
2063
2064- p: Preferred flag
2065- a: Stateless IPv6 Address Autoconfiguration flag
2066- d: DHCPv6 IPv6 Address Configuration flag
2067- c: DHCPv6 Other Configuration flag
2068- r: Default Route flag
2069- o: On Mesh flag
2070- s: Stable flag
2071- n: Nd Dns flag
2072- D: Domain Prefix flag
2073- prf: Default router preference, which may be 'high', 'med', or 'low'.
2074
2075```bash
2076> prefix add 2001:dead:beef:cafe::/64 paros med
2077Done
2078
2079> prefix add fd00:7d03:7d03:7d03::/64 prosD med
2080Done
2081```
2082
2083### prefix meshlocal
2084
2085Get the mesh local prefix.
2086
2087```bash
2088> prefix meshlocal
2089fdde:ad00:beef:0::/64
2090Done
2091```
2092
2093### prefix remove \<prefix\>
2094
2095Invalidate a prefix in the Network Data.
2096
2097```bash
2098> prefix remove 2001:dead:beef:cafe::/64
2099Done
2100```
2101
2102### promiscuous
2103
2104Get radio promiscuous property.
2105
2106```bash
2107> promiscuous
2108Disabled
2109Done
2110```
2111
2112### promiscuous enable
2113
2114Enable radio promiscuous operation and print raw packet content.
2115
2116```bash
2117> promiscuous enable
2118Done
2119```
2120
2121### promiscuous disable
2122
2123Disable radio promiscuous operation.
2124
2125```bash
2126> promiscuous disable
2127Done
2128```
2129
2130### rcp
2131
2132RCP-related commands.
2133
2134### region
2135
2136Set the radio region, this can affect the transmit power limit.
2137
2138```bash
2139> region US
2140Done
2141> region
2142US
2143Done
2144```
2145
2146### rcp version
2147
2148Print RCP version string.
2149
2150```bash
2151> rcp version
2152OPENTHREAD/20191113-00825-g82053cc9d-dirty; SIMULATION; Jun  4 2020 17:53:16
2153Done
2154```
2155
2156### releaserouterid \<routerid\>
2157
2158Release a Router ID that has been allocated by the device in the Leader role.
2159
2160```bash
2161> releaserouterid 16
2162Done
2163```
2164
2165### reset
2166
2167Signal a platform reset.
2168
2169```bash
2170> reset
2171```
2172
2173### rloc16
2174
2175Get the Thread RLOC16 value.
2176
2177```bash
2178> rloc16
21790xdead
2180Done
2181```
2182
2183### route
2184
2185Get the external route list in the local Network Data.
2186
2187```bash
2188> route
21892001:dead:beef:cafe::/64 s med
2190Done
2191```
2192
2193### route add \<prefix\> [sn][prf]
2194
2195Add a valid external route to the Network Data.
2196
2197- s: Stable flag
2198- n: NAT64 flag
2199- prf: Default Router Preference, which may be: 'high', 'med', or 'low'.
2200
2201```bash
2202> route add 2001:dead:beef:cafe::/64 s med
2203Done
2204```
2205
2206### route remove \<prefix\>
2207
2208Invalidate a external route in the Network Data.
2209
2210```bash
2211> route remove 2001:dead:beef:cafe::/64
2212Done
2213```
2214
2215### router list
2216
2217List allocated Router IDs.
2218
2219```bash
2220> router list
22218 24 50
2222Done
2223```
2224
2225### router table
2226
2227Print table of routers.
2228
2229```bash
2230> router table
2231| ID | RLOC16 | Next Hop | Path Cost | LQ In | LQ Out | Age | Extended MAC     | Link |
2232+----+--------+----------+-----------+-------+--------+-----+------------------+------+
2233| 22 | 0x5800 |       63 |         0 |     0 |      0 |   0 | 0aeb8196c9f61658 |    0 |
2234| 49 | 0xc400 |       63 |         0 |     3 |      3 |   0 | faa1c03908e2dbf2 |    1 |
2235Done
2236```
2237
2238### router \<id\>
2239
2240Print diagnostic information for a Thread Router. The `id` may be a Router ID or an RLOC16.
2241
2242```bash
2243> router 50
2244Alloc: 1
2245Router ID: 50
2246Rloc: c800
2247Next Hop: c800
2248Link: 1
2249Ext Addr: e2b3540590b0fd87
2250Cost: 0
2251Link Quality In: 3
2252Link Quality Out: 3
2253Age: 3
2254Done
2255```
2256
2257```bash
2258> router 0xc800
2259Alloc: 1
2260Router ID: 50
2261Rloc: c800
2262Next Hop: c800
2263Link: 1
2264Ext Addr: e2b3540590b0fd87
2265Cost: 0
2266Link Quality In: 3
2267Link Quality Out: 3
2268Age: 7
2269Done
2270```
2271
2272### routerdowngradethreshold
2273
2274Get the ROUTER_DOWNGRADE_THRESHOLD value.
2275
2276```bash
2277> routerdowngradethreshold
227823
2279Done
2280```
2281
2282### routerdowngradethreshold \<threshold\>
2283
2284Set the ROUTER_DOWNGRADE_THRESHOLD value.
2285
2286```bash
2287> routerdowngradethreshold 23
2288Done
2289```
2290
2291### routereligible
2292
2293Indicates whether the router role is enabled or disabled.
2294
2295```bash
2296> routereligible
2297Enabled
2298Done
2299```
2300
2301### routereligible enable
2302
2303Enable the router role.
2304
2305```bash
2306> routereligible enable
2307Done
2308```
2309
2310### routereligible disable
2311
2312Disable the router role.
2313
2314```bash
2315> routereligible disable
2316Done
2317```
2318
2319### routerselectionjitter
2320
2321Get the ROUTER_SELECTION_JITTER value.
2322
2323```bash
2324> routerselectionjitter
2325120
2326Done
2327```
2328
2329### routerselectionjitter \<jitter\>
2330
2331Set the ROUTER_SELECTION_JITTER value.
2332
2333```bash
2334> routerselectionjitter 120
2335Done
2336```
2337
2338### routerupgradethreshold
2339
2340Get the ROUTER_UPGRADE_THRESHOLD value.
2341
2342```bash
2343> routerupgradethreshold
234416
2345Done
2346```
2347
2348### routerupgradethreshold \<threshold\>
2349
2350Set the ROUTER_UPGRADE_THRESHOLD value.
2351
2352```bash
2353> routerupgradethreshold 16
2354Done
2355```
2356
2357### scan \[channel\]
2358
2359Perform an IEEE 802.15.4 Active Scan.
2360
2361- channel: The channel to scan on. If no channel is provided, the active scan will cover all valid channels.
2362
2363```bash
2364> scan
2365| J | Network Name     | Extended PAN     | PAN  | MAC Address      | Ch | dBm | LQI |
2366+---+------------------+------------------+------+------------------+----+-----+-----+
2367| 0 | OpenThread       | dead00beef00cafe | ffff | f1d92a82c8d8fe43 | 11 | -20 |   0 |
2368Done
2369```
2370
2371### scan energy \[duration\] \[channel\]
2372
2373Perform an IEEE 802.15.4 Energy Scan.
2374
2375- duration: The time in milliseconds to spend scanning each channel.
2376
2377```bash
2378> scan energy 10
2379| Ch | RSSI |
2380+----+------+
2381| 11 |  -59 |
2382| 12 |  -62 |
2383| 13 |  -67 |
2384| 14 |  -61 |
2385| 15 |  -87 |
2386| 16 |  -86 |
2387| 17 |  -86 |
2388| 18 |  -52 |
2389| 19 |  -58 |
2390| 20 |  -82 |
2391| 21 |  -76 |
2392| 22 |  -82 |
2393| 23 |  -74 |
2394| 24 |  -81 |
2395| 25 |  -88 |
2396| 26 |  -71 |
2397Done
2398```
2399
2400```bash
2401> scan energy 10 20
2402| Ch | RSSI |
2403+----+------+
2404| 20 |  -82 |
2405Done
2406```
2407
2408### service
2409
2410Module for controlling service registration in Network Data. Each change in service registration must be sent to leader by `netdata register` command before taking effect.
2411
2412### service add \<enterpriseNumber\> \<serviceData\> \<serverData\>
2413
2414Add service to the Network Data.
2415
2416- enterpriseNumber: IANA enterprise number
2417- serviceData: hex-encoded binary service data
2418- serverData: hex-encoded binary server data
2419
2420```bash
2421> service add 44970 112233 aabbcc
2422Done
2423> netdata register
2424Done
2425```
2426
2427### service remove \<enterpriseNumber\> \<serviceData\>
2428
2429Remove service from Network Data.
2430
2431- enterpriseNumber: IANA enterprise number
2432- serviceData: hext-encoded binary service data
2433
2434```bash
2435> service remove 44970 112233
2436Done
2437> netdata register
2438Done
2439```
2440
2441### singleton
2442
2443Return true when there are no other nodes in the network, otherwise return false.
2444
2445```bash
2446> singleton
2447true or false
2448Done
2449```
2450
2451### sntp query \[SNTP server IP\] \[SNTP server port\]
2452
2453Send SNTP Query to obtain current unix epoch time (from 1st January 1970). The latter two parameters have following default values:
2454
2455- NTP server IP: 2001:4860:4806:8:: (Google IPv6 NTP Server)
2456- NTP server port: 123
2457
2458```bash
2459> sntp query
2460> SNTP response - Unix time: 1540894725 (era: 0)
2461```
2462
2463You can use NAT64 of OpenThread Border Router to reach e.g. Google IPv4 NTP Server:
2464
2465```bash
2466> sntp query 64:ff9b::d8ef:2308
2467> SNTP response - Unix time: 1540898611 (era: 0)
2468```
2469
2470### state
2471
2472Return state of current state.
2473
2474```bash
2475> state
2476offline, disabled, detached, child, router or leader
2477Done
2478```
2479
2480### state <state>
2481
2482Try to switch to state `detached`, `child`, `router` or `leader`.
2483
2484```bash
2485> state leader
2486Done
2487```
2488
2489### thread start
2490
2491Enable Thread protocol operation and attach to a Thread network.
2492
2493```bash
2494> thread start
2495Done
2496```
2497
2498### thread stop
2499
2500Disable Thread protocol operation and detach from a Thread network.
2501
2502```bash
2503> thread stop
2504Done
2505```
2506
2507### thread version
2508
2509Get the Thread Version number.
2510
2511```bash
2512> thread version
25132
2514Done
2515```
2516
2517### trel enable
2518
2519Enable TREL radio link.
2520
2521`OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE` is required.
2522
2523Note: TREL radio link can be enabled only when a valid TREL URL was specified.
2524
2525```bash
2526> trel enable
2527Done
2528```
2529
2530### trel disable
2531
2532Disable TREL radio link.
2533
2534`OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE` is required.
2535
2536```bash
2537> trel disable
2538Done
2539```
2540
2541### txpower
2542
2543Get the transmit power in dBm.
2544
2545```bash
2546> txpower
2547-10 dBm
2548Done
2549```
2550
2551### txpower \<txpower\>
2552
2553Set the transmit power in dBm.
2554
2555```bash
2556> txpower -10
2557Done
2558```
2559
2560### unsecureport add \<port\>
2561
2562Add a port to the allowed unsecured port list.
2563
2564```bash
2565> unsecureport add 1234
2566Done
2567```
2568
2569### unsecureport remove \<port\>
2570
2571Remove a port from the allowed unsecured port list.
2572
2573```bash
2574> unsecureport remove 1234
2575Done
2576```
2577
2578### unsecureport remove all
2579
2580Remove all ports from the allowed unsecured port list.
2581
2582```bash
2583> unsecureport remove all
2584Done
2585```
2586
2587### unsecureport get
2588
2589Print all ports from the allowed unsecured port list.
2590
2591```bash
2592> unsecureport get
25931234
2594Done
2595```
2596
2597### version
2598
2599Print the build version information.
2600
2601```bash
2602> version
2603OPENTHREAD/gf4f2f04; Jul  1 2016 17:00:09
2604Done
2605```
2606
2607### version api
2608
2609Print API version number.
2610
2611```bash
2612> version api
261328
2614Done
2615```
2616
2617### mac retries direct
2618
2619Get the number of direct TX retries on the MAC layer.
2620
2621```bash
2622> mac retries direct
26233
2624Done
2625```
2626
2627### mac retries direct \<number\>
2628
2629Set the number of direct TX retries on the MAC layer.
2630
2631```bash
2632> mac retries direct 5
2633Done
2634```
2635
2636### mac retries indirect
2637
2638Get the number of indirect TX retries on the MAC layer.
2639
2640```bash
2641> mac retries indirect
26423
2643Done
2644```
2645
2646### mac retries indirect \<number\>
2647
2648Set the number of indirect TX retries on the MAC layer.
2649
2650```bash
2651> mac retries indirect 5
2652Done
2653```
2654
2655### mac send \<op\>
2656
2657Instruct 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.
2658
2659```bash
2660> mac send datarequest
2661Done
2662```
2663
2664```bash
2665> mac send emptydata
2666Done
2667```
2668
2669### macfilter
2670
2671List the macfilter status, including address and received signal strength filter settings.
2672
2673```bash
2674> macfilter
2675Address Mode: Allowlist
26760f6127e33af6b403 : rss -95 (lqi 1)
26770f6127e33af6b402
2678RssIn List:
26790f6127e33af6b403 : rss -95 (lqi 1)
2680Default rss : -50 (lqi 3)
2681Done
2682```
2683
2684### macfilter addr
2685
2686List the address filter status.
2687
2688```bash
2689> macfilter addr
2690Allowlist
26910f6127e33af6b403 : rss -95 (lqi 1)
26920f6127e33af6b402
2693Done
2694```
2695
2696### macfilter addr disable
2697
2698Disable address filter mode.
2699
2700```bash
2701> macfilter addr disable
2702Done
2703```
2704
2705### macfilter addr allowlist
2706
2707Enable allowlist address filter mode.
2708
2709```bash
2710> macfilter addr allowlist
2711Done
2712```
2713
2714### macfilter addr denylist
2715
2716Enable denylist address filter mode.
2717
2718```bash
2719> macfilter addr denylist
2720Done
2721```
2722
2723### macfilter addr add \<extaddr\> \[rss\]
2724
2725Add 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.
2726
2727```bash
2728> macfilter addr add 0f6127e33af6b403 -95
2729Done
2730```
2731
2732```bash
2733> macfilter addr add 0f6127e33af6b402
2734Done
2735```
2736
2737### macfilter addr remove \<extaddr\>
2738
2739Remove the IEEE802.15.4 Extended Address from the address filter.
2740
2741```bash
2742> macfilter addr remove 0f6127e33af6b402
2743Done
2744```
2745
2746### macfilter addr clear
2747
2748Clear all the IEEE802.15.4 Extended Addresses from the address filter.
2749
2750```bash
2751> macfilter addr clear
2752Done
2753```
2754
2755### macfilter rss
2756
2757List the rss filter status
2758
2759```bash
2760> macfilter rss
27610f6127e33af6b403 : rss -95 (lqi 1)
2762Default rss: -50 (lqi 3)
2763Done
2764```
2765
2766### macfilter rss add \<extaddr\> \<rss\>
2767
2768Set 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.
2769
2770```bash
2771> macfilter rss add * -50
2772Done
2773```
2774
2775```bash
2776> macfilter rss add 0f6127e33af6b404 -85
2777Done
2778```
2779
2780### macfilter rss add-lqi \<extaddr\> \<lqi\>
2781
2782Set 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
2783
2784```bash
2785> macfilter rss add-lqi * 3
2786Done
2787```
2788
2789```bash
2790> macfilter rss add 0f6127e33af6b404 2
2791Done
2792```
2793
2794### macfilter rss remove \<extaddr\>
2795
2796Removes 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.
2797
2798```bash
2799> macfilter rss remove *
2800Done
2801```
2802
2803```bash
2804> macfilter rss remove 0f6127e33af6b404
2805Done
2806```
2807
2808### macfilter rss clear
2809
2810Clear all the received signal strength or received link quality settings.
2811
2812```bash
2813> macfilter rss clear
2814Done
2815```
2816
2817### diag
2818
2819Factory Diagnostics module is enabled only when building OpenThread with `OPENTHREAD_CONFIG_DIAG_ENABLE=1` option. Go [diagnostics module][diag] for more information.
2820
2821[diag]: ../../src/core/diags/README.md
2822