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: Thu, 16 Nov 2023 13:52:18 +0000 [thread overview]
Message-ID: <8a13f37fcd2f61759548d7f5239fc675ff12c529.camel@groupe-cyllene.com> (raw)
In-Reply-To: <87bkbt3lly.fsf@gmail.com>
the debug log without my patch:
vm with 12:45:db:3a:04:97 got 192.168.2.10
Nov 15 21:33:31 formationkvm3 dnsmasq-dhcp[796025]: DHCPDISCOVER(vnetpve) 192.168.2.10 12:45:db:3a:04:97
Nov 15 21:33:31 formationkvm3 dnsmasq-dhcp[796025]: DHCPOFFER(vnetpve) 192.168.2.10 12:45:db:3a:04:97
Nov 15 21:33:31 formationkvm3 dnsmasq-dhcp[796025]: DHCPREQUEST(vnetpve) 192.168.2.10 12:45:db:3a:04:97
Nov 15 21:33:31 formationkvm3 dnsmasq-dhcp[796025]: DHCPACK(vnetpve) 192.168.2.10 12:45:db:3a:04:97 testovn1
Nov 15 21:34:47 formationkvm3 systemd[1]: Reloading dnsmasq@simpve.service - dnsmasq (simpve) - A lightweight DHCP and caching DNS server...
remove nic, assign another mac 12:45:db:3a:04:97 with 192.168.2.10
vm start, generate ether file + reload
Nov 15 21:34:47 formationkvm3 dnsmasq[796025]: cleared cache
Nov 15 21:34:47 formationkvm3 dnsmasq-dhcp[796025]: read /etc/dnsmasq.d/simpve/ethers
Nov 15 21:34:47 formationkvm3 systemd[1]: Reloaded dnsmasq@simpve.service - dnsmasq (simpve) - A lightweight DHCP and caching DNS server.
vm do the dhcp request and the server refuse because 192.168.2.10 is still leased to 12:45:db:3a:04:97
Nov 15 21:35:05 formationkvm3 dnsmasq-dhcp[796025]: not using configured address 192.168.2.10 because it is leased to 12:45:db:3a:04:97
Nov 15 21:35:05 formationkvm3 dnsmasq-dhcp[796025]: DHCPDISCOVER(vnetpve) 192.168.2.10 12:45:10:22:fb:fd no address available
Nov 15 21:35:09 formationkvm3 dnsmasq-dhcp[796025]: not using configured address 192.168.2.10 because it is leased to 12:45:db:3a:04:97
Nov 15 21:35:09 formationkvm3 dnsmasq-dhcp[796025]: DHCPDISCOVER(vnetpve) 192.168.2.10 12:45:10:22:fb:fd no address available
Nov 15 21:35:15 formationkvm3 dnsmasq-dhcp[796025]: not using configured address 192.168.2.10 because it is leased to 12:45:db:3a:04:97
Nov 15 21:35:15 formationkvm3 dnsmasq-dhcp[796025]: DHCPDISCOVER(vnetpve) 192.168.2.10 12:45:10:22:fb:fd no address available
Nov 15 21:35:26 formationkvm3 dnsmasq-dhcp[796025]: not using configured address 192.168.2.10 because it is leased to 12:45:db:3a:04:97
Nov 15 21:35:26 formationkvm3 dnsmasq-dhcp[796025]: DHCPDISCOVER(vnetpve) 192.168.2.10 12:45:10:22:fb:fd no address available
-------- Message initial --------
De: Stefan Lendl <s.lendl@proxmox.com>
À: "DERUMIER, Alexandre" <alexandre.derumier@groupe-cyllene.com>
Cc: pve-devel@lists.proxmox.com <pve-devel@lists.proxmox.com>
Objet: Re: [pve-devel] [PATCH pve-network] dnsmasq: configure static range for each subnet
Date: 16/11/2023 13:53:45
"DERUMIER, Alexandre" <alexandre.derumier@groupe-cyllene.com> writes:
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
I experimented with several approaches with dnsmasq leases.
I cannot reproduce your example because it works in my examples.
My procedure:
dnsmasq config:
dhcp-range=set:DHCPNAT-10.1.0.0-16,10.1.0.0,static,255.255.0.0,infinite
VM 108 net1: MAC: bc:24:11:ad:0e:2e
qm set 108 --delete net1
dnsmasq lease file still contains the lease for MAC bc:24:11:ad:0e:2e
qm set 108 --net1 model=virtio,bridge=dhcpnat
- ethers file gets updated to new mac: BC:24:11:51:10:AD
- soon after dnsmasq lease gets updated to the new lease as well!
- correct IP assigned in the VM
I also tried:
- ip link set down > ip link set upi
- reboot
- force Stop the VM
So far, *this all works!*
I also tried with a short dhcp lease in dnsmasq. With this
configuration, the new IP will even propagate to the VM and set
correctly after IPAM update.
In my tests I used 30s but something like 5 or 10min should be fine as well.
dhcp-range=set:DHCPNAT-10.1.0.0-16,10.1.0.0,static,255.255.0.0,30
The VM is polling every ~60s as seen on the wire with tcpdump:
tcpdump -i dhcpnat -n port 67 or port 68
After I manually update the ethers file and `systemctl *reload*
dnsmasq`, it will respond with the new IP.
dnsmasq is running *locally only* so any DHCP queries are limited to the
local bridge.
The biggest problem and for me the reason I think it's not a feasible
solution, is that dnsmasq becomes a single point of failure.
If dnsmasq is offline, all of the VMs will have *NO IP*.
prev parent reply other threads:[~2023-11-16 13:52 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
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 [this message]
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=8a13f37fcd2f61759548d7f5239fc675ff12c529.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