UCI (Unified Configuration Interface) is OpenWrt’s centralized configuration system. Every core OpenWrt package — networking, wireless, firewall, system settings, DHCP, and more — reads its configuration from UCI rather than maintaining its own ad-hoc config file format. This means you have a single, consistent interface for reading and writing configuration across the entire system, both from the command line and programmatically (viaDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/openwrt/openwrt/llms.txt
Use this file to discover all available pages before exploring further.
libuci in C, Lua, or shell).
Configuration Files
UCI configuration files live in/etc/config/. Each subsystem has its own file:
/etc/config/ is the canonical UCI configuration directory. Do not edit daemon-specific files like /etc/dnsmasq.conf directly — those are generated from UCI by the respective init scripts.File Format
UCI files use a simple, human-readable format built around sections, options, and lists.config— begins a new section. The optional name makes it a named section (addressable asfile.name); without a name it is an anonymous section (addressable by index, e.g.file.@type[0]).option— a single key/value pair.list— a multi-value option; multiplelistlines with the same key form an array.
Example: /etc/config/network
CLI Commands
Theuci command-line tool provides full read/write access to all UCI configuration.
Read Values
Write Values
Commit Changes
Transactions: Stage then Commit
UCI uses a transactional model. Changes made withuci set, uci add, or uci delete are staged in /tmp/.uci/ and are not written to /etc/config/ until you run uci commit.
This means:
- You can make multiple related changes atomically
- You can discard all pending changes by not committing
- Services are not restarted until you explicitly trigger it (e.g., with
reload_configor/etc/init.d/<service> restart)
Example: Changing the Hostname
UCI in Shell Scripts
Theuci command is available in any shell script. The rc.common framework also provides helper functions via /lib/functions.sh: