Bookmark

OpenWrt Network Configuration with UCI

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

  1. Back up first: sysupgrade -b /tmp/network-backup.tar.gz.
  2. Inspect state with uci show network, ip addr, and ip route.
  3. Set the sample LAN address: uci set network.lan.ipaddr='192.168.1.1' and uci set network.lan.netmask='255.255.255.0'.
  4. Review uci changes network; only then run uci commit network.
  5. 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 .


0 Bình luận

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