This article explains how I use UCI to change OpenWrt networking without confusing LuCI-generated state with the persistent configuration. The example uses LAN 192.168.1.1/24; replace it for your network.
The model
OpenWrt stores network configuration in /etc/config/network. UCI separates physical devices, logical interfaces, addresses, and routes, so a device or bridge must not be confused with an interface such as lan or wan.
Safe workflow
- Back up first:
sysupgrade -b /tmp/network-backup.tar.gz. - Inspect state with
uci show network,ip addr, andip route. - Set the sample LAN address:
uci set network.lan.ipaddr='192.168.1.1'anduci set network.lan.netmask='255.255.255.0'. - Review
uci changes network; only then runuci commit network. - Apply it with
/etc/init.d/network reload.
Changing WAN or bridge settings over a remote session can disconnect you immediately. Prefer wired LAN, a console/UART fallback, or a prepared recovery path.
Verify
Run ip addr, ip route, ubus call network.interface.lan status, and ping the gateway. If LuCI disappears, use the new address or failsafe mode to restore the backup.
Source
Independent adaptation of OpenWrt Network configuration .


Góp Ý / Bình Luận / Đánh giá