diff --git a/dhcp-to-dns.rsc b/dhcp-to-dns.rsc index d176b9f7..088c2dee 100644 --- a/dhcp-to-dns.rsc +++ b/dhcp-to-dns.rsc @@ -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); diff --git a/doc/dhcp-to-dns.md b/doc/dhcp-to-dns.md index 47e01ae5..6f18ce90 100644 --- a/doc/dhcp-to-dns.md +++ b/doc/dhcp-to-dns.md @@ -50,14 +50,19 @@ 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"; This example would result in name `00-11-22-33-44-55.dhcp.another-domain.com` for the same lease. + If no domain is found in dhcp server's network definition a fallback from `global-config-overlay` is used. This is the parameter: