UCI: how OpenWrt keeps every setting in /etc/config
In one sentence
Section titled “In one sentence”UCI (Unified Configuration Interface) keeps the configuration for OpenWrt’s services in plain-text files under /etc/config/. LuCI and the uci command edit those same files.
How it works
Section titled “How it works”- There is one file per subsystem, such as
network,wireless,dhcp,firewallandsystem. uci set,uci add,uci renameanduci deleteare staged first.uci commitwrites them to flash in one go.- A committed change takes effect only after the service reloads or restarts through its init script. The official example changes the uhttpd port, commits, then runs
/etc/init.d/uhttpd restart. - LuCI is a front end: its pages read and write the same UCI files through APIs.
See it on your router
Section titled “See it on your router”These commands only read:
uci show network.lanuci get network.lan.ipaddruci export dhcpWatch out
Section titled “Watch out”- A change you commit but never reload is not live yet. It takes effect at the next service restart or reboot, which can be long after you have forgotten about it.
- Copy
/etc/configsomewhere safe before you edit by hand. Backup and restore covers a full backup.
Related guides
Section titled “Related guides”Sources
Router.Homes
Independent OpenWrt notes. Every page states the firmware, device, package manager and way back.
Icons: Solar by 480 Design, CC BY 4.0