2

I have my DHCP server which I specificaly set the ip range to be between: 10.53.70.100 -- 10.53.70.200 but there are sometimes I get IPs outside from this range. For example, the last server I created got the IP 10.53.70.245, so I just wanted to know why my ip range setting is not working.

here’s the log from the DHCP server:

Mar 20 10:32:46 dhcp dnsmasq-dhcp[7657]: 1927259932 available DHCP range: 10.53.70.100 -- 10.53.70.200
Mar 20 10:32:46 dhcp dnsmasq-dhcp[7657]: 1927259932 client provides name: dnstest
Mar 20 10:32:49 dhcp dnsmasq-dhcp[7657]: 1927259932 DHCPDISCOVER(ens192) 10.53.70.245 00:50:56:8f:d4:6f
Mar 20 10:32:49 dhcp dnsmasq-dhcp[7657]: 1927259932 tags: ens192
Mar 20 10:32:49 dhcp dnsmasq-dhcp[7657]: 1927259932 DHCPOFFER(ens192) 10.53.70.177 00:50:56:8f:d4:6f
Mar 20 10:32:49 dhcp dnsmasq-dhcp[7657]: 1927259932 requested options: 1:netmask, 28:broadcast, 2:time-offset, 121:classless-static-route,
Mar 20 10:32:49 dhcp dnsmasq-dhcp[7657]: 1927259932 requested options: 15:domain-name, 6:dns-server, 12:hostname,
Mar 20 10:32:49 dhcp dnsmasq-dhcp[7657]: 1927259932 requested options: 40:nis-domain, 41:nis-server, 42:ntp-server,
Mar 20 10:32:49 dhcp dnsmasq-dhcp[7657]: 1927259932 requested options: 26:mtu, 119:domain-search, 3:router, 121:classless-static-route,
Mar 20 10:32:49 dhcp dnsmasq-dhcp[7657]: 1927259932 requested options: 249, 33:static-route, 252, 42:ntp-server
Mar 20 10:32:49 dhcp dnsmasq-dhcp[7657]: 1927259932 next server: 10.53.70.5
Mar 20 10:32:49 dhcp dnsmasq-dhcp[7657]: 1927259932 sent size:  1 option: 53 message-type  2
Mar 20 10:32:49 dhcp dnsmasq-dhcp[7657]: 1927259932 sent size:  4 option: 54 server-identifier  10.53.70.5
Mar 20 10:32:49 dhcp dnsmasq-dhcp[7657]: 1927259932 sent size:  4 option: 51 lease-time  12h
Mar 20 10:32:49 dhcp dnsmasq-dhcp[7657]: 1927259932 sent size:  4 option: 58 T1  6h
Mar 20 10:32:49 dhcp dnsmasq-dhcp[7657]: 1927259932 sent size:  4 option: 59 T2  10h30m
Mar 20 10:32:49 dhcp dnsmasq-dhcp[7657]: 1927259932 sent size:  4 option:  1 netmask  255.255.255.0
Mar 20 10:32:49 dhcp dnsmasq-dhcp[7657]: 1927259932 sent size:  4 option: 28 broadcast  10.53.70.255
Mar 20 10:32:49 dhcp dnsmasq-dhcp[7657]: 1927259932 sent size:  4 option:  6 dns-server  10.53.70.5
Mar 20 10:32:49 dhcp dnsmasq-dhcp[7657]: 1927259932 sent size:  9 option: 15 domain-name  example.io
Mar 20 10:32:49 dhcp dnsmasq-dhcp[7657]: 1927259932 sent size:  4 option:  3 router  10.53.70.1
Mar 20 10:32:49 dhcp dnsmasq-dhcp[7657]: 1927259932 available DHCP range: 10.53.70.100 -- 10.53.70.200
Mar 20 10:32:49 dhcp dnsmasq-dhcp[7657]: 1927259932 client provides name: dnstest
Mar 20 10:32:52 dhcp dnsmasq-dhcp[7657]: 2099714365 available DHCP range: 10.53.70.100 -- 10.53.70.200
Mar 20 10:32:52 dhcp dnsmasq-dhcp[7657]: 2099714365 client provides name: dnstest

As you can see there's the line where it says:

DHCPOFFER(ens192) 10.53.70.177 00:50:56:8f:d4:6f

Which it will be a correct Ip since it's inside of the range. However I see the line where it says:

DHCPDISCOVER(ens192) 10.53.70.245 00:50:56:8f:d4:6f

So, at the end the server takes this IP ending in .245, so my question is why it takes an IP that's outside of the allowed range?

Thanks.

VaTo
  • 191
  • 4
  • 20

1 Answers1

0

DHCPDISCOVER can contain a request to re-use the last used IP, and it seems that request is being granted.

Per Wikipedia's DHCP article:

A DHCP client may also request its last-known IP address. If the client remains connected to the same network, the server may grant the request. Otherwise, it depends whether the server is set up as authoritative or not.

One thing you probably want to consider (based on the answers to this question) is deleting that client's DHCP leases, and possibly those of your DHCP server.

You don't show any DHCPREQUEST/DHCPACK events, so it may in fact be that DHCP is failing, but due to the underlying network (but not client range) remaining the same, the client re-using its last lease and is able to retain connectivity.

As for configuration of dnsmasq, the man page suggests something like this could work:

dhcp-range=10.53.70.100,10.53.70.200
dhcp-option=3,10.53.70.1
dhcp-lease-max=7200
dhcp-authoritative

You might also need to delete the leases file on your DHCP clients.

iwaseatenbyagrue
  • 3,588
  • 12
  • 22
  • I just noticed that this DHCP server is using dnsmasq instead of dhcpd so how can I change that dnsmasq enforces the use of IPs inside of the IP range. – VaTo Mar 20 '17 at 17:26