mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2026-02-22 16:19:36 +00:00
dhcp-to-dns: add support for pool name in fqdn
This commit is contained in:
parent
3b28440b05
commit
ed26d69842
3 changed files with 9 additions and 1 deletions
|
|
@ -10,6 +10,7 @@
|
||||||
:global HostNameInZone;
|
:global HostNameInZone;
|
||||||
:global Identity;
|
:global Identity;
|
||||||
:global PrefixInZone;
|
:global PrefixInZone;
|
||||||
|
:global PoolInZone;
|
||||||
|
|
||||||
:global CharacterReplace;
|
:global CharacterReplace;
|
||||||
:global IfThenElse;
|
:global IfThenElse;
|
||||||
|
|
@ -46,7 +47,12 @@
|
||||||
[ $CharacterReplace ($LeaseVal->"mac-address") ":" "-" ] \
|
[ $CharacterReplace ($LeaseVal->"mac-address") ":" "-" ] \
|
||||||
[ $CharacterReplace ($LeaseVal->"host-name") " " "" ] ];
|
[ $CharacterReplace ($LeaseVal->"host-name") " " "" ] ];
|
||||||
|
|
||||||
:local Fqdn ($HostName . "." . $Zone);
|
:local Server [ / ip dhcp-server find where name=($LeaseVal->"server") ];
|
||||||
|
:local ServerVal [ / ip dhcp-server get $Server ];
|
||||||
|
:local Pool ($ServerVal->"address-pool");
|
||||||
|
:local ZoneVal ([ $IfThenElse ($PoolInZone = true) ($Pool . ".") ] . $Zone);
|
||||||
|
|
||||||
|
:local Fqdn ($HostName . "." . $ZoneVal);
|
||||||
:local DnsRecord [ / ip dns static find where name=$Fqdn ];
|
:local DnsRecord [ / ip dns static find where name=$Fqdn ];
|
||||||
:if ([ :len $DnsRecord ] > 0) do={
|
:if ([ :len $DnsRecord ] > 0) do={
|
||||||
:local DnsIp [ / ip dns static get $DnsRecord address ];
|
:local DnsIp [ / ip dns static get $DnsRecord address ];
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ The configuration goes to `global-config-overlay`, these are the parameters:
|
||||||
|
|
||||||
* `Domain`: the domain used for dns records
|
* `Domain`: the domain used for dns records
|
||||||
* `HostNameInZone`: whether or not to add the dhcp/dns server's hostname
|
* `HostNameInZone`: whether or not to add the dhcp/dns server's hostname
|
||||||
|
* `PoolInZone`: whether or not to add the dhcp server's pool name
|
||||||
|
|
||||||
See also
|
See also
|
||||||
--------
|
--------
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@
|
||||||
:global Domain "example.com";
|
:global Domain "example.com";
|
||||||
:global HostNameInZone true;
|
:global HostNameInZone true;
|
||||||
:global PrefixInZone true;
|
:global PrefixInZone true;
|
||||||
|
:global PoolInZone false;
|
||||||
|
|
||||||
# These addresses are used to send e-mails to. The to-address needs
|
# These addresses are used to send e-mails to. The to-address needs
|
||||||
# to be filled; cc-address can be empty, one address or a comma
|
# to be filled; cc-address can be empty, one address or a comma
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue