Changes

470 bytes removed ,  14:39, 2 August 2023
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.4'''] firmware version .</p>
 +
 +
 
'''Unified Configuration Interface''' ('''UCI''') is a small utility written in C (a shell script-wrapper is available as well) and is intended to centralize the whole configuration of a device running on OpenWrt.
 
'''Unified Configuration Interface''' ('''UCI''') is a small utility written in C (a shell script-wrapper is available as well) and is intended to centralize the whole configuration of a device running on OpenWrt.
 +
 
__TOC__
 
__TOC__
   Line 446: Line 450:  
  # uci add_list openvpn.server_MyServer.push="route 192.168.56.0 255.255.255.0'
 
  # uci add_list openvpn.server_MyServer.push="route 192.168.56.0 255.255.255.0'
   −
And don't forget to ''uci commit'' and ''luci-reload'':
+
And don't forget to ''uci commit'' and ''restart the daemon'':
    
  # uci commit openvpn
 
  # uci commit openvpn
  # luci-reload
+
  # /etc/init.d/openvpn restart
    
A few notes about the configuration:
 
A few notes about the configuration:
Line 492: Line 496:  
Final steps:
 
Final steps:
 
  # uci commit hostblock
 
  # uci commit hostblock
  # luci-reload
+
  # /etc/init.d/hostblock restart
    
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'').
 
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'').
Line 499: Line 503:  
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''  
 
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:
+
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. ''Lets start:''
    
Setting start address and limit:
 
Setting start address and limit:
Line 506: Line 510:     
Setting lease time
 
Setting lease time
# uci set dhcp.lan.letter=m
  −
# uci set dhcp.lan.time=30
   
  # uci set dhcp.lan.leasetime=30m
 
  # uci set dhcp.lan.leasetime=30m
    
Final steps:
 
Final steps:
 
  # uci commit dhcp
 
  # uci commit dhcp
  # luci-reload
+
  # /etc/init.d/dhcp restart
    
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.
 
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.
Line 520: Line 522:  
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.  
 
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):
+
To achieve such a task, the first relevant piece of required information is the config name, '''quota_limit''', where all the necessary configuration settings are stored:
    
Enabling Mobile Data Limit and SMS Warning:
 
Enabling Mobile Data Limit and SMS Warning:
  # uci set data_limit.limit.prim_enb_conn=1
+
  # uci set quota_limit.mob1s1a1=interface
  # uci set data_limit.limit.prim_end_wrn=1
+
# uci set quota_limit.mob1s1a1.enabled='1'
 +
# uci set quota_limit.mob1s1a1.ifname='mob1s1a1'
 +
# uci set quota_limit.mob1s1a1.reset_hour='10'
 +
# uci set quota_limit.mob1s1a1.sim='1'
 +
# uci set quota_limit.mob1s1a1.data_limit='10000'
 +
# uci set quota_limit.mob1s1a1.enable_warning='1'
 +
  # uci set quota_limit.mob1s1a1.period='1'
 +
# uci set quota_limit.mob1s1a1.warning_limit='8000'
 +
# uci set quota_limit.mob1s1a1.warning_num='+37012345678'
   −
Setting the Mobile Data and SMS Warning limits:
+
Commit changes and restart the daemon
# 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 commit quota_limit
  # uci set data_limit.limit.prim_conn_period=day
+
  # /etc/init.d/quota_limit restart
  # 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''
+
'''Disabling / Deleting configuration'''
 +
-----
 +
Let us take the above example and disable the data limit using '''uci'''. For this, we simply need to change the "enabled" value to '0':
 +
# uci set quota_limit.mob1s1a1.enabled='0'
 +
# uci commit quota_limit
 +
# /etc/init.d/quota_limit restart
 +
 
 +
If you wish to delete the whole configuration, '''uci delete''' can be used. Let us delete the entire block of configuration of mob1s1a1 interface:
 +
# uci delete quota_limit.mob1s1a1
 +
# uci commit quota_limit
 +
# /etc/init.d/quota_limit restart
    
==External links==
 
==External links==
Line 545: Line 558:  
* https://wiki.openwrt.org/doc/uci?do= - OpenWRT wiki page on the UCI system
 
* 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
 
* https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html - PuTTY downloads page
 +
 +
[[Category:Router control and monitoring]]

Navigation menu