diff --git a/dhcp-to-dns.rsc b/dhcp-to-dns.rsc index 007a96e3..8fb83d1b 100644 --- a/dhcp-to-dns.rsc +++ b/dhcp-to-dns.rsc @@ -91,7 +91,8 @@ :local NetDomain ([ $IfThenElse ([ :len ($NetworkInfo->"name-extra") ] > 0) ($NetworkInfo->"name-extra" . ".") ] . \ [ $EitherOr [ $EitherOr ($NetworkInfo->"domain") ($NetworkVal->"domain") ] $Domain ]); :local FullA [ :convert transform=lc ($MacDash . "." . $NetDomain) ]; - :local FullCN [ :convert transform=lc ($HostName . "." . $NetDomain) ]; + :local CNameDomain [ $EitherOr ($LeaseInfo->"cname-domain") ($NetworkInfo->"cname-domain") ]; + :local FullCN [ :convert transform=lc ($HostName . "." . [ $EitherOr $CNameDomain $NetDomain ]) ]; :local MacInServer ($LeaseVal->"active-mac-address" . " in " . $LeaseVal->"server"); :local DnsRecord [ /ip/dns/static/find where comment=$Comment type=A ]; diff --git a/doc/dhcp-to-dns.md b/doc/dhcp-to-dns.md index bf0db384..bb46040b 100644 --- a/doc/dhcp-to-dns.md +++ b/doc/dhcp-to-dns.md @@ -84,6 +84,19 @@ Note this information can be configured in wireless access list with then due to script execution order. Decrease the scheduler interval to reduce the effect. +### Override domain for CNAME records + +By default both the A record (based on mac address) and the CNAME record +(based on host name) use the same domain. You can set a different domain +for CNAME records with `cname-domain=` in network comment: + + /ip/dhcp-server/network/add address=10.0.0.0/24 domain=dhcp.example.com comment="cname-domain=example.com"; + +Adding `cname-domain=` in lease comment has even higher priority: + + /ip/dhcp-server/lease/add address=10.0.0.50 comment="cname-domain=example.com" mac-address=00:11:22:33:44:55 server=dhcp; + + Frequently asked questions --------------------------