Setting static DNS record for each DHCP lease
Run this in scheduler and it will add static dns entry for each DHCP lease.
:set topdomain "yourdomain.com" ; /ip dhcp-server lease ; :foreach i in=[find] \ do={ \ /ip dhcp-server lease ; :if ([:len [get $i host-name]] > 0) do={ \ :set hostname ([get $i host-name] . "." . $topdomain); \ :set hostip [get $i address]; \ :put ( $hostname . " : " . $hostip ) ; \ /ip dns static ; :foreach di in [find] do = { :if ([get $di name] = $hostname) do {/ip dns static remove $di }} /ip dns static add name=$hostname address=$hostip } \ };