All, I noticed while looking for scripts that would set DNS entries for DHCP leases that all of them were old and used the scheduler. I have created a new script using the new on-lease script functionality in ROS 6.2+. My code is on Github at the link below. Would love feedback.
You could use this, instead of “static topdomain” name in script.
:set topdomain [/ip dhcp-server network get number=0 domain];
And every time you add an DHCP-server, increment it by 1 ![]()
Then if you change domain under dhcp server settings, it always changes in script accordingly.
And you can tie your TTL to lease time aswell:
:set ttl [/ip dhcp-server get number=0 lease-time];
Did those modifications to that script and its working just great for me, thank you ![]()
Good idea on using the DHCP network for the domain name. The trouble is that there isn’t always a one to one mapping between the network and the DHCP server. I could do a comparison between the IP the client received and the list of networks to find the value. I’ll have to look into the IP comparison operators offered by ROS scripting.
I thought about tying the TTL to the lease time but there are many reasons you may want the TTL lower. If a computer properly leaves the network and releases its DHCP address then the name will be freed up early for example. Also DNS clients are not going to be requesting the record at the start of the lease. So a 30min lease with a client requesting a DNS lookup at 25min into that lease means a 30min cache store. In addition the resolver built into windows caches for 24 hrs regardless of TTL.
In the DNS/DHCP setup at my place of employment the software has a static DDNS ttl which by default is 1 minute. I was mainly emulating that behavior.
This would be actually awesome, mine is just “quick and dirty” solution… ![]()
And actually you are quite right about TTL.
Thanks jkarras for the script - it work very well.
I’ve created a mod as a proposed method to dynamically determine the domain:
https://github.com/daven-que/ROS-DDNS
Thanks …
This is useful and good …