Community discussions

MikroTik App
 
User avatar
Alexander514
just joined
Topic Author
Posts: 10
Joined: Tue Mar 06, 2018 4:34 pm

Sync DHCP hostnames and DNS entries

Sun Jan 10, 2021 9:10 am

Hello,
I tried to write a script to create/update static DNS recods for each DHCP lease. Unfortunately, I got following problems:
  • DHCP server lease-script does not execute after changing hostname on client and reconnecting
  • Missing timeout option for static DNS entries. So in my case it's not possible to remove old dns records automatically
Example:
mikrotik:
  /ip dhcp-server
 set [find name=lan-dhcp] lease-script="/beep"
client(linux):
 hostnamectl set-hostname testing
systemctl restart network-manager
Cheking:
[admin@mikrotik] /ip dhcp-server lease> /ip dhcp-server lease print 
Flags: X - disabled, R - radius, D - dynamic, B - blocked 
 #   ADDRESS                                  MAC-ADDRESS       HOST-NAME           SERVER         RATE-LIMIT     STATUS  LAST-SEEN                                  
 0 D 192.168.10.30                            9C:DA:3E:XX:XX:XX testing             lan-dhcp                      bound   2m17s
 
DHCP lease updated, but script didn't run.


----
P.S.
Feature request: Add option to sync DHCP hostnames and DNS entries
I'm wondering is it possible to add this feature in next releases. According to a huge amount of scripts and instructons over the Internet, this feature important for a lot of clients.

Who is online

Users browsing this forum: Adams32e, Google [Bot] and 159 guests