Re: [Dnsmasq-discuss] Static leases issues
Am Mon, 29 Jun 2020 15:45:16 +0100 schrieb Simon Kelley : > the DHCP server has to comply I think this is the question: comply to what? Clearly the DHCP admin is the _only_ authority to decide which MAC gets what IP address, the DHCP client is only allowed to make suggestions. As such every DHCP server has to follow the source of authority, it should rather not follow what is written in some silly RFC. (I assume the implemented behavior comes from some RFC, not from real life expectations) It might well be that the IP for the DHCP client will change in the future, once the lease expires. Why would it matter if the client gets the expected IP address "now" rather than "later"? Olaf pgpwjJzlRxHAs.pgp Description: Digitale Signatur von OpenPGP ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
Re: [Dnsmasq-discuss] Static leases issues
On 08/06/2020 17:18, Bruno BEAUFILS wrote: > Hello everyone, > > I have got a static leases issue with dnsmasq 2.80-1 installed as > Debian Buster package. > > I search the man page and the mailing list archives without any > success. Thus I try here. > > Here is short summary of what I have. > > I am on a simple LAN with a screenless host running dnsmasq. It is the > only, and thus main, DHCP server on the network. > > I use the dhcp-authoritative option in dnsmasq configuration. > > It offers a dhcp-range looking like that... > > dhcp-range=192.168.0.200,192.168.0.250,12h > > ...and a bunch of static lease looking like something like that > > dhcp-host=xx:xx:xx:xx:xx:xx,id:*,192.168.0.2,somename > > I want to use a new USB-ethernet adpator on a new laptop. > > On the first connection the host get a IP from the open range > (192.168.0.203) as it is visible in the logs: > > Jun 7 17:38:29 b3 dnsmasq-dhcp[12907]: DHCPDISCOVER(eth1) > 12:34:56:78:9a:bc > Jun 7 17:38:29 b3 dnsmasq-dhcp[12907]: DHCPOFFER(eth1) 192.168.0.203 > 12:34:56:78:9a:bc > Jun 7 17:38:29 b3 dnsmasq-dhcp[12907]: DHCPDISCOVER(eth1) > 12:34:56:78:9a:bc > Jun 7 17:38:29 b3 dnsmasq-dhcp[12907]: DHCPOFFER(eth1) 192.168.0.203 > 12:34:56:78:9a:bc > Jun 7 17:38:29 b3 dnsmasq-dhcp[12907]: DHCPREQUEST(eth1) 192.168.0.203 > 12:34:56:78:9a:bc > Jun 7 17:38:29 b3 dnsmasq-dhcp[12907]: DHCPACK(eth1) 192.168.0.203 > 12:34:56:78:9a:bc mechra > > After the first connection I am able to log on the server and add a > dhcp-host specific to that host. For that I did the following things > in order : > > 1. stop the dnsmasq server > > 2. remove the leases file > > 3. modify the dnsmasq configuration in order to add the dhcp-host >option > > dhcp-host=00:23:4d:df:a1:d1,id:*,192.168.0.15,somefancyname,24h > > 4. start the dnsmasq server > > After that I unplug the adaptor from the laptop and replug it in order > for it to get the new IP from the static lease. Unfortunately I always > get the same "old" adress (192.168.0.203), as the log shows (because > the client asked it): > > juin 7 18:05:23 b3 dnsmasq-dhcp[29360]: DHCPREQUEST(eth1) 192.168.0.203 > 12:34:56:78:9a:bc > juin 7 18:05:23 b3 dnsmasq-dhcp[29360]: DHCPACK(eth1) 192.168.0.203 > 12:34:56:78:9a:bc mechra > > I thought the dnsmasq should have refused the client request of using > 192.168.0.203 (through a DHCPNAK for instance) and sent it a new > OFFER with the correct static (192.168.0.15). > > Did I miss something (aka this is normal behavior but I misconfigured > the whole stuff certainly because I did not understand the > documentation well enough) or am I struggling with some kind of bug? > > Just in case it matters: all host used in the description are running Debian. > Dnsmasq does have code to do exactly what you want, but I think by unpluging and replugging the adapter, you're frustrating that because the DHCP client is going to "SELECTING" mode. Ie it's saying to the DHCP server "I want this address (the address it had before)" and the DHCP server has to comply, as long as the address is valid. If you can get the DHCP server to RENEW the lease (either by making leases short, or finding a control on the DHCP client) then the renewal will fail and a DHCPNAK will be sent, which should force the client back to DHCPDISCOVER state and it will find the new address. The same thing should happen in INIT-REBOOT state, which I'd expect the client to move to on the unplug-replug cycle. The state diagram for a client is here: https://tools.ietf.org/html/rfc2131#page-35 If you can grab a packet dump of the DHCPREQUEST packet being sent, that would be useful. If it has both SERVER_IDENTIFIER and REQUESTED_IP options, then that would explain the behaviour, and put the spotlight on the client. Actually, a dump of the whole exchange would be useful. Simon. ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
Re: [Dnsmasq-discuss] Static leases issues
Am Mon, 8 Jun 2020 18:18:16 +0200 schrieb Bruno BEAUFILS : > am I struggling with some kind of bug? The behavior you are seen is caused by the fact that DHCP is an overly complicated crap protocol. To get this fixed quickly, remove the lease both from the client file-system and from the dnsmasq lease database. One would think that an assignment of an IP to a MAC in the configuration file must be the authoritative source of knowledge about the local network, and the server must just serve that knowledge no matter what. But both ISC dhcpd and dnsmasq rather do what the client is asking for, instead of following the rules of the network admin. dnsmasq has the "dhcp-authoritative" option, which at a first glance sounds like the right knob to override such weird behavior. But reading the description, it may also not do what you are asking for. Good luck. Olaf pgphw1hbRjo94.pgp Description: Digitale Signatur von OpenPGP ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
Re: [Dnsmasq-discuss] Static leases issues
On Tue, Jun 09, 2020 at 11:22:27PM +0200, Bruno BEAUFILS wrote: > On Tue, Jun 09, 2020 at 07:51:53PM +0200, john doe wrote: > > Assuming that you have cleared your lease file and that more than 24 > > hours have passed, your client should have picked up the new lease. > > If the lease file has been cleared and the client asked for a new > specific IP, why does the server have to wait 24 hours to refuse the > asked IP and send the configuration chosen one? > > > That is why I suggested looking at the misbehaving DHCP client. > > Isn't it the responsability of the server to distribute IP adresses it > decide whatever IP the client ask? Yes. And the DHCP client is supposed to behave nicely. Groeten Geert Stappers -- Silence is hard to parse ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
Re: [Dnsmasq-discuss] Static leases issues
On Tue, Jun 09, 2020 at 09:58:12PM +0200, Geert Stappers wrote: > > That is why I suggested looking at the misbehaving DHCP client. > > Yes, also check the DHCP client. I will do that tomorrow but I do not understand why, in any case, the server does not deny the asked adress if 1) the leases are cleared and 2) it has a some static Hardware-IP link in its configuration. > And know that tcpdump is your "microscoop" I am not sure it will help a lot since DHCP exchange are already logged by dnsmasq. Anyway I will try to follow everything to be sure. -- Bruno BEAUFILS signature.asc Description: PGP signature ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
Re: [Dnsmasq-discuss] Static leases issues
On Tue, Jun 09, 2020 at 07:51:53PM +0200, john doe wrote: > Assuming that you have cleared your lease file and that more than 24 > hours have passed, your client should have picked up the new lease. If the lease file has been cleared and the client asked for a new specific IP, why does the server have to wait 24 hours to refuse the asked IP and send the configuration chosen one? > That is why I suggested looking at the misbehaving DHCP client. Isn't it the responsability of the server to distribute IP adresses it decide whatever IP the client ask? -- Bruno BEAUFILS signature.asc Description: PGP signature ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
Re: [Dnsmasq-discuss] Static leases issues
On 6/9/2020 7:51 PM, john doe wrote: > On 6/9/2020 5:25 PM, Bruno BEAUFILS wrote: > > On Tue, Jun 09, 2020 at 11:13:19AM +0200, john doe wrote: > > > > Do we agree that to clean the leases the removal of the leases file > > > > when dnsmasq is stopped is sufficient? > > > > > > Correct, rereading your first e-mail, try to clear the lease on your > > > dhcp client. > > > > OK I will try and I hope it will certainly work, but one should not > > have to modify the client so that the server behave correctly on this > > side. Am I right? > > > > Assuming that you have cleared your lease file and that more than 24 > hours have passed, your client should have picked up the new lease. > > That is why I suggested looking at the misbehaving DHCP client. > Yes, also check the DHCP client. And know that tcpdump is your "microscoop" Feel free to share your experience with this mailinglist. Groeten Geert Stappers -- Silence is hard to parse ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
Re: [Dnsmasq-discuss] Static leases issues
Resending through the list. On 6/9/2020 7:51 PM, john doe wrote: On 6/9/2020 5:25 PM, Bruno BEAUFILS wrote: On Tue, Jun 09, 2020 at 11:13:19AM +0200, john doe wrote: Do we agree that to clean the leases the removal of the leases file when dnsmasq is stopped is sufficient? Correct, rereading your first e-mail, try to clear the lease on your dhcp client. OK I will try and I hope it will certainly work, but one should not have to modify the client so that the server behave correctly on this side. Am I right? Assuming that you have cleared your lease file and that more than 24 hours have passed, your client should have picked up the new lease. That is why I suggested looking at the misbehaving DHCP client. -- John Doe ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
Re: [Dnsmasq-discuss] Static leases issues
On Tue, Jun 09, 2020 at 11:13:19AM +0200, john doe wrote: > > Do we agree that to clean the leases the removal of the leases file > > when dnsmasq is stopped is sufficient? > > Correct, rereading your first e-mail, try to clear the lease on your > dhcp client. OK I will try and I hope it will certainly work, but one should not have to modify the client so that the server behave correctly on this side. Am I right? > Also your host definition has 'id:*', I would try to remove it. This does not change anything unfortunately (in fact I added it after I discover the problem). -- Bruno BEAUFILS signature.asc Description: PGP signature ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
Re: [Dnsmasq-discuss] Static leases issues
On 6/9/2020 10:17 AM, Bruno BEAUFILS wrote: On Mon, Jun 08, 2020 at 06:36:20PM +0200, john doe wrote: 2. remove the leases file Try clearing the lease for the host in question: $ systemctl stop dnsmasq Remove the file altogether or remove the desired lease in the lease file:. Lease file path: '/var/lib/misc/dnsmasq.leases' $ systemctl start dnsmasq As I wrote, it is already what I did. My lease file is under /var/lib/dnsmasq/dnsmasq.leases though. IN plain English, you need to clear the lease or you need to wait for the lease to expire. This is exactly what I hoped but what I observed not working. Do we agree that to clean the leases the removal of the leases file when dnsmasq is stopped is sufficient? Correct, rereading your first e-mail, try to clear the lease on your dhcp client. With dhclient something like 'dhclient -r '. Also your host definition has 'id:*', I would try to remove it. -- John Doe ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
Re: [Dnsmasq-discuss] Static leases issues
On Mon, Jun 08, 2020 at 06:36:20PM +0200, john doe wrote: > > 2. remove the leases file > > Try clearing the lease for the host in question: > > $ systemctl stop dnsmasq > Remove the file altogether or remove the desired lease in the lease file:. > Lease file path: '/var/lib/misc/dnsmasq.leases' > $ systemctl start dnsmasq As I wrote, it is already what I did. My lease file is under /var/lib/dnsmasq/dnsmasq.leases though. > IN plain English, you need to clear the lease or you need to wait for > the lease to expire. This is exactly what I hoped but what I observed not working. Do we agree that to clean the leases the removal of the leases file when dnsmasq is stopped is sufficient? -- Bruno BEAUFILS signature.asc Description: PGP signature ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
Re: [Dnsmasq-discuss] Static leases issues
On 6/8/2020 6:18 PM, Bruno BEAUFILS wrote: Hello everyone, I have got a static leases issue with dnsmasq 2.80-1 installed as Debian Buster package. I search the man page and the mailing list archives without any success. Thus I try here. Here is short summary of what I have. I am on a simple LAN with a screenless host running dnsmasq. It is the only, and thus main, DHCP server on the network. I use the dhcp-authoritative option in dnsmasq configuration. It offers a dhcp-range looking like that... dhcp-range=192.168.0.200,192.168.0.250,12h ...and a bunch of static lease looking like something like that dhcp-host=xx:xx:xx:xx:xx:xx,id:*,192.168.0.2,somename I want to use a new USB-ethernet adpator on a new laptop. On the first connection the host get a IP from the open range (192.168.0.203) as it is visible in the logs: Jun 7 17:38:29 b3 dnsmasq-dhcp[12907]: DHCPDISCOVER(eth1) 12:34:56:78:9a:bc Jun 7 17:38:29 b3 dnsmasq-dhcp[12907]: DHCPOFFER(eth1) 192.168.0.203 12:34:56:78:9a:bc Jun 7 17:38:29 b3 dnsmasq-dhcp[12907]: DHCPDISCOVER(eth1) 12:34:56:78:9a:bc Jun 7 17:38:29 b3 dnsmasq-dhcp[12907]: DHCPOFFER(eth1) 192.168.0.203 12:34:56:78:9a:bc Jun 7 17:38:29 b3 dnsmasq-dhcp[12907]: DHCPREQUEST(eth1) 192.168.0.203 12:34:56:78:9a:bc Jun 7 17:38:29 b3 dnsmasq-dhcp[12907]: DHCPACK(eth1) 192.168.0.203 12:34:56:78:9a:bc mechra After the first connection I am able to log on the server and add a dhcp-host specific to that host. For that I did the following things in order : 1. stop the dnsmasq server 2. remove the leases file 3. modify the dnsmasq configuration in order to add the dhcp-host option dhcp-host=00:23:4d:df:a1:d1,id:*,192.168.0.15,somefancyname,24h 4. start the dnsmasq server After that I unplug the adaptor from the laptop and replug it in order for it to get the new IP from the static lease. Unfortunately I always get the same "old" adress (192.168.0.203), as the log shows (because the client asked it): juin 7 18:05:23 b3 dnsmasq-dhcp[29360]: DHCPREQUEST(eth1) 192.168.0.203 12:34:56:78:9a:bc juin 7 18:05:23 b3 dnsmasq-dhcp[29360]: DHCPACK(eth1) 192.168.0.203 12:34:56:78:9a:bc mechra I thought the dnsmasq should have refused the client request of using 192.168.0.203 (through a DHCPNAK for instance) and sent it a new OFFER with the correct static (192.168.0.15). Did I miss something (aka this is normal behavior but I misconfigured the whole stuff certainly because I did not understand the documentation well enough) or am I struggling with some kind of bug? Just in case it matters: all host used in the description are running Debian. Try clearing the lease for the host in question: $ systemctl stop dnsmasq Remove the file altogether or remove the desired lease in the lease file:. Lease file path: '/var/lib/misc/dnsmasq.leases' $ systemctl start dnsmasq IN plain English, you need to clear the lease or you need to wait for the lease to expire. HTH. -- John Doe ___ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss