Change the pool of DHCP IP addresses

I have a network and subnet of 10.1.1.1/17 (Lets not get into why. There are many reasons)
I want OpenWRT to give out ip addresses 10.1.2.1-10.1.2.255 ONLY. Other IP addresses will be set in Static Leases.
How do I do this?

Read the wiki/doc for /etc/config/dhcp?

So I think that Wiki assumes I know more about networking then I actually do, as it uses many terms I am not familiar with. The only way I can see to do it, and I don't know if it will work, or if I will just end up breaking things is to set the
"option start '256'" as that should, in my way of thinking, start at 192.168.2.1.. However I have a feeling it isn't expecting a number higher then 255 there.
So if its not too much to ask, can I ask for a bit more detailed guidance? Unless of course the option start solution is the correct one.

Not the way I see it expressed in the wiki.

  • Specifies the offset from the network address of the underlying interface to calculate the minimum address that may be leased to clients. It may be greater than 255 to span subnets.

Behind the scenes, it would calculate your range like this (use 513 for start, and 254 for limit):

# /bin/ipcalc.sh 10.1.1.1/17 513 254
IP=10.1.1.1
NETMASK=255.255.128.0
BROADCAST=10.1.127.255
NETWORK=10.1.0.0
PREFIX=17
START=10.1.2.1
END=10.1.2.255

513 is the needed offset from 10.1.0.0, not 10.1.1.1.

1 Like

So I was right on what to set, just not what to set it to?, I just set the option start to 513? Limit can stay at 100.. I will never have that many DHCP clients.
Or is that output actually suppose to go somewhere?

Just use the 513 as your Start value on the LAN DHCP server. Behind the scenes, dnsmasq will run that ipcalc command to figure out the actual range.

2 Likes

The router's IP address doesn't have an effect on the start and limit calculations of the dynamic IP range or pool.

It isn't a problem here, but dynamic IP range can't overlap the router's IP address.

Conventionally the router's IP address is the first usable address in the subnet (usually .1), but I suppose you have reasons to do that differently.

1 Like

Off topic/nitpick: you would not believe that out there in the wild there are a bunch of old grey beard netops who uses "conventionally" the second last address on a subnet... :man_shrugging:

:joy:

I am not one of them, I use .1 :wink:

1 Like

Hey! I resemble that remark :wink: