Skip to content

Instantly share code, notes, and snippets.

@squarooticus
Created October 24, 2025 13:03
Show Gist options
  • Select an option

  • Save squarooticus/8e68170ad51735193e9a3698a4d9d680 to your computer and use it in GitHub Desktop.

Select an option

Save squarooticus/8e68170ad51735193e9a3698a4d9d680 to your computer and use it in GitHub Desktop.
Assign the MAC address as part of dynamic hostname to distinguish them
set hwstr = concat (
suffix (concat ("0", binary-to-ascii (16, 8, "", substring(hardware,1,1))),2), "-",
suffix (concat ("0", binary-to-ascii (16, 8, "", substring(hardware,2,1))),2), "-",
suffix (concat ("0", binary-to-ascii (16, 8, "", substring(hardware,3,1))),2), "-",
suffix (concat ("0", binary-to-ascii (16, 8, "", substring(hardware,4,1))),2), "-",
suffix (concat ("0", binary-to-ascii (16, 8, "", substring(hardware,5,1))),2), "-",
suffix (concat ("0", binary-to-ascii (16, 8, "", substring(hardware,6,1))),2)
);
if not (exists host-name) or not (option host-name ~~ "^[a-z0-9-]+$") {
ddns-hostname = concat("dhcp-" , hwstr);
} elsif option host-name ~~ "^(chromecast|google-)" {
ddns-hostname = concat(option host-name, "-", hwstr);
}
# Can't wait until I have to figure out how to do this with Kea or some other replacement 🙄
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment