mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-08-07 03:35:37 +02:00
dhcp-to-dns: add a marker for new records
This commit is contained in:
parent
7597911672
commit
bfcf861b51
2 changed files with 11 additions and 1 deletions
|
@ -21,6 +21,12 @@
|
||||||
:local Ttl 5m;
|
:local Ttl 5m;
|
||||||
:local CommentPrefix "managed by dhcp-to-dns for ";
|
:local CommentPrefix "managed by dhcp-to-dns for ";
|
||||||
|
|
||||||
|
:if ([ / ip dns static print count-only where comment="--- dhcp-to-dns above ---" name=- type=NXDOMAIN disabled ] = 0) do={
|
||||||
|
/ ip dns static add comment="--- dhcp-to-dns above ---" name=- type=NXDOMAIN disabled=yes;
|
||||||
|
$LogPrintExit warning "Added disabled static dns record with comment '--- dhcp-to-dns above ---'." false;
|
||||||
|
}
|
||||||
|
:local PlaceBefore [ / ip dns static find where comment="--- dhcp-to-dns above ---" name=- type=NXDOMAIN disabled ];
|
||||||
|
|
||||||
:foreach DnsRecord in=[ / ip dns static find where comment ~ $CommentPrefix ] do={
|
:foreach DnsRecord in=[ / ip dns static find where comment ~ $CommentPrefix ] do={
|
||||||
:local DnsRecordVal [ / ip dns static get $DnsRecord ];
|
:local DnsRecordVal [ / ip dns static get $DnsRecord ];
|
||||||
:local MacAddress [ $CharacterReplace ($DnsRecordVal->"comment") $CommentPrefix "" ];
|
:local MacAddress [ $CharacterReplace ($DnsRecordVal->"comment") $CommentPrefix "" ];
|
||||||
|
@ -63,6 +69,6 @@
|
||||||
}
|
}
|
||||||
} else={
|
} else={
|
||||||
$LogPrintExit info ("Adding new DNS entry for " . $Fqdn . ", address is " . $LeaseVal->"address" . ".") false;
|
$LogPrintExit info ("Adding new DNS entry for " . $Fqdn . ", address is " . $LeaseVal->"address" . ".") false;
|
||||||
/ ip dns static add name=$Fqdn address=($LeaseVal->"address") ttl=$Ttl comment=$Comment;
|
/ ip dns static add name=$Fqdn address=($LeaseVal->"address") ttl=$Ttl comment=$Comment place-before=$PlaceBefore;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,10 @@ A scheduler cares about cleanup:
|
||||||
Configuration
|
Configuration
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
|
On first run a disabled static dns record acting as marker (with comment
|
||||||
|
"`--- dhcp-to-dns above ---`") is added. Move this entry to define where new
|
||||||
|
entries are to be added.
|
||||||
|
|
||||||
The configuration goes to `global-config-overlay`, these are the parameters:
|
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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue