Assigning Range for network ip addresses

Have I got this right? I just do:

uci set network.lan.ipaddr=ip.i.want.1
uci changes
uci commit

and that's it? I'll also have to change my static ip assignment, should I remove that first?

You are changing the current static IP with a different static IP. That will work.

After these commands the OpenWrt device will have a different LAN IP.

Where is the "static IP assignment" you want to change? DHCP table or in your own PC options?

In any case yes you need to have an IP that is in the right range or you will not connect to router or internet. If it is DHCP table you need to change it before, if it is in your own PC options you need to change it after this.

For example if router has IP and your PC has IP the network will not work.


It's in the DHCP config file, I assigned a static ip to my Raspberry Pi. Should I:

uci set
uci set network.lan.ipaddr=new.ip.address.range
uci changes
uci commit

and then

reboot ?

yeah ok that is fine.

you can also restart the services instead of rebooting.

service network restart

then you connect again to ssh with the new router IP and restart DHCP/DNS service

service dnsmasq restart
1 Like

Note that service is not a command but a function defined in the root profile.
Profile functions don't work in scripts unless the profile is loaded specifically.
So, it's better to rely on the init scripts when automating the configuration.


I was under the impression that this isn't a script, he is connected to the device with console or SSH and writing commands manually.

1 Like

Thank you both for the information, I will make a note that service is a function not a command now. Bob you are correct I am connected to my router via SSH.