tech-net archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: MVP for a DHCP server
---- On Mon, 14 Jul 2025 17:17:44 +0100 Edgar Fuß <ef%math.uni-bonn.de@localhost> wrote ---
> > Why do you need to wire hosts to fixed IP addresses?
> Because I have DNS entries for them, SSH keys in known_hosts, packetfilter entries, proxy entries on servers delegating to some of them etc. etc. etc.
>
> > This is an important question because there is no equivalent for DHCPv6 as DHCPv6 does not carry a hardware address option.
> Who on earth needs DHCPv6?
> On v6, I know the IP address as soon as I know the prefix since I know the MAC.
>
> > My view is that if you need a host to be a fixed IP address then please configure the fixed IP address on the host and use the INFORM function.
> I want to configure as little as possible on the clients. For one thing, one needs to be able to log into the client to configure it, no?
> Szenario 1: A piece of hardware configured as a desktop machine is going to become a kiosk machine. I simply change the DHCP/DNS configuration (what I really do is change one master file that generates them) and am done (after automatically letting the hardware re-install the OS).
> Szenario 2: An AP breaks and I replace it. I basically run one generic configure script via SSH on it and change the MAC in the master configuration file used to generate DHCP/DNS and am done.
Neither of those two scenarios require static IP address.
You configure a hostname on the device.
You configure the DHCP client to send the hostname as part of the REQUEST as per RFC4702.
The DHCP server will update the DNS with the hostname/ip and return the result of the DNS update in the ACK.
OR it could just send the RFC2132 hostname option and *hope* the DHCP server does something useful with it.
This is more reliable than a hardware address as the physical interface could move to a different machine and now has a wrong config.
This is why the DUID was invented and should be treated as an opaque value and not interogated for the hardware address.
The only downside with this approach is the former requires a manual config per box and the latter requires an unknown initial boot per box to dervive the DUID.
Currently the only combo I know of where this works with is dhcpcd with dnsmasq and the reason it works easily is because dnsmasq does both DHCP and DNS.
Boom, almost zero config it just works.
Anyway, dhcpsd doesn't do any DNS updating (yet)
So this was todays project.
$ doas ./dhcpsd -df -p ./plugins/ethers.so -p ./plugins/addrinfo.so vether0
dhcpsd-0.0.1 starting
plugin loaded: ethers: Looks up hardware address mappings in ethers(5)
plugin loaded: addrinfo: Looks up hostname address mappings via getaddrinfo(3)
If you don't have a mapping for the hardware address in /etc/ethers then it will look up the value of the given hostname DHCP option in getaddrinfo(3).
So that's two ways of handling your static address mapping.
The great news is that you don't have to restart or signal dhcpsd to reload it's config - i just edited /etc/hosts and /etc/ethers and the magic
happened the next time clients renewed either leases.
It could even go the other way (a task for later) and add the hostname / fqdn option if either plugin knows the hostname to the message on the way back.
Plugins are run in order loaded, first success wins.
So right now I'm thinking can we do the whole config via plugins?
For example move the automatic address pool to a plugin.
I want a balls simple config, if any. I want this to be more like bozohttpd and not like apache or nginx.
Roy
Home |
Main Index |
Thread Index |
Old Index