Hi! I'm very new to OpenWrt and I had trouble with a very simple task: I like to control which IPv4 each of my hosts will get. I read the docs of course but I still had trouble to read out the essential parts.
Now that static IPs work I provide you a condensed step-by-step guide for setting up static leases. You should still read the docs afterwards. I'm ignoring IPv6.
- At first let the device connect to your router. It will get a random IP from your DHCP range
- On the start page (Status > Overview) find the device from its name and copy its MAC address
- Connect via ssh and run
- At the end of the file add with your correct values:
config host option name 'yourdevicename' option mac '12:34:56:78:9A:BC' option ip '192.168.1.xyz'
- Save and close the file
- Open the file with the active leases via
- Go to the line with the correct mac and type
ddto delete it
/etc/init.d/dnsmasq restartto restart DHCP
- Let your host disconnect and reconnect to your router. It has the correct IP address now.
- See Network > DHCP and DNS > Static Leases for all your static IPs
I know you can add static IPs on that page but as I said, this was the fastest and easiest way for me without hassling with other options, e.g. with luci I got
dns = 1 written into the config file.