Unable to set ddns-hostname in static-mapping-parameters

I recently followed this great thread about adding DDNS functionality to VYOS DHCP Server.

It worked as described and I was able to get DDNS working and updating a bind DNS server.
However it seems some devices on my network all report the same hostname (because who would buy multiple smart plugs?).

Anyway to get round this I planned on setting the hostname using the “ddns-hostname” option using the “static-mapping-parameters” setting which should insert it into the “host” block.
I seem to be able to set other custom DHCP options using this method but setting ddns-hostname fails to commit saying “check your options!”

Working:
`service dhcp-server shared-network-name IOT subnet 192.168.64.0/23 static-mapping study1-tapo110 static-mapping-parameters ‘option host-name study1-tapo110;’

Not working:
subnet 192.168.64.0/23 static-mapping study1-tapo110 static-mapping-parameters "option ddns-hostname "study1-tapo110";"

Because quote are not allow in the config, i used the same method of setting ddns-rev-domainname from the tutorial linked above (shared-network-parameters ‘ddns-rev-domainname "in-addr.arpa.";’)

Anyone tried anything similar and succeeded?

I could of course just add these static mappings to the DNS server as static entries but i’d prefer to only have it in one place since it makes maintenance and cleanup/decom easier down the line.

I fixed it. Turns out I was not applying the option correctly. I also then ran into a second problem which where devices with a static mapping (Static DHCP reservation) were not updating DNS.

So in the interest of helping others here is my working config which builds upon the link above to use VYOS to do DDNS updates to a bind 9 server.

service {
    dhcp-server {
        dynamic-dns-update
        shared-network-name IOT {
            authoritative
            domain-name iot.home.example.com
            name-server 192.168.64.1
            ntp-server 192.168.64.1
            shared-network-parameters "key rndc-key { algorithm hmac-sha256; secret ThisIsAVerySecretKey; };"
            shared-network-parameters "ddns-domainname "iot.home.example.com.";"
            shared-network-parameters "ddns-rev-domainname "in-addr.arpa.";"
            shared-network-parameters "zone iot.home.example.com. { primary 192.168.71.100; key rndc-key; }"
            shared-network-parameters "zone 64.168.192.in-addr.arpa. { primary 192.168.71.100; key rndc-key; }"
            shared-network-parameters "ddns-update-style standard;"
            shared-network-parameters "ddns-updates on;"
            shared-network-parameters "update-static-leases true;"
            subnet 192.168.64.0/23 {
                default-router 192.168.64.1
                lease 86400
                range unreserved {
                    start 192.168.64.32
                    stop 192.168.64.255
                }
                static-mapping livingroom2-HS100 {
                    ip-address 192.168.65.5
                    mac-address b0:4e:26:17:2a:12
                    static-mapping-parameters "ddns-hostname livingroom2-HS100;"
                    static-mapping-parameters "option host-name livingroom2-HS100;"
                }
                static-mapping study1-tapo110 {
                    ip-address 192.168.65.2
                    mac-address 1c:61:b4:ce:47:82
                    static-mapping-parameters "option host-name study1-tapo110;"
                    static-mapping-parameters "ddns-hostname "study1-tapo110";"
                }
            }
        }

Key config parameters:

  • ddns-hostname - This sets the hostname reported to the DNS server.
  • "update-static-leases true;" - Without this dhcpd will not update ddns entries for static mappings.

Optional Config parameters:

  • option host-name - DHCP option 12. Says to the device, please use hostname xxx (not all device support/honor it)
  • ddns-update-style standard; - See ISC DHCP support for Standard DDNS

This is confirmed working on VYOS 1.4-rolling-202306010317 (running isc-dhcpd-4.4.3-P1). It should also work with Infoblox (NIOS and Bloxone DDI with some tweaking to the shared key) however if you have access to Infoblox use DHCP relay or run the B1DDI KVM image on the VYOS box. Infoblox makes this whole thing soooo much easier.

2 Likes

Hi @Shrug666! NICE job on fixing the issue and finding a solution, and thank you for sharing your working config! It’s always helpful to contribute to the community and help others facing similar challenges.

Cheers,
Joe

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.