DHCP range configuration

I have a subnet 172.26.97.64/27, which consists of 32 IP addresses ranging from 172.26.97.64 to 172.26.97.95. The first and the last are reserved for network and broadcast addresses, plus the 172.26.97.65 for the router interface itself.

I want to configure DHCP to hand out IP addresses from 172.26.97.66 to 172.26.97.94 (total 29 addresses). Which is the correct start and limit?

  1. start=0, limit=29
  2. start=1, limit=29
  3. start=2, limit=29

Should be the correct option.

1 Like

If it is true, then what happens if start=0? Does the DHCP server hand out the network address to clients?

Dunno, never tried it. Why not give it a go?

I thought it would be start=66, limit=29. Just experiment to figure out for sure. It will be more efficient.

It is hard to test because it always hands out addresses from the middle of the range. For example, by default start=100, limit=150, meaning 100-250 range, and you usually get 192.168.1.174.

You can test the values by invoking ipcalc.sh directly (which is otherwise used by /etc/init.d/dnsmasq to calculate the range). The format is ipcalc.sh network-ip mask-or-prefix start limit:

root@jj:~# ipcalc.sh 172.26.97.64 27 0 29
IP=172.26.97.64
NETMASK=255.255.255.224
BROADCAST=172.26.97.95
NETWORK=172.26.97.64
PREFIX=27
START=172.26.97.65
END=172.26.97.94
root@jj:~# ipcalc.sh 172.26.97.64 27 1 29
IP=172.26.97.64
NETMASK=255.255.255.224
BROADCAST=172.26.97.95
NETWORK=172.26.97.64
PREFIX=27
START=172.26.97.65
END=172.26.97.94
root@jj:~# ipcalc.sh 172.26.97.64 27 2 29
IP=172.26.97.64
NETMASK=255.255.255.224
BROADCAST=172.26.97.95
NETWORK=172.26.97.64
PREFIX=27
START=172.26.97.66
END=172.26.97.94
root@jj:~# 

Another little documented feature is that you can actually specify a full IP address as start parameter, this avoids the need to manually calculate offsets:

root@jj:~# ipcalc.sh 172.26.97.64 27 172.26.97.66 29
IP=172.26.97.64
NETMASK=255.255.255.224
BROADCAST=172.26.97.95
NETWORK=172.26.97.64
PREFIX=27
START=172.26.97.66
END=172.26.97.94

Use option start 172.26.97.66 (or option start 2) and option limit 29 respectively to set your desired range.

3 Likes

Option Allocate IP sequentially in DHCP Advanced Settings.

That config would be invalid, so if it did, some clients would refuse/error-out as such anyways.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.