mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2026-04-16 10:09:37 +00:00
dhcp-to-dns: support to ignore networks
Closes: https://github.com/eworm-de/routeros-scripts/issues/119
This commit is contained in:
parent
c033f90d0c
commit
78bd74c544
2 changed files with 15 additions and 5 deletions
|
|
@ -72,15 +72,21 @@
|
|||
:continue;
|
||||
}
|
||||
|
||||
:local Comment ($CommentPrefix . ", macaddress=" . $LeaseVal->"active-mac-address" . ", server=" . $LeaseVal->"server");
|
||||
:local MacDash [ $CleanName ($LeaseVal->"active-mac-address") ];
|
||||
:local HostName [ $CleanName [ $EitherOr ([ $ParseKeyValueStore ($LeaseVal->"comment") ]->"hostname") ($LeaseVal->"host-name") ] ];
|
||||
:local Network [ /ip/dhcp-server/network/find where ($LeaseVal->"active-address") in address ];
|
||||
:local NetworkVal;
|
||||
:if ([ :len $Network ] > 0) do={
|
||||
:set NetworkVal [ /ip/dhcp-server/network/get ($Network->0) ];
|
||||
}
|
||||
:local NetworkInfo [ $ParseKeyValueStore ($NetworkVal->"comment") ];
|
||||
|
||||
:if ($NetworkInfo->"dns-ignore" = true) do={
|
||||
$LogPrint debug $ScriptName ("Lease for " . $LeaseVal->"active-mac-address" . " is in ignored network... Skipping.");
|
||||
:continue;
|
||||
}
|
||||
|
||||
:local Comment ($CommentPrefix . ", macaddress=" . $LeaseVal->"active-mac-address" . ", server=" . $LeaseVal->"server");
|
||||
:local MacDash [ $CleanName ($LeaseVal->"active-mac-address") ];
|
||||
:local HostName [ $CleanName [ $EitherOr ([ $ParseKeyValueStore ($LeaseVal->"comment") ]->"hostname") ($LeaseVal->"host-name") ] ];
|
||||
:local NetDomain ([ $IfThenElse ([ :len ($NetworkInfo->"name-extra") ] > 0) ($NetworkInfo->"name-extra" . ".") ] . \
|
||||
[ $EitherOr [ $EitherOr ($NetworkInfo->"domain") ($NetworkVal->"domain") ] $Domain ]);
|
||||
:local FullA ($MacDash . "." . $NetDomain);
|
||||
|
|
|
|||
|
|
@ -50,8 +50,12 @@ A bound lease for mac address `00:11:22:33:44:55` with ip address
|
|||
`10.0.0.50` would result in an A record `00-11-22-33-44-55.example.com`
|
||||
pointing to the given ip address.
|
||||
|
||||
Additional options can be given from comment, to add an extra level in
|
||||
dns name or define a different domain.
|
||||
Additional options can be given from comment, first of all you can opt-out
|
||||
for specific networks:
|
||||
|
||||
/ip/dhcp-server/network/add address=10.0.0.0/24 domain=example.com comment="dns-ignore=true";
|
||||
|
||||
Use this to add an extra level in dns name or define a different domain.
|
||||
|
||||
/ip/dhcp-server/network/add address=10.0.0.0/24 domain=example.com comment="domain=another-domain.com, name-extra=dhcp";
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue