Linksys WRT1900ACS, custom image (imagebuilder) 23.05.5; using the following /files/etc/uci_defaults/99-custom switched on as 192.168.1.1static instead of 192.168.1.22:
uci -q batch << EOI
set network.lan.ipaddr='192.168.1.22'
commit network
set wireless.@wifi-device[0].disabled='0'
set wireless.@wifi-iface[0].ssid='MyWiFi'
set wireless.@wifi-device[1].disabled='0'
set wireless.@wifi-iface[1].ssid='MyWiFi'
commit wireless
EOI
uci -q batch << EOI
set network.lan.ipaddr='192.168.1.22'
set network.lan='interface'
set network.lan.device='br-lan'
set network.lan.proto='dhcp'
set network.lan.force_link='1'
commit network
set wireless.@wifi-device[0].disabled='0'
set wireless.@wifi-iface[0].ssid='MyWiFi'
set wireless.@wifi-device[1].disabled='0'
set wireless.@wifi-iface[1].ssid='MyWiFi'
commit wireless
EOI
The device started again as 192.168.1.1 and static instead of 192.168.1.22 and dhcp: are the above uci commands wrong?
Set the protocol explicitly in any script and you can then guarantee that it will be as you want.
That said, this should typically not be set on each startup. It should be either a firstboot script or set once and saved. Why are you setting it in the normal boot sequence?
My goal was and still is to create an image with imagebuilder in which the IP assigned at the very first boot is .22 because this device is an AP (no dhcp) and .1 is the router (with dhcp); after that, at every following reboot, the device receives .22 from the router.
Is there another way, maybe better, to reach the goal with imagebuilder?
By the way, focusing on the actual goal (also thanks for that) and surfing the forum I landed rather quickly here Uci-defaults not applying all changes and got inspired... just a few seconds before you confirmed that.