MikroTik as DNS server

I want to conf my MikroTik Router to act as DNS server so I can block ads.

https://medium.com/@olegsmetanin/once-again-about-mikrotik-adblock-6c5de15c9d06

I found this tutorial but it i am doing something wrong,.. :slight_smile:

What I did:

In winbox I set:

IP–DHCP—Networking–added DNS server 192.168.178.1 (this is also IP of router)

https://www.micu.eu/adblock/adblock.php copy content of this page to adblock.rsc and copy it to router. (File----drag and drop to folder)
sistem-scripts


added script:

:log info “Adblock: apply start”
/ import file-name=adblock.rsc
:log info “Adblock: apply finished”

For policy I set:
read
policy
write
test
sniff
romon

I runed script

Finally I set:

System—Scheduler

Name: adblock_Scheduler
StartTime: startup

Policy: checked
Policy
and
test

On event: sistem script run adblock

after that reboot router, do IP release and renew on cliant PC, DNS is now set to 192.168.178.1 but it is not working. Ping to 8.8.8.8 work OK, to google.com is no respond.

What I am missing here?

Tnx

http://bfy.tw/HXPH

In IP->DNS there’s “Allow Remote Requests” option, you need to enable that. But also make sure that you allow access to DNS ports (tcp/udp 53) only from LAN and not from internet.

Hi,

yes checking option “Allow Remote Requests” did help and dns is now responding but it is not blocking ads on any page. I think I did something wrong. Is it right that i just save content of https://www.micu.eu/adblock/adblock.php in notepad and save it as adblock.rsc? Is there any log file or something to see if script

:log info “Adblock: apply start”
/ import file-name=adblock.rsc
:log info “Adblock: apply finished”

is working?

If understand you correctly I must block port 53 on FW so nobody can access my DNS from WAN?

Look in IP->DNS->Static and there should be all those hostnames that were in script. Then it should work, but remember that DNS records are cached everywhere (they have defined time to live and they are used until it expires), so if you want to be sure that client gets fresh data from router, restart client.

And yes, you want to block access to DNS from internet, otherwise router becomes open resolver and it’s not good. It’s possible that you have it already, default firewall blocks it, but I don’t know what you have.

and also check in IP->DHCP Server->Network-> DNS Server IPAddress