date; system info; static dns entry removed by scriptuser
date; system info; static dns entry added by scriptuser
Code: Select all
:local topdomain
:local hostname
:local hostip
:set topdomain "foo.com" ;
/ip dhcp-server lease ;
:foreach i in=[find] \
do={ \
/ip dhcp-server lease ;
:if ([:len [get $i host-name]] > 0) do={ \
:set hostname ([get $i host-name] . "." . $topdomain); \
:set hostip [get $i address]; \
:put ( $hostname . " : " . $hostip ) ; \
/ip dns static ;
:foreach di in=[find] do={ :if ([get $di name] = $hostname) do {/ip dns static remove $di }}
/ip dns static add name=$hostname address=$hostip
} \
};