mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2026-06-06 10:42:34 +00:00
Compare commits
4 commits
a6288217c1
...
b462964455
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b462964455 | ||
|
|
96794c85e1 | ||
|
|
e195391bec | ||
|
|
da8ce886ff |
3 changed files with 19 additions and 3 deletions
|
|
@ -23,6 +23,7 @@ for details!
|
|||
* [Ignacio Serrano](mailto:ignic@ignic.com) (@ignic)
|
||||
* [Ilya Kulakov](mailto:kulakov.ilya@gmail.com) (@Kentzo)
|
||||
* [Leonardo David Monteiro](mailto:leo@cub3.xyz) (@leosfsm)
|
||||
* [Łukasz Witkowski](mailto:witul@skyhost.pl) (@witul)
|
||||
* [Michael Gisbers](mailto:michael@gisbers.de) (@mgisbers)
|
||||
* [Miquel Bonastre](mailto:mbonastre@yahoo.com) (@mbonastre)
|
||||
* @netravnen
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@
|
|||
$LogPrint debug $ScriptName ("A lease just vanished, ignoring.");
|
||||
:continue;
|
||||
}
|
||||
:local LeaseInfo [ $ParseKeyValueStore ($LeaseVal->"comment") ];
|
||||
|
||||
:if ([ :len ($LeaseVal->"active-address") ] = 0) do={
|
||||
$LogPrint debug $ScriptName ("No address available... Ignoring.");
|
||||
|
|
@ -86,11 +87,12 @@
|
|||
|
||||
: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 HostName [ $CleanName [ $EitherOr ($LeaseInfo->"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);
|
||||
:local FullCN ($HostName . "." . $NetDomain);
|
||||
:local FullA [ :convert transform=lc ($MacDash . "." . $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 ];
|
||||
|
|
|
|||
|
|
@ -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
|
||||
--------------------------
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue