UCI getting started

I've just started looking at UCI and could do with something like a primer, as I can't manage to do the simplest of things...

I was hoping to create a simple section in /etc/config/network consisting of:

config interface 'lan'
           option device 'eth0'
           option proto dhcp

but can't figure out how.

Any offers?

excuse me why do you want to create a lan interface, with ip address assigned by a dhcp server?

are you configuring a dump-ap ?

1 Like

There you go:

uci set network.lan=interface
uci set network.lan.device=eth0
uci set network.lan.proto=dhcp

Then if you run uci changes you'll see (if you didn't have the lan network before):


Don't forget to run uci commit network to commit your changes from RAM to the config file and either reload network or run reload_config.

PS. I'm sure it's all covered in wiki, have you tried checking there?


Technically, what you posted is UCI (i.e. the file edit method as opposed to the command line). You can add that to /etc/config/network

1 Like

I did look through the wiki but couldn't figure out how to start a new section.

When I initially startup OpenWrt on my laptop after installing it, I can't connect to the Internet until I've made those changes.

Not sure why you want a new section (instead of editing LAN) - but maybe uci add - perhaps?


Seems like a duplicate thread to me.

1 Like

Supposing I have this section in wireless

config wifi-iface 'wifinet1' #<---may differ on yours
        option ssid 'upstrream_SSID'
        option device 'radio0' #<---may differ in name/band
        option mode 'sta'
        option key 'xxxxxxxxxxxxx' #<---may differ on yours
        option network 'wwan' #<---or use wan, since it already exist
        option encryption 'psk2+ccmp'

and I want to change the name of the section from 'wifi-iface' to 'wifi-test'. How?

I've spent hours trying without success.

I know how to delete the whole section, but whatever I do fails.


uci set wireless.wifi-test='wiffy'

fails with

'uci: Invalid argument

config wifi-iface

this part you can not change it ...


you can change this part...


To complement the previous comment from @ncompact: wifi-iface is not a name of a section, it's a type of the section.