infix icon indicating copy to clipboard operation
infix copied to clipboard

Add support for DHCP server

Open troglobit opened this issue 1 year ago • 4 comments

Description

A common feature request is support for DHCP server. Discussions have been around continuing to use dnsmasq, which is used as the system DNS resolver and helper for coordinating received DHCP client options and configured settings, or to leverage the ISC DHCP server. The latter has a new implementation called Kea which also use sysrepo + yang. However, it does not seem their YANG model and implementation can easily be reused, see the Infix discussion thread for more: https://github.com/orgs/kernelkit/discussions/345.

Requirements

  1. Easy to set up a general DHCP server
    • Selecting an interface in the CLI infers pool range, DNS server, and gateway option from interface address
    • Inferred default options (dnsmasq defaults) from the CLI
  2. Support static host leases
    • Support matching on MAC address, client-id option, and (future) Option 82 sub-options
    • Support "easy replacement" with Option 82, i.e., not lock static leases to MAC address
  3. Support setting DHCP options (with YANG validation of standard types like inet address)
    • Global options
    • Pool option, possible to override global options
    • Static host options, possible to override global and pool options
  4. Common settings, that many vendors have dedicated settings for, like "default router", "dns server", should be managed as DHCP options instead
  5. Use common vernacular in the YANG model:
    • Compare existing models, including draft models (see below links)
    • Compare with nomenclature used by Cisco/Juniper/Procurve/Moxa/Westermo
    • Fit in with nomenclature used in infix-dhcp-client.yang and other models in Infix
    • If all else fails, use terminology from dnsmasq

One critical use-case Infix must support is "IP per port". I.e., a central DHCP server[^1], with relay agents on other subnets that are capable of tacking on Option 82, containing local port name and relay agent ID. See issue #438 for more information. The server can then use this information to always hand out the same IP address to client(s) connected to that port on that switch. For quick device replacement these static leases must be possible to disable locking to the MAC address of the old (to be replaced) device.

dhcp-server2

In the simplest variant of this use-case the relay agent and DHCP server run on the same Infix device. But for the implementation of DHCP server support in Infix, the server must support serving leases (including static) on per-subnet rather than on a per-interface basis.

[^1]: possibly with a hot-standby backup.

Additional Information

General Information

You can help out by sponsoring the development, or contributing a pull request for its support. Use this issue for discussions around this topic.

troglobit avatar May 15 '24 06:05 troglobit

WIP here https://github.com/kernelkit/infix/tree/dhcp-server

troglobit avatar Aug 21 '24 15:08 troglobit

Review patch from Minex.

troglobit avatar Aug 30 '24 14:08 troglobit

CCB: Adjust milestone, this issue is for the complete DHCP server package including relay agent, which was never the target for v25.01.

troglobit avatar Jan 30 '25 12:01 troglobit

  • [X] #703 merged to mainline.

troglobit avatar Jan 31 '25 15:01 troglobit