Differences
This shows you the differences between two versions of the page.
|
doc:uci [2012/11/29 22:35] steven |
doc:uci [2013/02/01 19:39] (current) slickkitten better link to notUCI |
||
|---|---|---|---|
| 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 21: | Line 21: | ||
| | [[doc:uci:firewall|/etc/config/firewall]] | NAT, packet filter, port forwarding, etc. | | | [[doc:uci:firewall|/etc/config/firewall]] | NAT, packet filter, port forwarding, etc. | | ||
| | [[doc:uci:network|/etc/config/network]] | Switch, interface and route configuration | | | [[doc:uci:network|/etc/config/network]] | Switch, interface and route configuration | | ||
| - | | [[doc:uci:network6|/etc/config/network6]] | IPv6-configuration | | ||
| | [[doc:uci:system|/etc/config/system]] | Misc. system settings | | | [[doc:uci:system|/etc/config/system]] | Misc. system settings | | ||
| | [[doc:uci:timeserver|/etc/config/timeserver]] | Time server list for //rdate// | | | [[doc:uci:timeserver|/etc/config/timeserver]] | Time server list for //rdate// | | ||
| | [[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 153: | Line 152: | ||
| | ''commit'' | ''[<config>]'' | Writes changes of the given configuration file, or if none is given, all configration files, to the filesystem. All "uci set", "uci add", "uci rename" and "uci delete" commands are staged into a temporary location and written to flash at once with "uci commit". This is not needed after editing configuration files with a text editor, but for scripts, GUIs and other programs working directly with UCI files. | | | ''commit'' | ''[<config>]'' | Writes changes of the given configuration file, or if none is given, all configration files, to the filesystem. All "uci set", "uci add", "uci rename" and "uci delete" commands are staged into a temporary location and written to flash at once with "uci commit". This is not needed after editing configuration files with a text editor, but for scripts, GUIs and other programs working directly with UCI files. | | ||
| | ''batch'' | - | Executes a multi-line UCI script which is typically wrapped into a //here// document syntax. | | | ''batch'' | - | Executes a multi-line UCI script which is typically wrapped into a //here// document syntax. | | ||
| - | | ''export'' | ''[<config>]'' | Exports the configuration in a machine readable format. It is used internally to evaluate configration files as shell scripts. | | + | | ''export'' | ''[<config>]'' | Exports the configuration in a machine readable format. It is used internally to evaluate configuration files as shell scripts. | |
| | ''import'' | ''[<config>]'' | Imports configuration files in UCI syntax. | | | ''import'' | ''[<config>]'' | Imports configuration files in UCI syntax. | | ||
| | ''changes'' | ''[<config>]'' | List staged changes to the given configuration file or if none given, all configuration files. | | | ''changes'' | ''[<config>]'' | List staged changes to the given configuration file or if none given, all configuration files. | | ||
| Line 203: | 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 235: | Line 246: | ||
| uci get foo.third.name | uci get foo.third.name | ||
| ''| | ''| | ||
| + | |||
| + | If you show it, you get : | ||
| + | |||
| + | |''# **uci show foo** | ||
| + | foo.first=bar | ||
| + | foo.first.name=Mr. First | ||
| + | //foo.@bar[0]=bar// | ||
| + | //foo.@bar[0].name=Mr. Second// | ||
| + | foo.third=bar | ||
| + | foo.third.name=Mr. Third | ||
| + | ''| | ||
| + | |||
| + | But if you used "uci show foo.@bar[0]", you will see: | ||
| + | |||
| + | |''# **uci show foo.@bar[0]** | ||
| + | //foo.first=bar// | ||
| + | //foo.first.name=Mr. First// :-( | ||
| + | ''| | ||
| + | |||
| === Query interface state === | === Query interface state === | ||
doc/uci.1354224942.txt.bz2 · Last modified: 2012/11/29 22:35 by steven
