MikroTik does not automatically add entries for DHCP to the static list. As inten said ... you need to use a script to do it.
This should happen automatically without needing to use a script. Thank you both for the confirmation.
Should is relative. I agree it should be an option, but you can do it easily with scripts.
If you want more DNS/DHCP functionality you could also run a raspberry pi or something else with linux and use bind/DHCPd/DNSMasq/etc.... Not saying its necessary, but its an option.
But yeah. None of that is actually built into RouterOS.
Here is the script I use. It either will add the entries by hostname or by the comment field if you add "+hostname" to the end of your comment. It sets the TTL to all entries it adds and marks all of the "Dynamic" entries with a specific comment so it can remove them later. You can use it as a starting point..
ros code
#.* by RouterOS
#
# DHCP Leases to Static DNS
#
#
# Variables
#
:local tld "lan"
:local addtld false
:local scriptTTL "01:00:00"
:local scriptComment "DHCP"
:local byComment true
:local byHostname false
#
# Script
#
:set scriptComment ("+" . $scriptComment)
# Flush Old Dynamic Entries
/ip dns static {
remove [find comment~("^" . $scriptComment . ".*\$")]
}
# Insert by Comment
:if ($byComment) do={
:local currentComment ($scriptComment . "-Comment")
/ip dhcp-server lease {
:foreach i in=[find comment~"^([^+])*\\+([^+])*\$"] do={
:local leaseComment [get $i comment]
:local currentHostname [:pick $leaseComment ([:find $leaseComment "+"]+1) [:len $leaseComment]]
:if ($addtld) do={
:set currentHostname ($currentHostname . "." . $tld)
}
:local currentAddress [get $i address]
:local free true
/ip dns static {
:foreach j in [find name=$currentHostname] do={
:set free false
}
:if ($free) do={
/ip dns static add name=$currentHostname address=$currentAddress ttl=$scriptTTL comment=$currentComment
}
}
}
}
}
# Insert by Hostname
:if ($byHostname) do={
:local currentComment ($scriptComment . "-Hostname")
/ip dhcp-server lease {
:foreach i in=[find] do={
:if ([:len [get $i host-name]] > 0) do={
:local currentHostname [get $i host-name]
:if ($addtld) do={
:set currentHostname ($currentHostname . "." . $tld)
}
:local currentAddress [get $i address]
:local free true
/ip dns static {
:foreach j in [find name=$currentHostname] do={
:set free false
}
:if ($free) do={
/ip dns static add name=$currentHostname address=$currentAddress ttl=$scriptTTL comment=$currentComment
}
}
}
}
}
}