UCI command usage: Difference between revisions
no edit summary
PauliusRug (talk | contribs) No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
<p style="color:red">The information on this page is updated in accordance with the [https://wiki.teltonika-networks.com/view/FW_%26_SDK_Downloads'''00.07. | <p style="color:red">The information on this page is updated in accordance with the [https://wiki.teltonika-networks.com/view/FW_%26_SDK_Downloads'''00.07.08'''] firmware version .</p> | ||
Line 16: | Line 16: | ||
*'''SSH''' - you can use UCI commands via SSH either with Linux OS's Terminal app or the PuTTY app with Windows OS (a download link is provided at the bottom of this page) | *'''SSH''' - you can use UCI commands via SSH either with Linux OS's Terminal app or the PuTTY app with Windows OS (a download link is provided at the bottom of this page) | ||
*'''CLI''' - you can use UCI commands via the Command Line Interface found in the router's ''' | *'''CLI''' - you can use UCI commands via the Command Line Interface found in the router's '''WebUI''' | ||
*'''SMS''' - you can execute UCI commands via SMS messages with the SMS Utilities '''[[SMS_Utilities#UCI_API_rule|uci api]]''' rule | *'''SMS''' - you can execute UCI commands via SMS messages with the SMS Utilities '''[[SMS_Utilities#UCI_API_rule|uci api]]''' rule | ||
*'''JSON-RPC''' - you can execute UCI commands via JSON-RPC. Refer to this guide for more information: '''[[Monitoring via JSON-RPC]]''' | *'''JSON-RPC''' - you can execute UCI commands via JSON-RPC. Refer to this guide for more information using Linux OS: '''[[https://wiki.teltonika-networks.com/view/Monitoring_via_JSON-RPC_linux_RutOS|Monitoring via JSON-RPC using Linux OS]]''' or Windows OS: '''[[https://wiki.teltonika-networks.com/view/Monitoring_via_JSON-RPC_windows_RutOS|Monitoring via JSON-RPC using Windows OS]]''' | ||
==Available commands== | ==Available commands== | ||
Line 125: | Line 126: | ||
===Sections=== | ===Sections=== | ||
---- | ---- | ||
Sections deserve some extra explanation in regard to naming. A section can be '''named''' or '''unnamed'''. Unnamed sections will get an autogenerated ID/CFGID (like " | Sections deserve some extra explanation in regard to naming. A section can be '''named''' or '''unnamed'''. Unnamed sections will get an autogenerated ID/CFGID (like "cfg01aa0e") and be presented with an anonymous-name (like "@sim[0]") | ||
Example of '''anonymous-name''' ( | Example of '''anonymous-name''' (Command executed: uci show sim_switch): | ||
... | ... | ||
sim_switch.@sim[0]=sim | |||
sim_switch.@sim[0].modem='2-1' | |||
sim_switch.@sim[0].position='1' | |||
... | ... | ||
Example of '''autogenerated ID/CFGID''' ( | Example of '''autogenerated ID/CFGID''' (Command executed: uci show sim_switch.@sim[0]): | ||
... | ... | ||
sim_switch.cfg01aa0e=sim | |||
sim_switch.cfg01aa0e.modem='2-1' | |||
sim_switch.cfg01aa0e.position='1' | |||
... | ... | ||
===Configuration files=== | ===Configuration files=== | ||
---- | ---- | ||
This section provides a list of all available configuration files of RUT routers. Note that these are all possible config files from any RUT router ([ | This section provides a list of all available configuration files of RUT routers. Note that these are all possible config files from any RUT router ([https://wiki.teltonika-networks.com/view/RUT200 RUT200],[https://wiki.teltonika-networks.com/view/RUT241 RUT241], [https://wiki.teltonika-networks.com/view/RUT956 RUT956], [https://wiki.teltonika-networks.com/view/RUTX11 RUTX11], [https://wiki.teltonika-networks.com/view/RUTX50 RUTX50]) and that therefore some of them may not exist in your router. | ||
{| class="wikitable" | {| class="wikitable" | ||
Line 186: | Line 185: | ||
! style="text-align: left; vertical-align: top;" | /etc/config/gps | ! style="text-align: left; vertical-align: top;" | /etc/config/gps | ||
| style="text-align: left; vertical-align: top;" | Configures settings for the Global Positioning System (GPS) | | style="text-align: left; vertical-align: top;" | Configures settings for the Global Positioning System (GPS) | ||
|- | |- | ||
! style="text-align: left; vertical-align: top;" | /etc/config/iojuggler | ! style="text-align: left; vertical-align: top;" | /etc/config/iojuggler | ||
Line 201: | Line 197: | ||
! style="text-align: left; vertical-align: top;" | /etc/config/ipsec | ! style="text-align: left; vertical-align: top;" | /etc/config/ipsec | ||
| style="text-align: left; vertical-align: top;" | Configures settings for the IPsec VPN | | style="text-align: left; vertical-align: top;" | Configures settings for the IPsec VPN | ||
|- | |- | ||
! style="text-align: left; vertical-align: top;" | /etc/config/mdcollectd | ! style="text-align: left; vertical-align: top;" | /etc/config/mdcollectd | ||
Line 211: | Line 204: | ||
| style="text-align: left; vertical-align: top;" | Configures settings for the Modbus protocol | | style="text-align: left; vertical-align: top;" | Configures settings for the Modbus protocol | ||
|- | |- | ||
! style="text-align: left; vertical-align: top;" | /etc/config/ | ! style="text-align: left; vertical-align: top;" | /etc/config/modbus_client | ||
| style="text-align: left; vertical-align: top;" | | | style="text-align: left; vertical-align: top;" | Configures the device as a Modbus client. | ||
|- | |- | ||
! style="text-align: left; vertical-align: top;" | /etc/config/ | ! style="text-align: left; vertical-align: top;" | /etc/config/modbus_server | ||
| style="text-align: left; vertical-align: top;" | Configures the device as a Modbus | | style="text-align: left; vertical-align: top;" | Configures the device as a Modbus server. | ||
|- | |- | ||
! style="text-align: left; vertical-align: top;" | /etc/config/modbusgateway | ! style="text-align: left; vertical-align: top;" | /etc/config/modbusgateway | ||
Line 306: | Line 299: | ||
! style="text-align: left; vertical-align: top;" | /etc/config/snmptrap | ! style="text-align: left; vertical-align: top;" | /etc/config/snmptrap | ||
| style="text-align: left; vertical-align: top;" | Configures settings for SNMP traps. | | style="text-align: left; vertical-align: top;" | Configures settings for SNMP traps. | ||
|- | |- | ||
! style="text-align: left; vertical-align: top;" | /etc/config/system | ! style="text-align: left; vertical-align: top;" | /etc/config/system | ||
Line 347: | Line 334: | ||
The '''uci get''' command returns values for specific options. When using uci get, you have provide the correct path to the option that you are looking for. For example, in order to obtain the Wi-Fi Access Point's SSID you would have to use a command that looks like this: | The '''uci get''' command returns values for specific options. When using uci get, you have provide the correct path to the option that you are looking for. For example, in order to obtain the Wi-Fi Access Point's SSID you would have to use a command that looks like this: | ||
# <span style=color:purple>uci get</span> <span style=color:red>wireless</span>.<span style=color:blue> | # <span style=color:purple>uci get</span> <span style=color:red>wireless</span>.<span style=color:blue>default_radio0</span>.<span style=color:green>ssid</span> | ||
Response: | Response: | ||
[[File: | [[File:Uci_get_wireless_ssid_response_7.8.png]] | ||
The command above returns the Wi-Fi Access Point's SSID. As you can see the <span style=color:purple>uci get</span> command is used. What follows after the command is the path to the value that we're looking for (SSID, in this case). The SSID value can be found in the <span style=color:red>wireless</span> config, the <span style=color:blue> | The command above returns the Wi-Fi Access Point's SSID. As you can see the <span style=color:purple>uci get</span> command is used. What follows after the command is the path to the value that we're looking for (SSID, in this case). The SSID value can be found in the <span style=color:red>wireless</span> config, the <span style=color:blue>.default_radio0</span> section, stored under an option called <span style=color:green>ssid</span>. So the basic syntax for a uci get command is this: | ||
# <span style=color:purple>uci get</span> <span style=color:red><config></span>.<span style=color:blue><section></span>[.<span style=color:green><option></span>] | # <span style=color:purple>uci get</span> <span style=color:red><config></span>.<span style=color:blue><section></span>[.<span style=color:green><option></span>] | ||
Line 365: | Line 352: | ||
Response: | Response: | ||
[[File: | [[File:Uci_show_wireless_7.8.png]] | ||
As you can see, the response shows the entire wireless config and its entities. Note that instead of just showing values (like in the case of uci get) you can see the config name, section name and option name before each one. | As you can see, the response shows the entire wireless config and its entities. Note that instead of just showing values (like in the case of uci get) you can see the config name, section name and option name before each one. | ||
Line 373: | Line 360: | ||
# <span style=color:purple>ls /etc/config</span> | # <span style=color:purple>ls /etc/config</span> | ||
The ls command is used to view the contents of a directory. Here is an example of the /etc/config directory of a | The ls command is used to view the contents of a directory. Here is an example of the /etc/config directory of a RUTX50 router: | ||
[[File: | [[File:Uci_ls_config_7.8.png]] | ||
So when you plan on obtaining specific parameters or setting parameter values, you should always start with finding out option and section names. To accomplish this, we recommend using the uci show <config> commands. | So when you plan on obtaining specific parameters or setting parameter values, you should always start with finding out option and section names. To accomplish this, we recommend using the uci show <config> commands. | ||
Line 387: | Line 374: | ||
The '''uci set''' command is used to set the values of specific options. It can set only one option at a time. For example, this time lets try changing the Wi-Fi Access Point's SSID to ''wifi_set_by_uci'': | The '''uci set''' command is used to set the values of specific options. It can set only one option at a time. For example, this time lets try changing the Wi-Fi Access Point's SSID to ''wifi_set_by_uci'': | ||
# <span style=color:purple>uci set</span> wireless. | # <span style=color:purple>uci set</span> wireless.default_radio0.ssid=wifi_set_by_uci | ||
As you may have noticed, the command is very similar to uci get, except it has an equals to (''''='''') sign added at the end and after the sign is the value that we want to assign to the option. | As you may have noticed, the command is very similar to uci get, except it has an equals to (''''='''') sign added at the end and after the sign is the value that we want to assign to the option. | ||
Line 405: | Line 392: | ||
... | ... | ||
wireless. | wireless.default_radio0.macfilter=deny | ||
wireless. | wireless.default_radio0.maclist=15:15:12:64:66:14 15:15:12:64:66:15 15:15:12:64:66:16 | ||
... | ... | ||
As an add_list usage example, lets add these MAC addresses to the list: 11:11:11:11:11:11, 22:22:22:22:22:22, 33:33:33:33:33:33 | As an add_list usage example, lets add these MAC addresses to the list: 11:11:11:11:11:11, 22:22:22:22:22:22, 33:33:33:33:33:33 | ||
# uci add_list wireless. | # uci add_list wireless.default_radio0.maclist=11:11:11:11:11:11 | ||
# uci add_list wireless. | # uci add_list wireless.default_radio0.maclist=22:22:22:22:22:22 | ||
# uci add_list wireless. | # uci add_list wireless.default_radio0.maclist=33:33:33:33:33:33 | ||
# uci commit wireless | # uci commit wireless | ||
# /etc/init.d/wireless restart | # /etc/init.d/wireless restart |