[Solved] Invalid argument with uci command

I am working with a GL.iNet Flint2 freshly flashed with 25.12.0.

I can create a static lease with LuCI, and show it with uci:

root@OpenWrt:~# uci show dhcp
...
dhcp.@host[0]=host
dhcp.@host[0].name='prn1'
dhcp.@host[0].mac='11:22:33:44:55:66'
dhcp.@host[0].ip='192.168.1.50'
root@OpenWrt:~#

If I then try to create another static lease with uci, I get an error:

root@OpenWrt:~# uci set dhcp.@host[1]=host
root@OpenWrt:~# uci set dhcp.@host[1].name='prn2'
uci: Invalid argument
root@OpenWrt:~#

I feel like I am missing something simple. Any help appreciated.

[OpenWrt Wiki] DHCP and DNS examples

Ah. My bad. I can really be brain dead sometimes.

Instead of

uci set dhcp.@host[1]=host

I should use

uci add dhcp host

Thanks, picked up another good tip there as well, using @host[-1].

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.