RouterOS

DHCP

Export DHCP entries to a file:

/ip dhcp-server lease export file=dhcp-export

DNS

Add a static DNS entry

/ip dns static add name=hypervisor address=192.168.88.193

Script: dns-sink-off

{
    local data [/tool fetch url="http://worldtimeapi.org/api/timezone/Europe/Budapest.txt" mode=http as-value output=user];
    :if (($data->"data")~"day_of_week *: *[60]") do={
        :put "This is Saturday or Sunday, not doing anything";
    } else={
        /ip dns static remove [/ip dns static find address=127.0.0.1];
        /tool e-mail send to="XXX" body="DNS sinkhole disabled" subject="DNS Sinkhole disabled";
    };
}

Script: dns-sink-on

{
    local data [/tool fetch url="http://worldtimeapi.org/api/timezone/Europe/Budapest.txt" mode=http as-value output=user];
    :if (($data->"data")~"day_of_week *: *[60]") do={
        :put "This is Saturday or Sunday, not doing anything";
    } else={
        /ip dns static add regexp=".*youtube.*" address=127.0.0.1 ttl=5m;
        /ip dns static add name="telex.hu" address=127.0.0.1 ttl=5m;
        /ip dns static add name="index.hu" address=127.0.0.1 ttl=5m;
        /ip dns static add name="444.hu" address=127.0.0.1 ttl=5m;
        /tool e-mail send to="XXX" body="DNS sinkhole enabled" subject="DNS Sinkhole enabled";
    };
}

Scheduler

/system scheduler add name=dns-sink-on start-time=07:00:00 interval=1d on-event=dns-sink-on
/system scheduler add name=dns-sink-off start-time=18:00:00 interval=1d on-event=dns-sink-off