public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "DERUMIER, Alexandre" <alexandre.derumier@groupe-cyllene.com>
To: "s.lendl@proxmox.com" <s.lendl@proxmox.com>
Cc: "pve-devel@lists.proxmox.com" <pve-devel@lists.proxmox.com>
Subject: Re: [pve-devel] [PATCH pve-network] dnsmasq: configure static range for each subnet
Date: Wed, 15 Nov 2023 20:50:52 +0000	[thread overview]
Message-ID: <224f6b39b0d45e386dd32b1881169c17a89b2917.camel@groupe-cyllene.com> (raw)
In-Reply-To: <87il632clh.fsf@gmail.com>

>>
>>I have a similar solution for the dhcp-range.
>>I played around with adding and removing IPs from IPAM and It looks
>>like
>>dnsmasq is offering the correct IP, as stored in IPAM and ethers
>>file.
>>
>>I tried with a regular reboot to get a new IP.
>>
>>What I saw when testing with the previous dhcp-range config.
>>VM with an IP in IPAM, manually remove IP from ethers file,
>>the VM will still get an IP in the range, but not the one originally
>>offered.
>>If dnsmasq never saw the MAC, it will not offer an IP.
>>
>>If you find a specific scenario that does not work, please post a
>>step
>>by step description so I can try to reproduce and to get a better
>>understanding of the dnsmasq config.

I can reproduce easily 100%:


- create a nic with mac:xx:xx:xx:xY  ip: 192.168.0.10
- start vm. (the ether file is filed + reload)
- the guest do a dhcp request, the dnsmasq respond  a store the lease
in /var/lib/misc/zone.lease

- delete the nic


- add a new nic in same vm or another vm,  free found ip is
192.168.0.10  (because it was removed)


- start the vm (the ether file is upgrade with the new ip mac + reload)

- the guest do a dhcp request: the dnsmasq can't respond (with my last
patch) or give a dynamic ip in the range (with current implementation)
because it's still see his lease file the old mac:ip assocation



so, the solution is to remove lease file and restart dnsmasq




others dhcp daemons:


KEA
----
With kea, it possible to update/del/add lease directly through unix
socket. (but not static reservation, it's a commercial plugin).
That mean that if an unknown client is doing a request, it can return a
lease in the pool range (and we don't known it, and could allocate it)


echo '{ "command": "lease4-get-all" }'  | socat /run/kea/kea4-ctrl-
socket -,ignoreeof


echo '{ "command": "lease4-del", "arguments": {"ip-address":
"192.168.2.20"} }'  | socat /run/kea/kea4-ctrl-socket -,ignoreeof


echo '{ "command": "lease4-add", "arguments": {"ip-address":
"192.168.2.20", "hw-address": "1a:1b:1c:1d:1e:1f"} }'  | socat
/run/kea/kea4-ctrl-socket -,ignoreeof

echo '{ "command": "lease4-update", "arguments": {"ip-address":
"192.168.2.20", "hw-address": "1a:1b:1c:1d:1e:1f"} }'  | socat
/run/kea/kea4-ctrl-socket -,ignoreeof



FREERADIUS
----------

freeradius seem interesting, as it's possible to do custom
plugins,including perl


https://serverfault.com/questions/1098827/freeradius-with-dhcp-server-calls-to-perl-module-returns-error

So, maybe it could be possible to read directly the macs.db database in
/etc/pve dynamically.

I need to read the doc to see how it's works





What we need is just a stupid daemon replying to dhcp request with dhcp
offers using static mac:ip  (with correct dhcp protocol implementation


Maybe some pure perl daemon exist ?
or python like https://github.com/flan/staticdhcpd ?



  parent reply	other threads:[~2023-11-15 20:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-15 15:13 Alexandre Derumier
2023-11-15 16:07 ` DERUMIER, Alexandre
     [not found]   ` <87il632clh.fsf@gmail.com>
2023-11-15 20:50     ` DERUMIER, Alexandre [this message]
2023-11-16 12:53       ` Stefan Lendl
2023-11-16 13:43         ` DERUMIER, Alexandre
2023-11-16 14:09           ` Stefan Lendl
2023-11-17  7:24             ` DERUMIER, Alexandre
2023-11-16 13:52         ` DERUMIER, Alexandre

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=224f6b39b0d45e386dd32b1881169c17a89b2917.camel@groupe-cyllene.com \
    --to=alexandre.derumier@groupe-cyllene.com \
    --cc=pve-devel@lists.proxmox.com \
    --cc=s.lendl@proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal