There are many examples of DNS-from-DHCP scripts, and my three MikroTik routers have a version running reliably. (Mostly). [All are running ROS v7 "current" channel].
There is some discussion of doing DNS-from-DHCP with script-on-DHCP-lease, though that seems to have the limitation of working only on explicitly a lease assignment, which under limited circumstances could become inconsistent. So, unless that's been solved and best practice now is indeed to use script-on-DHCP-lease, I assume I want to stick with the more-labor-intensive (for the MikroTiks' CPUs) but more capable and reliable scheduled scripts. (Right?)
There has been a little discussion of the problem of multi-homed devices (that is, devices with two or more network connection types, typically a notebook computer with both Ethernet and Wi-Fi) when more-than-one of the multi-homed device's interfaces connect to the same network; with my script, I'm having a problem with one notebook computer which sometimes has both its Ethernet cable plugged in and its Wi-Fi adapter enabled. (The best would be for the Wi-Fi to be automatically turned off when the Ethernet is connected, but sometimes users/Windows .... ).
I'm a bit fuzzy on this next part: I think that the hostname is supplied by the host to the DHCP server on the MikroTik. (Yes?) So when the DNS-from-DHCP script runs, it will get two active DHCP leases' IP addresses for the one hostname:
# Parse through all current DHCP leases
:foreach lease in [/ip dhcp-server lease find] do={
:local hostname [/ip dhcp-server lease get value-name=host-name $lease]
:local hostaddr [/ip dhcp-server lease get value-name=active-address $lease]
...
As a result, I get log entries like this:
2026-05-19 16:38:43 script,info DNS via DHCP v2 updated hostname JayThinkP51-2 to hostaddr 192.168.255.13
2026-05-19 16:38:43 system,info static dns entry changed by scheduler:DNS via DHCP v2/script:DNS via DHCP v2/action:1157 (/ip dns static set *6F address=192.168.255.13)
2026-05-19 16:38:43 script,info DNS via DHCP v2 updated hostname JayThinkP51-2 to hostaddr 192.168.255.15
2026-05-19 16:38:43 system,info static dns entry changed by scheduler:DNS via DHCP v2/script:DNS via DHCP v2/action:1158 (/ip dns static set *6F address=192.168.255.15)
How could multi-homed hosts be handled for DNS-from-DHCP? I don't want to have two different hostnames for the two interfaces of the one host.
Thoughts, please?
thank you,