Skip to content

UCI: how OpenWrt keeps every setting in /etc/config

Every service reads /etc/config. LuCI edits the same files.

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.

  • There is one file per subsystem, such as network, wireless, dhcp, firewall and system.
  • uci set, uci add, uci rename and uci delete are staged first. uci commit writes 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.

These commands only read:

Terminal window
uci show network.lan
uci get network.lan.ipaddr
uci export dhcp
  • 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/config somewhere safe before you edit by hand. Backup and restore covers a full backup.

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