eworm-de / routeros-scripts

a collection of scripts for MikroTik RouterOS
GNU General Public License v3.0
1.27k stars 285 forks source link

Feature Request: dhcp-to-dns - use domain from networks #40

Closed tagno25 closed 1 year ago

tagno25 commented 1 year ago

It would be nice if the script would pull the domain from "/ip/dhcp-server/network" using the appropriate "domain" value.

eworm-de commented 1 year ago

Well, yes... The idea is not bad. 😉 I will have to take a look and think about how to integrate.

eworm-de commented 1 year ago

We would have to find the matching network by address, no? Something like:

:put [ /ip/dhcp-server/network/get ([ find where 10.0.0.50 in address]->0) domain ];
example.com

Given a domain is found... How to handle this? Should extra info (identity, prefix, dhcp server name) go into the DNS name?

I think about making this configurable with the network's comment, something like...

/ip/dhcp-server/network/add ... domain=example.com comment="dhcp-to-dns, identity=yes, prefix=no, server-name=yes";

... and drop $Domain, $HostNameInZone, $PrefixInZone and $ServerNameInZone completely.

eworm-de commented 1 year ago

Implemented with ee94024dcaa59333f03d90f342e550a5f3ab40f2... See the documentation on how to use the optional configuration.