Community discussions

MikroTik App
 
eggbean
just joined
Topic Author
Posts: 10
Joined: Sat May 16, 2020 8:53 am
Location: London, UK
Contact:

Is it possible to make a DHCP lease script which adds a DNS record for a device through its MAC address?

Sun Sep 27, 2020 8:32 am

Is it technically possible to make a DHCP lease script which adds a DNS record for a device through its MAC address, but instead of making it static (or maybe it does?), applies it to the IP address assigned through DHCP? The MAC addresses for these specific devices could be added to the script as variables or in an array.

While I do not yet understand the RouterOS scripting language or know of its capabilities/limitations, I get the idea that this may be possible by looking at another script which I use that adds static DNS entries for devices that get their IP address through DHCP.
https://blog.pessoft.com/2019/09/06/mik ... cp-leases/

So I am asking if this is possible before I attempt to learn how to do it. The reason for wanting this is for a similar reason I use the script above: so that the devices appear in Pi-Hole's interface statistics as hostnames, although this time for devices that don't actually have hostnames through DHCP (option 12?).

At the moment I am giving these devices static addresses through DHCP and manually making DNS records for them. The purpose of the script would be to have it occur with dynamic IP addresses in a similar way to the other script, but with MAC addresses and (DNS) hostnames supplied for these specific devices. This way nothing further would have to be done if the devices are moved to another VLAN.
 
User avatar
eworm
Forum Guru
Forum Guru
Posts: 1092
Joined: Wed Oct 22, 2014 9:23 am
Location: Oberhausen, Germany
Contact:

Re: Is it possible to make a DHCP lease script which adds a DNS record for a device through its MAC address?

Wed Sep 30, 2020 12:58 am

Perhaps my script dhcp-to-dns may be of interest... If I got you right it does what you want.
(It depends on more scripts, so see main README for installation.)

Who is online

Users browsing this forum: No registered users and 11 guests