public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [WIP v3 cluster/network/manager/qemu-server 00/22] Add support for DHCP servers to SDN
@ 2023-11-14 18:05 Stefan Hanreich
  2023-11-14 18:05 ` [pve-devel] [WIP v3 pve-cluster 01/22] add priv/macs.db Stefan Hanreich
                   ` (21 more replies)
  0 siblings, 22 replies; 27+ messages in thread
From: Stefan Hanreich @ 2023-11-14 18:05 UTC (permalink / raw)
  To: pve-devel

This patch series adds support for automatically deploying dnsmasq as a DHCP
server to a simple SDN Zone.

This is mostly an update for Alexandre, Stefan and Thomas so we have a
consolidated base for further development of this feature. Code and UI is (very)
rough in some places, but all the planned functionality is now included and
usable via the web UI.

I will be doing some cleanup and refactoring the following days. Additionally,
permissions and validations are still missing and are now top priority on my
TODO list.

Alexandre is still working on the new LXC integration, that should follow
shortly.

You need to install dnsmasq (and disable it afterwards):

  apt install dnsmasq && systemctl disable --now dnsmasq


You can use the following example configuration for deploying a DHCP server in
a SDN subnet, you should also be able to recreate this configuration in the
web UI:


/etc/pve/sdn/zones.cfg:

  simple: DHCPNAT
          ipam pve
          dhcp dnsmasq


/etc/pve/sdn/vnets.cfg:

  vnet: dhcpnat
          zone DHCPNAT


/etc/pve/sdn/subnets.cfg:

  subnet: DHCPNAT-10.1.0.0-16
          vnet dhcpnat
          dhcp-dns-server 10.1.0.1
          dhcp-range start-address=10.1.0.100,end-address=10.1.0.200
          gateway 10.1.0.1
          snat 1

Don't forget to apply the new configuration!

For testing it can be helpful to monitor the following files (e.g. with watch)
to find out what is happening
  * /etc/dnsmasq.d/<zone_id>/ethers (on each node)
  * /etc/pve/priv/ipam.db
  * /etc/pve/priv/macs.db

Changes from v2 -> v3:
  * Removed dhcp.cfg, DHCP server now get configured at the zone
  * added UI
  * added / updated API
  * DHCP acquires IPs at vNIC creation instead of VM start
  * DHCP releases IPs at vNIC removal instead of VM stop
  * improved dnsmasq configuration generation
  * added priv/macs.db for caching mac/IP mappings
  * refactored IPAM plugins
  * updated tests

Changes from v1 -> v2:
  * added hooks for handling DHCP when starting / stopping / .. VMs and CTs
  * Get an IP from IPAM and register that IP in the DHCP server
    (pve only for now)
  * remove lease-time, since it is now infinite and managed by the VM lifecycle
  * add hooks for setting & deleting DHCP mappings to DHCP plugins
  * modified interface of the abstract class to reflect new requirements
  * added helpers in existing SDN classes
  * simplified DHCP configuration settings



pve-cluster:

Alexandre Derumier (1):
  add priv/macs.db

 src/PVE/Cluster.pm  | 1 +
 src/pmxcfs/status.c | 1 +
 2 files changed, 2 insertions(+)


pve-network:

Alexandre Derumier (1):
  sdn: fix tests

Stefan Hanreich (12):
  sdn: preparations for DHCP plugin
  subnet: add dhcp options
  sdn: zone: add dhcp options
  sdn: subnet: vnet: refactor IPAM related methods
  ipam: plugins: preparations for DHCP
  dhcp: add abstract class for DHCP plugins
  sdn: dhcp: add dnsmasq plugin
  sdn: dhcp: add helper for creating DHCP leases
  api: add IPAM endpoints
  api: subnet: add dhcp ranges
  api: zone: add dhcp options
  dhcp: regenerate config for DHCP servers on reload

 debian/control                             |   1 +
 src/PVE/API2/Network/SDN.pm                |   6 +
 src/PVE/API2/Network/SDN/Ipam.pm           | 172 ++++++++++++++++++
 src/PVE/API2/Network/SDN/Makefile          |   2 +-
 src/PVE/API2/Network/SDN/Subnets.pm        |   1 +
 src/PVE/API2/Network/SDN/Zones.pm          |   1 +
 src/PVE/Network/SDN.pm                     |   9 +-
 src/PVE/Network/SDN/Dhcp.pm                | 115 ++++++++++++
 src/PVE/Network/SDN/Dhcp/Dnsmasq.pm        | 198 +++++++++++++++++++++
 src/PVE/Network/SDN/Dhcp/Makefile          |   8 +
 src/PVE/Network/SDN/Dhcp/Plugin.pm         |  65 +++++++
 src/PVE/Network/SDN/Ipams.pm               |  80 ++++++++-
 src/PVE/Network/SDN/Ipams/NetboxPlugin.pm  |  86 ++++++++-
 src/PVE/Network/SDN/Ipams/PVEPlugin.pm     |  85 ++++++++-
 src/PVE/Network/SDN/Ipams/PhpIpamPlugin.pm |  29 +++
 src/PVE/Network/SDN/Ipams/Plugin.pm        |  19 +-
 src/PVE/Network/SDN/Makefile               |   3 +-
 src/PVE/Network/SDN/SubnetPlugin.pm        |  32 +++-
 src/PVE/Network/SDN/Subnets.pm             |  98 +++++++---
 src/PVE/Network/SDN/Vnets.pm               | 122 +++++++------
 src/PVE/Network/SDN/Zones.pm               |  34 +++-
 src/PVE/Network/SDN/Zones/SimplePlugin.pm  |   7 +-
 src/test/run_test_subnets.pl               |   8 +-
 src/test/run_test_vnets.pl                 |   4 +-
 24 files changed, 1069 insertions(+), 116 deletions(-)
 create mode 100644 src/PVE/API2/Network/SDN/Ipam.pm
 create mode 100644 src/PVE/Network/SDN/Dhcp.pm
 create mode 100644 src/PVE/Network/SDN/Dhcp/Dnsmasq.pm
 create mode 100644 src/PVE/Network/SDN/Dhcp/Makefile
 create mode 100644 src/PVE/Network/SDN/Dhcp/Plugin.pm


pve-manager:

Stefan Hanreich (4):
  sdn: regenerate DHCP config on reload
  sdn: add DHCP option to Zone dialogue
  sdn: subnet: add panel for editing DHCP ranges
  sdn: dhcp: add view for DHCP mappings

 PVE/API2/Network.pm                  |   1 +
 www/css/ext6-pve.css                 |  10 +-
 www/manager6/Makefile                |   2 +
 www/manager6/dc/Config.js            |  12 +-
 www/manager6/sdn/MappingEdit.js      |  65 ++++++++
 www/manager6/sdn/SubnetEdit.js       | 161 +++++++++++++++++++-
 www/manager6/sdn/zones/Base.js       |   4 +-
 www/manager6/sdn/zones/SimpleEdit.js |  10 ++
 www/manager6/tree/DhcpTree.js        | 215 +++++++++++++++++++++++++++
 9 files changed, 469 insertions(+), 11 deletions(-)
 create mode 100644 www/manager6/sdn/MappingEdit.js
 create mode 100644 www/manager6/tree/DhcpTree.js


qemu-server:

Alexandre Derumier (4):
  vmnic add|remove : add|del ip in ipam
  vm_start : vm-network-scripts: get ip from ipam and add dhcp
    reservation
  api2: create|restore|clone: add_free_ip
  vm_destroy: delete ip from ipam && dhcp

 PVE/API2/Qemu.pm              |  6 +++
 PVE/QemuServer.pm             | 86 +++++++++++++++++++++++++++++++++++
 vm-network-scripts/pve-bridge |  5 ++
 3 files changed, 97 insertions(+)


Summary over all repositories:
  38 files changed, 1637 insertions(+), 127 deletions(-)

-- 
murpp v0.4.0




^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2023-11-15 13:25 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-14 18:05 [pve-devel] [WIP v3 cluster/network/manager/qemu-server 00/22] Add support for DHCP servers to SDN Stefan Hanreich
2023-11-14 18:05 ` [pve-devel] [WIP v3 pve-cluster 01/22] add priv/macs.db Stefan Hanreich
2023-11-14 18:06 ` [pve-devel] [WIP v3 pve-network 02/22] sdn: preparations for DHCP plugin Stefan Hanreich
2023-11-14 18:06 ` [pve-devel] [WIP v3 pve-network 03/22] subnet: add dhcp options Stefan Hanreich
2023-11-14 18:06 ` [pve-devel] [WIP v3 pve-network 04/22] sdn: zone: " Stefan Hanreich
2023-11-14 18:06 ` [pve-devel] [WIP v3 pve-network 05/22] sdn: subnet: vnet: refactor IPAM related methods Stefan Hanreich
2023-11-14 18:06 ` [pve-devel] [WIP v3 pve-network 06/22] ipam: plugins: preparations for DHCP Stefan Hanreich
2023-11-14 18:06 ` [pve-devel] [WIP v3 pve-network 07/22] dhcp: add abstract class for DHCP plugins Stefan Hanreich
2023-11-14 18:06 ` [pve-devel] [WIP v3 pve-network 08/22] sdn: dhcp: add dnsmasq plugin Stefan Hanreich
2023-11-14 18:06 ` [pve-devel] [WIP v3 pve-network 09/22] sdn: dhcp: add helper for creating DHCP leases Stefan Hanreich
2023-11-14 18:06 ` [pve-devel] [WIP v3 pve-network 10/22] api: add IPAM endpoints Stefan Hanreich
2023-11-14 18:06 ` [pve-devel] [WIP v3 pve-network 11/22] api: subnet: add dhcp ranges Stefan Hanreich
2023-11-14 18:06 ` [pve-devel] [WIP v3 pve-network 12/22] api: zone: add dhcp options Stefan Hanreich
2023-11-14 18:06 ` [pve-devel] [WIP v3 pve-network 13/22] dhcp: regenerate config for DHCP servers on reload Stefan Hanreich
2023-11-14 18:06 ` [pve-devel] [WIP v3 pve-network 14/22] sdn: fix tests Stefan Hanreich
2023-11-14 18:06 ` [pve-devel] [WIP v3 pve-manager 15/22] sdn: regenerate DHCP config on reload Stefan Hanreich
2023-11-14 18:06 ` [pve-devel] [WIP v3 pve-manager 16/22] sdn: add DHCP option to Zone dialogue Stefan Hanreich
2023-11-14 18:06 ` [pve-devel] [WIP v3 pve-manager 17/22] sdn: subnet: add panel for editing DHCP ranges Stefan Hanreich
2023-11-15 13:09   ` DERUMIER, Alexandre
2023-11-15 13:24     ` Stefan Hanreich
2023-11-14 18:06 ` [pve-devel] [WIP v3 pve-manager 18/22] sdn: dhcp: add view for DHCP mappings Stefan Hanreich
2023-11-15 12:09   ` DERUMIER, Alexandre
2023-11-15 12:17     ` Stefan Hanreich
2023-11-14 18:06 ` [pve-devel] [WIP v3 qemu-server 19/22] vmnic add|remove : add|del ip in ipam Stefan Hanreich
2023-11-14 18:06 ` [pve-devel] [WIP v3 qemu-server 20/22] vm_start : vm-network-scripts: get ip from ipam and add dhcp reservation Stefan Hanreich
2023-11-14 18:06 ` [pve-devel] [WIP v3 qemu-server 21/22] api2: create|restore|clone: add_free_ip Stefan Hanreich
2023-11-14 18:06 ` [pve-devel] [WIP v3 qemu-server 22/22] vm_destroy: delete ip from ipam && dhcp Stefan Hanreich

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