I am using a RB5009UG+S+IN and its DHCP functionality. For the DHCP leases I would like to create the corresponding DNS entries as described at https://wiki.mikrotik.com/wiki/Setting_static_DNS_record_for_each_DHCP_lease.
However, I am a bit afraid that changing the DNS configuration for the DHCP leases could increase the Flash Memory Wear on my device.
My network is for home-use only and, therefore, the number of DHCP lease changes should be relatively low, but in case of restarting devices, etc. is there a real risk for wearing out my flash? At the moment there is nothing running on my device which causes a lot of memory writes.
Is my fear reasonable or could I simply forget about this topic in my case?
While your fears about wearing out the flash storage should be taken seriously, I think you should not be overly concerned. Specially so if there won’t be large number of changes in DNS configuration.
The way DHCP works is this: when a client requests DHCP lease, DHCP server checks if it’s DHCP lease database contains lease for same client (according to client-id field). If it does, then server will offer the same IP address to client (unless IP address is used by another device, but in home environment where number of client devices is smaller than allocated DHCP address pool this is not very probable). In which case there will be no change in DNS tables.
DHCP server can write leases to disk (I’m not sure what’s default settings, I have it set to 12 hours and I’m quite sure that’s default) so after reboot, it’ll still have leases database (mostly up-to-date). Again devices requesting leases will mostly get same IP addresses as before.
When client requests lease, it’ll often request specific IP address (which was used previously) and if DHCP server doesn’t find requested IP address invalid in it’s network, it’ll grant the requested IP address. Meaning that if client is member of LAN then it (transitionally) looses LAN connectivity (e.g. due to ethernet switch reboot or interface disable/enable action in client), it’ll request same IP address as it used before the connectivity loss. Even if DHCP server looses lease database at the same time, client will still end up getting same IP address as before.
And even if client goes away for longer period of time and doesn’t renew lease before it expires (according to DHCP server’s timers), usually DHCP lease remains in database (unless IP address is needed for another device). And when device returns into domain of DHCP server, it’ll again get the old IP address.
So in short: there won’t be many changes in DNS configuration. With one condition: script which will insert DNS records, has to check if matching record already exists (and bail out without making any change). The easiest way is to run remove/add every time the script is run (even if no change is needed) and in this case the number of changes in DNS configuration will be a bit higher. But probably not high enough to make storage wear out considerably faster.
Dynamic DHCP leases are persited to FLASH in a configurable interval (default is 5min) or on proper shutdown/reboot.
But static DNS entries, added manual or by a script, are persisted immediately.
But still the wear out is negligible for the usual home network’s rate of DHCP lease script driven static DNS entries. Especially on the RB5009 having 1GB of flash, so in usual cases there are plenty of unused FLASH sectors to be used by the FLASH driver on small writes (wear leveling).