Choose where DHCP pool starts? (newbie question)

Hi everyone!

I just installed OpenWRT on my router (TP-Link Archer C6) to experiment a little and it works great!
I'm a little bit of a noob when it comes to networking, but love to learn, so sorry if this is a dumb question.

The router's IP address is 172.17.0.1.
I gave all of my important devices static leases (for example, access points on 172.17.1.x, office devices on 172.17.2.x, ... and so on).
This is working great so far!

Now, I'd love for devices that connect to my network and request an IP address to get one starting with 172.17.100.x, that's how I did it with the TP-Link before.
On the TP-Link, you could just enter where you want the DHCP pool to start and end, which was 172.17.100.1 - 172.17.100.250 for me.

I can't seem to find how to do this in OpenWRT? I tried looking online but I can't really seem to find any useful information, or don't really know how to word what I'm trying to achieve.

Really appreciate your input!! Thank you!

network > interfaces > lan > EDIT > [dhcp-server] > start

( with /16 it is not 100 )...;

#Lowest leased address as offset from the network address.
172.17.0.100 = 100
172.17.1.100 = 100 + 255-ish = ~355
etc. etc.
1 Like

There's a good example:
https://openwrt.org/docs/guide-user/base-system/dhcp_configuration#dhcp_pool_for_a_large_network

In your case:

uci set dhcp.lan.start="$((100*2**8+1))"
uci set dhcp.lan.limit="253"
uci commit dhcp
/etc/init.d/dnsmasq restart
2 Likes

Thanks @anon50098793!
I feel so stupid, with the standard value being '100' (which I suppose means it assigns IP addresses starting at 172.17.0.100), I had no idea you could put an IP address in that field!

I put '172.17.100.1' in the first field, and 250 in the second one (you can't put an IP address in there), so I assume that'll do the same thing.

Devices with no static lease all got an IP address in the 172.17.100.1 - 172.17.100.250 range! Thank you!

255-ish = 256 (2^8)
--> 100 + 256 = 356

1 Like

Thank you for your reply! That's still a little complicated for me to understand, lol, but I got it working!

Thanks everyone for the very fast and helpful replies!!

1 Like