1
0
Fork 0
Enabling PowerDNS to query popular supported Dhcp-servers.
Find a file
2025-01-30 01:29:51 +01:00
.config Migrate existing code 2025-01-29 23:53:57 +01:00
Areas/Identity/Pages Setup 2025-01-29 23:26:50 +01:00
Data Cleanup Namespaces 2025-01-30 00:14:20 +01:00
ext Conditional Identity 2025-01-30 01:29:51 +01:00
Integrations Migrate existing code 2025-01-29 23:53:57 +01:00
Options Migrate existing code 2025-01-29 23:53:57 +01:00
Pages Cleanup Namespaces 2025-01-30 00:14:20 +01:00
Properties LaunchSettings 2025-01-30 01:10:46 +01:00
Services Migrate existing code 2025-01-29 23:53:57 +01:00
System Migrate existing code 2025-01-29 23:53:57 +01:00
wwwroot Setup 2025-01-29 23:26:50 +01:00
.editorconfig Setup 2025-01-29 23:26:50 +01:00
.gitattributes Setup 2025-01-29 23:26:50 +01:00
.gitignore Setup 2025-01-29 23:26:50 +01:00
appsettings.Development.json LaunchSettings 2025-01-30 01:10:46 +01:00
appsettings.json Cleanup Namespaces 2025-01-30 00:14:20 +01:00
Directory.Build.props Cleanup Namespaces 2025-01-30 00:14:20 +01:00
Directory.Build.targets Cleanup Namespaces 2025-01-30 00:14:20 +01:00
global.json Cleanup Namespaces 2025-01-30 00:14:20 +01:00
libman.json Setup 2025-01-29 23:26:50 +01:00
LICENSE Setup 2025-01-29 23:26:50 +01:00
netddi.csproj Migrate existing code 2025-01-29 23:53:57 +01:00
netddi.sln Setup 2025-01-29 23:26:50 +01:00
Program.cs Conditional Identity 2025-01-30 01:29:51 +01:00
README.md Cleanup Namespaces 2025-01-30 00:14:20 +01:00

.NET Dhcp Dns Ipam

Enabling PowerDNS to query popular supported Dhcp-servers.

This project was born out of the necessity for my home-lab network to be able to resolve both IPv4 and IPv6 addresses from one Dhcp-service.

Theoretically Kea can update DNS servers using RFC2136 nsupdate-mechanisms using kea-ddns, but this interoperation can cause issues in networks with devices sharing a hostname (i.e. DHCID records), missing update requests due to service restarts or temporary connectivity issues.

Scope

At the moment there is no need to implement more than is minimally required to get Dhcp4 and Dhcp6 leases queryable by PowerDNS using the memfile "database" of Kea using the remote backend with unix domain sockets.

Following parts may be implemented later as I see fit:

  • Different PowerDNS remote backends
    • mainly HTTP REST
  • Support different Kea lease databases
    • MySQL
    • PostgreSQL

Building

Requires .NET 8 SDK
Create binary using

dotnet publish -c Release -p:PublishTrimmed=true -p:PublishSingleFile=true --self-contained

Usage

Install, and configure Kea (optionally with Stork) Dhcp4, Dhcp6 or both.
Make sure to enable the memfile lease store.

Install and configure PowerDNS, including the remote backend.
A sample configuration file is provided.

Deploy netddi to /opt/netddi
Setup systemd using the provided socket and service units, configure as necessary.

Start Kea, netddi and PowerDNS.

To be done: Packaging for common Linux distributions.
Deb-packages (Debian)
RPM-packages (EL)

Configuration

netddi can be configured using environment variables or the appsettings.json file - Configuration#Binding hierarchies describes the naming scheme in this section.

Default configuration:

Admin:Authentication=true
Dhcp:Kea:Dhcp4:Leases=/var/lib/kea/kea-leases4.csv
Dhcp:Kea:Dhcp6:Leases=/var/lib/kea/kea-leases6.csv
PowerDns:UniqueHostnames=true
PowerDns:Listener:Socket=/run/netddi/pdns.sock

Admin:Authentication enables configuring whether the Admin interface is guarded by admin login.

Dhcp:Kea allows configuring Dhcp4 and Dhcp6 lease file watchers, respective for each of both services.

In PowerDns:Listener:Socket you can optionally configure the unix domain socket to be used in case Systemd isn't providing them (e.g. when starting the service manually).

netddi continuously monitors the Dhcp service leases and upon seeing a new lease all previous records that match in hostname and lease type (IPv4, IPv6) are replaced. If you want to change this behavior you can opt-out of this behavior by setting PowerDns:UniqueHostnames=false.

See Logging in C# for options related to logging.

Acknowledgments

Incorporates following libraries directly:

.NET Foundation and Contributors

  • CommunityToolkit.HighPerformance - MIT
  • dotNext - MIT
  • Several runtime libraries, as part of .NET
    • Microsoft.AspNetCore.App
    • Microsoft.Extensions.Configuration.Binder
    • Microsoft.Extensions.Hosting.Systemd
    • System.IO.Pipelines

Nietras

Incorporates data structures and protocol implementations as required for interop scenarios: