Differences

This shows you the differences between two versions of the page.

doc:uci [2013/01/09 14:45]
steven
doc:uci [2013/06/05 19:10] (current)
lorema
Line 1: Line 1:
====== The UCI System ====== ====== The UCI System ======
-The abbreviation //UCI// stands for //**__U__**nified **__C__**onfiguration **__I__**nterface// and is intended to centralize the configuration of OpenWrt. +The abbreviation [[doc:techref:uci|UCI]] stands for //**__U__**nified **__C__**onfiguration **__I__**nterface// and is intended to centralize the configuration of OpenWrt.
-Configuration should be easy, straight forward and documented here, making life easier! (UCI is the successor to the nvram-based configuration found in the White Russian series of OpenWrt.)+Configuration should be easy, straightforward and documented here, making life easier! UCI is the successor to the NVRAM-based configuration found in the White Russian series of OpenWrt.
-Many programs have their own config files lying around somewhere, like ''/etc/network/interfaces'' or ''/etc/exports'' or ''/etc/dnsmasq.conf'' ''/etc/samba/samba.conf'' and they often use different syntax. With OpenWrt you don't have to bother with any of them and only need to change the UCI configuration files!+Many programs have their own configuration files lying around somewhere, like ''/etc/network/interfaces'', ''/etc/exports'', ''/etc/dnsmasq.conf'' or ''/etc/samba/samba.conf'' and they often use different syntaxes. With OpenWrt you don't have to bother with any of them and only need to change the UCI configuration files.
-You no longer have to reboot your system to make configuration changes! You can use the [[doc:uci#command.line.utility|UCI command line utility]] instead. And please do not forget that quite some daemons are included in the official binaries, but they are not enabled by default! For example the cron daemon is not activated by default, thus only editing the crontab won't do anything. You have to either start the daemon with ''/etc/init.d/cron start'' or enable it with ''/etc/init.d/cron enable''. You can ''disable'', ''stop'' and ''restart'' most of those daemons, too. There are some [[doc:howto:notuci.config]] you may want to tend to.+You no longer have to reboot your system to make configuration changes. You can use the [[doc:uci#command.line.utility|UCI command line utility]] instead. And please do not forget that quite some daemons are included in the official binaries, but they are not enabled by default! For example the ''cron'' daemon is not activated by default, thus only editing the ''crontab'' won't do anything. You have to either start the daemon with ''/etc/init.d/cron start'' or enable it with ''/etc/init.d/cron enable''. You can ''disable'', ''stop'' and ''restart'' most of those daemons, too. There are some [[doc:howto:notuci.config|not UCI configuration files]] you may want to tend to.
===== Common Principles ===== ===== Common Principles =====
Line 25: Line 25:
| [[doc:uci:wireless|/etc/config/wireless]] | Wireless settings and wifi network definition | | [[doc:uci:wireless|/etc/config/wireless]] | Wireless settings and wifi network definition |
^ IPv6 ^^ ^ IPv6 ^^
-| [[doc:uci:6relayd|/etc/config/6relayd]] | IPv6-Relay and Server (RD, DHCPv6 & NDP-Proxy) |+| [[doc:uci:6relayd|/etc/config/6relayd]] | IPv6-Server and Relay (RD, DHCPv6 & NDP) |
| [[doc:uci:ahcpd|/etc/config/ahcpd]] | Ad-Hoc Configuration Protocol (AHCP) server and forwarder configuration | | [[doc:uci:ahcpd|/etc/config/ahcpd]] | Ad-Hoc Configuration Protocol (AHCP) server and forwarder configuration |
| [[doc:uci:aiccu|/etc/config/aiccu]] | AICCU client configuration | | [[doc:uci:aiccu|/etc/config/aiccu]] | AICCU client configuration |
Line 202: Line 202:
80 80
root@OpenWrt:~#'' | root@OpenWrt:~#'' |
 +
 +=== append an entry to a list ===
 +
 +| ''uci add_list system.ntp.server='0.de.pool.ntp.org''' |
 +
 +=== replace a list completely ===
 +
 +| ''uci delete system.ntp.server
 +uci add_list system.ntp.server='0.de.pool.ntp.org'
 +uci add_list system.ntp.server='1.de.pool.ntp.org'
 +uci add_list system.ntp.server='2.de.pool.ntp.org'
 +'' |
=== UCI paths === === UCI paths ===
Line 291: Line 303:
=== Get WAN IP address === === Get WAN IP address ===
-  * Backfire <code>uci -P/var/state get network.wan.ipaddr</code> +  * Backfire <code bash>uci -P/var/state get network.wan.ipaddr</code> 
-  * Trunk (not really uci) <code>. /lib/functions/network.sh; network_get_ipaddr ip wan; echo $ip</code>+  * The uci state vars are deprecated and not used anymore for network related information. In Trunk (not really uci) do <code bash>. /lib/functions/network.sh; network_get_ipaddr ip wan; echo $ip</code> 
 + 
 +=== Get WAN interface === 
 +  * Backfire <code bash>uci -P/var/state get network.wan.ifname</code> 
 +  * The uci state vars are deprecated and not used anymore for network related information. In Trunk (not really uci) do <code bash>. /lib/functions/network.sh; network_get_device if_wan wan; echo $if_wan</code> 
 +  * Or <code bash>. /lib/functions/network.sh; network_get_physdev if_wan wan; echo $if_wan</code>
=== Get SSID === === Get SSID ===
<code> uci get wireless.@wifi-iface[-1].ssid</code> <code> uci get wireless.@wifi-iface[-1].ssid</code>
 +
 +==== Defaults: ====
 +
 +To set some system defaults the first time the device boots, create a script in the folder
 +<code>/etc/uci-defaults/</code>
 +All scripts in that folder are automatically executed by ''/etc/init.d/S10boot'' and if they exited with code 0 __deleted afterwards__ (scripts that did not exit with code 0 are not deleted and will be re-executed during the next boot until they also successfully exit).
===== Porting UCI to a different Linux distribution ===== ===== Porting UCI to a different Linux distribution =====
  * [[https://forum.openwrt.org/viewtopic.php?id=15243]]   * [[https://forum.openwrt.org/viewtopic.php?id=15243]]

Back to top

doc/uci.1357739111.txt.bz2 · Last modified: 2013/01/09 14:45 by steven