[solved]DHCP assigning IPs out of the pool

I have dhcp server configured to lease ips in the range 192.168.30.x but sometimes it assigns ips like 192.168.29.x

The dhcp server uses pool “dhcp”
Pool dhcp is 192.168.30.42-192.168.30.90 and next pool is pool1
Pool pool1 is 192.168.30.15-192.168.30.20 and next pool is pool2
Pool pool2 is 192.168.30.25-192.168.30.33 and next pool is pool3
Pool pool3 is 162.168.30.120-192.168.30.159 and next pool is “none”.

All the pools has ips in the range 192.168.30.x but sometimes dhcp assigns ips in the range 192.168.29.x

An example from system log:

Time Sep/02/2016 09:10:02
Buffer memory
Topics
dhcp
info
Message dhcp1 assigned 192.168.29.232 to 84:38:38:DD:FC:9D


Any ideas of what is wrong please?

It looks like you have a second server, dhcp1, maybe it is configured somewhere on a bridged network?

But the mikrotik records in its log it is assigning hte IP, and the IP appears in the leases list of the mikrotik…

post an export… maybe wrong netmask definition?

But… the dhcp server should serve ips only in the range configured in the pools…

Here the relevant parts of the export:

/ip address
add address=192.168.30.200/24 comment=LAN interface=ether13-lan network=\
    192.168.30.0
add address=192.168.31.200/24 interface=ether13-lan network=192.168.31.0



/ip pool
add name=pool3 ranges=162.168.30.120-192.168.30.159
add name=ovpn-pool ranges=10.168.30.2-10.168.30.254
add name=pool2 next-pool=pool3 ranges=192.168.30.25-192.168.30.33
add name=pool1 next-pool=pool2 ranges=192.168.30.15-192.168.30.20
add name=dhcp next-pool=pool1 ranges=192.168.30.42-192.168.30.90
/ip dhcp-server
add address-pool=dhcp disabled=no interface=ether13-lan name=dhcp1

Yes but it says it is using server dhcp1 while you post the config for dhcp (without 1)

Hummm… dhcp1 is the name of the dhcpserver. The name of the pool is “dhcp”.

/ip dhcp-server
add address-pool=dhcp disabled=no interface=ether13-lan name=dhcp1

Unless you made a typo with pasting here, your pool3 has a very strange range

/ip pool
add name=pool3 ranges=162.168.30.120-192.168.30.159

AHHH!! Thank you. This must be the problem!!

Could be, although it is very weird that the router ‘chooses’ to assign 192.168.29.x and not anything starting between 162 and 192…
anyway I hope you can solve your problem.

Probably he took his device from another of his networks where it received that 192.168.29 address from another router,
and now he connects to this router, the device asks if it can get a lease for that address, the router looks in its pools
and decides “why not?” and issues the address.
I would expect this to happen only when 192.168.29.x is a valid address on the interface, which is kind of strange when the
main pools are all on 192.168.30.x, but maybe the network is layed out like that? Or there is a bug, in that the DHCP
server issues addresses from a pool even when they are outside the subnet of the interface. Questionable if that even
can be called a bug, or is just punishment for incorrect configuration. :slight_smile:

 /ip pool
add name=pool3 ranges=162.168.30.120-192.168.30.159

The typo in that pool makes the range huge, including in fact that IP in the pool:

ipcalc 162.168.30.120-192.168.30.159

deaggregate 162.168.30.120 - 192.168.30.159
162.168.30.120/29
162.168.30.128/25
162.168.31.0/24
162.168.32.0/19
162.168.64.0/18
162.168.128.0/17
162.169.0.0/16
162.170.0.0/15
162.172.0.0/14
162.176.0.0/12
162.192.0.0/10
163.0.0.0/8
164.0.0.0/6
168.0.0.0/5
176.0.0.0/4
192.0.0.0/9
192.128.0.0/11
192.160.0.0/13
192.168.0.0/20
192.168.16.0/21
192.168.24.0/22
192.168.28.0/23
192.168.30.0/25
192.168.30.128/27