Changes

18,513 bytes added ,  12:10, 24 July 2019
m
Line 4: Line 4:     
UCI commands provide the user with the maximum degree of control since they can be issued via many different forms of router monitoring and administration (SSH, CLI, SMS, JSON-RPC) and can be used to set or get any router parameter. This chapter is a guide on how to use UCI commands with RUT devices.
 
UCI commands provide the user with the maximum degree of control since they can be issued via many different forms of router monitoring and administration (SSH, CLI, SMS, JSON-RPC) and can be used to set or get any router parameter. This chapter is a guide on how to use UCI commands with RUT devices.
 +
 +
==How do I execute UCI commands?==
 +
 +
UCI commands can executed via the following methods:
 +
 +
*'''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|WebUI]]'''
 +
 +
*'''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]]'''
    
==Available commands==
 
==Available commands==
Line 92: Line 104:  
  -X          do not use extended syntax on 'show'
 
  -X          do not use extended syntax on 'show'
   −
==Obtaining parameters==
+
==Configuration hierarchy==
 
  −
This section will overview uci get and uci show commands used to obtain router parameters as well as provide some basic knowledge on configuration hierarchy needed to successfully use most uci commands.
     −
===Configuration hierarchy===
  −
----
   
UCI commands can be used to set and obtain parameters, but to do so, one has to first know the names of the '''config''' file, its '''section''' and the '''option''' that they are trying to interact with. Different configurations for different router functions and services are stored in config files. These config files have sections and section usually store multiple options
 
UCI commands can be used to set and obtain parameters, but to do so, one has to first know the names of the '''config''' file, its '''section''' and the '''option''' that they are trying to interact with. Different configurations for different router functions and services are stored in config files. These config files have sections and section usually store multiple options
   Line 108: Line 116:  
* values: value of an option
 
* values: value of an option
   −
[[File:Uci config hierarchy v2.png]]
+
[[File:Uci config hierarchy v3.jpg|1000px]]
   −
====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 "cfg023579") and be presented with an anonymous-name (like "@wifi-iface[0]")
 
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 "cfg023579") and be presented with an anonymous-name (like "@wifi-iface[0]")
Line 131: Line 139:  
  wireless.cfg023579.mode=ap
 
  wireless.cfg023579.mode=ap
 
  ...
 
  ...
 +
 +
===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 ([[RUT230]], [[RUT240]], [[RUT850]], [[RUT950]], [[RUT955]]) and that therefore some of them may not exist in your router.
 +
 +
{| class="wikitable"
 +
|+
 +
! style="width: 250px; background: black; color: white;"  | File
 +
! style="width: 340px; background: black; color: white;"  | Description
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/auto_update
 +
| style="text-align: left; vertical-align: top;" | Stores FOTA configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/blocklist
 +
| style="text-align: left; vertical-align: top;" | Stores the list of blocked hosts
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/call_utils
 +
| style="text-align: left; vertical-align: top;" | Stores Call Utilities configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/cam_monitoring
 +
| style="text-align: left; vertical-align: top;" | Stores Camera Monitoring configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/cli
 +
| style="text-align: left; vertical-align: top;" | Stores CLI configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/coovachilli
 +
| style="text-align: left; vertical-align: top;" | Stores FTP upload configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/data_limit
 +
| style="text-align: left; vertical-align: top;" | Stores Mobile Data Limit configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/ddns
 +
| style="text-align: left; vertical-align: top;" | Stores Dynamic DNS configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/ddos
 +
| style="text-align: left; vertical-align: top;" | Stores DDOS Prevention configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/dhcp
 +
| style="text-align: left; vertical-align: top;" | Stores Dnsmasq configuration and DHCP settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/dropbear
 +
| style="text-align: left; vertical-align: top;" | Stores List Of Blocked Addresses configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/easycwmp
 +
| style="text-align: left; vertical-align: top;" | Stores EasyCwmp configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/events_reporting
 +
| style="text-align: left; vertical-align: top;" | Stores Events Reporting rules configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/eventslog_report
 +
| style="text-align: left; vertical-align: top;" | Stores Reporting Configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/firewall
 +
| style="text-align: left; vertical-align: top;" | Stores Firewall rules configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/fstab
 +
| style="text-align: left; vertical-align: top;" | Stores network Shares configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/gps
 +
| style="text-align: left; vertical-align: top;" | Stores GPS configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/gre_tunnel
 +
| style="text-align: left; vertical-align: top;" | Stores GRE Tunnel configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/hostblock
 +
| style="text-align: left; vertical-align: top;" | Stores Blocked Hosts' settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/hotspot_scheduler
 +
| style="text-align: left; vertical-align: top;" | Stores Hotspot Scheduler configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/hwinfo
 +
| style="text-align: left; vertical-align: top;" | Stores Hardware Information
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/ioman
 +
| style="text-align: left; vertical-align: top;" | Stores Input/Output status and label configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/kmod_man
 +
| style="text-align: left; vertical-align: top;" | Stores Linux Kernel modules configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/landingpage
 +
| style="text-align: left; vertical-align: top;" | Stores Landing Page configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/load_balancing
 +
| style="text-align: left; vertical-align: top;" | Stores Load Balancing configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/logtrigger
 +
| style="text-align: left; vertical-align: top;" | Stores some Access Control (Safety) configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/luci
 +
| style="text-align: left; vertical-align: top;" | Base LuCI config
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/mdcollectd
 +
| style="text-align: left; vertical-align: top;" | Stores ''mdcollect'' configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/mosquitto
 +
| style="text-align: left; vertical-align: top;" | Stores MQTT configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/mqtt_pub
 +
| style="text-align: left; vertical-align: top;" | Stores MQTT Publisher configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/modbus
 +
| style="text-align: left; vertical-align: top;" | Stores Modbus configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/multiwan
 +
| style="text-align: left; vertical-align: top;" | Stores Multiwan (backup WAN) configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/network
 +
| style="text-align: left; vertical-align: top;" | Stores Network (LAN, WAN, Mobile interface) interface configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/ntpclient
 +
| style="text-align: left; vertical-align: top;" | Stores NTP configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/openvpn
 +
| style="text-align: left; vertical-align: top;" | Stores OpenVPN configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/operctl
 +
| style="text-align: left; vertical-align: top;" | Stores Operator List configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/output_control
 +
| style="text-align: left; vertical-align: top;" | Stores Output Control settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/overview
 +
| style="text-align: left; vertical-align: top;" | Stores Overview page configuration settings (displayed widgets)
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/periodic_reboot
 +
| style="text-align: left; vertical-align: top;" | Stores Periodic Reboot configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/ping_reboot
 +
| style="text-align: left; vertical-align: top;" | Stores Ping Reboot configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/portscan
 +
| style="text-align: left; vertical-align: top;" | Stores Port Scan Prevention configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/pptpd
 +
| style="text-align: left; vertical-align: top;" | Stores PPTP configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/privoxy
 +
| style="text-align: left; vertical-align: top;" | Stores Proxy Based URL Content Blocker configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/profiles
 +
| style="text-align: left; vertical-align: top;" | Stores router Configuration Profile settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/qos
 +
| style="text-align: left; vertical-align: top;" | Stores QoS configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/quagga
 +
| style="text-align: left; vertical-align: top;" | Stores Dynamic Routing configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/racoon
 +
| style="text-align: left; vertical-align: top;" | Stores racoon IPsec daemon settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/radius
 +
| style="text-align: left; vertical-align: top;" | Stores Internal RADIUS server configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/reregister
 +
| style="text-align: left; vertical-align: top;" | Stores Force LTE network configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/rms_connect
 +
| style="text-align: left; vertical-align: top;" | Stores Remote Monitoring configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/rpcd
 +
| style="text-align: left; vertical-align: top;" | Stores Login settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/rs
 +
| style="text-align: left; vertical-align: top;" | Stores RS232 and RS485 configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/samba
 +
| style="text-align: left; vertical-align: top;" | Stores SAMBA configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/sim_idle_protection
 +
| style="text-align: left; vertical-align: top;" | Stores SIM Idle Protection configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/sim_switch
 +
| style="text-align: left; vertical-align: top;" | Stores SIM Switching configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/simcard
 +
| style="text-align: left; vertical-align: top;" | Stores SIM card (general Mobile) configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/smpp_config
 +
| style="text-align: left; vertical-align: top;" | Stores SMPP configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/sms_gateway
 +
| style="text-align: left; vertical-align: top;" | Stores SMS Forwarding and Post/Get configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/sms_utils
 +
| style="text-align: left; vertical-align: top;" | Stores SMS Utilities rules configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/smscollect
 +
| style="text-align: left; vertical-align: top;" | Stores SMS collector (used for on SMS limit SIM switch) settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/snmpd
 +
| style="text-align: left; vertical-align: top;" | Stores SNMP configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/static_arp
 +
| style="text-align: left; vertical-align: top;" | Stores Static ARP Entries configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/strongswan
 +
| style="text-align: left; vertical-align: top;" | Stores IPsec configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/system
 +
| style="text-align: left; vertical-align: top;" | Stores various system settings (e.g., modem settings, reset button settings, router's hostname, etc.)
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/teltonika
 +
| style="text-align: left; vertical-align: top;" | Stores basic Teltonika router configuration settings (e.g., whether password was changed, whether WAN information is to be displayed in the login window)
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/ucitrack
 +
| style="text-align: left; vertical-align: top;" | Stores ''init'' script information
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/uhttpd
 +
| style="text-align: left; vertical-align: top;" | Stores RMS configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/upnpd
 +
| style="text-align: left; vertical-align: top;" | Stores UPNP configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/vrrpd
 +
| style="text-align: left; vertical-align: top;" | Stores VRRP configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/wget_reboot
 +
| style="text-align: left; vertical-align: top;" | Stores Wget Reboot configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/wireless
 +
| style="text-align: left; vertical-align: top;" | Stores Wireless Acces Point and Wireless Station configuration settings
 +
|-
 +
! style="text-align: left; vertical-align: top;" | /etc/config/xl2tpd
 +
| style="text-align: left; vertical-align: top;" | Stores L2TP configuration settings
 +
|-
 +
|}
 +
 +
==Obtaining parameters==
 +
 +
This section will overview uci get and uci show commands used to obtain router parameters, option and section names and contents of entire configs or sections.
    
===UCI get===
 
===UCI get===
Line 142: Line 381:  
[[File:Uci get wireless ssid response.png]]
 
[[File:Uci get wireless ssid response.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>@wifi-iface[0]</span> section, stored in an option called <span style=color:green>ssid</span>. So the basic syntax for a uci get command is this:
+
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>@wifi-iface[0]</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 156: Line 395:  
[[File:Uci show wireless response v2.png]]
 
[[File:Uci show wireless response v2.png]]
   −
As you can see, this time the response shows the entire wireless config and 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.
   −
Most config file names are simple. Wireless config is called wireless, OpenVPN config is called openvpn, etc. But even so one doesn't necessarily have to know what a config file is called, especially before interacting with it. To see the names of all config files you can use the '''ls''' command. Since RUT configs ar stored in '''/etc/config''', the full commands should look like this:
+
Most config file names are simple. Wireless config is called wireless, OpenVPN config is called openvpn, etc. But even so one doesn't necessarily have to know what a config file is called, especially before interacting with it. To see the names of all config files and what kind of settings they store you can refer to the '''[[UCI_command_usage#Configuration_files|table above]]'''. Or if you're CLI or SSH and want to check the names of config files on the spot, you can use the '''ls''' command. Since RUT configs ar stored in '''/etc/config''', the full commands should look like this:
    
  # <span style=color:purple>ls /etc/config</span>
 
  # <span style=color:purple>ls /etc/config</span>
Line 165: Line 404:     
[[File:Uci ls config.png]]
 
[[File:Uci ls config.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.
    
==Setting parameters==
 
==Setting parameters==
Line 187: Line 428:  
===UCI add_list===
 
===UCI add_list===
 
----
 
----
Some variables hold more than one value unlike options. These variables are called '''lists'''. For example, if you use MAC filter on your Wi-Fi Acsess point, the MAC addresses are saved not as options but as a list.
+
Some variables hold more than one value, unlike options. These variables are called '''lists'''. For example, if you use MAC filter on your Wi-Fi Access point, the MAC addresses are saved not as options but as a list.
    
Example of maclist (cmd: uci show wireless):
 
Example of maclist (cmd: uci show wireless):
Line 207: Line 448:     
===Extensive example===
 
===Extensive example===
 
+
----
 
With all that we have learned lets try a more complicated example: lets you want to create an OpenVPN server. The server will be called '''MyServer''', will use a '''TUN''' type interface and '''TLS''' authentication. In order to create this server we will first have to create a section for the server in the openvpn config:
 
With all that we have learned lets try a more complicated example: lets you want to create an OpenVPN server. The server will be called '''MyServer''', will use a '''TUN''' type interface and '''TLS''' authentication. In order to create this server we will first have to create a section for the server in the openvpn config:
   −
  # uci uci add openvpn server_MyServer
+
  # uci add openvpn server_MyServer
 
  # uci set openvpn.server_MyServer=openvpn
 
  # uci set openvpn.server_MyServer=openvpn
   Line 258: Line 499:     
===Site Blocking===
 
===Site Blocking===
 +
----
 +
This example will provide instructions on how to enable RUT routers' Site Blocking feature and how to add hostnames to the Blacklist or Whitelist using only UCI commands. For the sake of our example lets say that you want to create a Blacklist that excludes access to all sites contained within the list. The sites in question are <nowiki>www.facebook.com</nowiki>, <nowiki>www.youtube.com</nowiki> and <nowiki>9gag.com</nowiki>.
   −
This example will provide instructions on how to enable RUT routers' Site Blocking feature and how to add hostnames to the Blacklist or Whitelist.  Let's say for the sake of our example that you want to create a Blacklist that excludes access to all sites contained within the list. The sites in question are <nowiki>www.facebook.com</nowiki>, <nowiki>www.youtube.com</nowiki> and <nowiki>9gag.com</nowiki>.
+
To achieve such a task, the first relevant piece of required information is the config name, '''hostblock''', where all the necessary configuration settings are stored. The next important thing to know is that each different website must be stored in a separate section of the type '''block'''. So we'll need to create a new section and enable each added element. Lets start:
 
  −
To achieve such a task, the first relevant piece of required information is the config name, '''hostblock''', where all the necessary configuration lines are stored. The next important thing to know is that each different website must be stored in a separate section of the type '''block'''. So we'll need to create a new section and enable each added element. Let's start:
      
First element:
 
First element:
Line 281: Line 522:  
  # uci set hostblock.config.enabled=1
 
  # uci set hostblock.config.enabled=1
   −
Last steps:
+
Final steps:
 
  # uci commit hostblock
 
  # uci commit hostblock
 
  # luci-reload
 
  # luci-reload
 +
 +
The first-third steps add hostnames of the websites to be blocked, which are saved under the option ''host''. Each of the first three elements also need to be enabled, therefore, the option ''enabled'' is set to ''1'' next to each host. The fourth step is for enabling the Site Blocking service (by setting the option ''enabled'' in section ''config'' to ''1'').
 +
===DHCP Server===
 +
----
 +
This example will provide instructions on how configure RUT routers' DHCP Server using only UCI commands. For the sake of the example lets say that you want to change the dhcp range to ''192.168.1.2'' - ''192.168.1.200'' and the lease time to ''30 minutes''
 +
 +
To achieve such a task, the first relevant piece of required information is the config name, '''dhcp''', where all the necessary configuration settings are stored. Another important thing to know is that when changing the lease time, three options are relevant - the time (option ''time''), the unit of time measurement (option ''letter'') and lease time(option ''leasetime), which is basically ''time'' ''+'' ''letter'', e.g., 12 hour lease time is ''12h''. Other options in question are start address (option ''start'') and address limit (option ''limit''). Lets start:
 +
 +
Setting start address and limit:
 +
# uci set dhcp.lan.start=2
 +
# uci set dhcp.lan.limit=199
 +
 +
Setting lease time
 +
# uci set dhcp.lan.letter=m
 +
# uci set dhcp.lan.time=30
 +
# uci set dhcp.lan.leasetime=30m
 +
 +
Final steps:
 +
# uci commit dhcp
 +
# luci-reload
 +
 +
The first step sets the start address to 2 and the limit of addresses to 199. The value of the ''start'' option is associated with the last section of an IP address (if start value is '''2''' then the starting IP address is 192.168.1.'''2'''(provided that the router's LAN IP is in the 192.168.1.0/24 network)), the value of the ''limit'' option denotes how many IP addresses can be leased out starting from and including the the start address. Then the second step is used to set the lease time. The ''letter'' option specifies the unit of time measurement (either ''m'' for minutes or ''h'' for hours). The ''time'' option specifies number of minutes (or hours in other cases) and the ''leasetime'' option is just the representation (nonetheless, it's still mandatory) of the previous two values, i.e., 30m - thirty minutes.
 +
 +
===Mobile Data Limit===
 +
----
 +
This example will provide instructions on how configure Mobile Data Limit and SMS Warning on RUT routers' using only UCI commands. For the sake of the example lets say that you want to set up a data limit of 1 GB with the limit counter restarting everyday at 10 a.m. and an SMS Warning that sends out a message when the 800 MB threshold is reached that also restarts everyday at 10 a.m.
 +
 +
To achieve such a task, the first relevant piece of required information is the config name, '''data_limit''', where all the necessary configuration settings are stored. This task will require the knowledge of many mandatory option so lets begin the step-by-step part (comments will be provided along with each step and a short summary afterwards):
 +
 +
Enabling Mobile Data Limit and SMS Warning:
 +
# uci set data_limit.limit.prim_enb_conn=1
 +
# uci set data_limit.limit.prim_end_wrn=1
 +
 +
Setting the Mobile Data and SMS Warning limits:
 +
# uci set data_limit.limit.prim_conn_limit=1000
 +
# uci set data_limit.limit.prim_wrn_limit=800
 +
 +
Setting the Mobile Data Limit period:
 +
# uci set data_limit.limit.prim_conn_period=day
 +
# uci set data_limit.limit.prim_conn_hour=10
 +
 +
Setting the SMS Warning period and phone number:
 +
# uci set data_limit.limit.prim_wrn_period=day
 +
# uci set data_limit.limit.prim_wrn_hour=10
 +
# uci set data_limit.limit.prim_wrn_number=+37012345678
 +
 +
The first enables both SMS Warning and Mobile Data Limit services by setting the options ''prim_enb_conn'' and ''prim_enb_wrn'' to ''1''. The second step sets up the to limits by setting the options ''prim_conn_limit'' and ''prim_wrn_limit'' to ''1000'' and ''800'' respectively. The third step specifies the frequency at which Mobile Data Limit will be reset. The option ''prim_conn_period'' can take values ''month'', ''week'' or in this case, ''day'', and ''prim_conn_hour'' indicates the hour of the day (in this case, ''10''). The fourth step sets up the SMS Warning period in the same manner and also adds the phone number ''+37012345678'' to the option ''prim_wrn_number''
 +
 +
==External links==
 +
 +
* https://wiki.openwrt.org/doc/uci?do= - OpenWRT wiki page on the UCI system
 +
* https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html - PuTTY downloads page
0

edits

Navigation menu