Community discussions

MikroTik App
 
User avatar
Nollitik
Member Candidate
Member Candidate
Topic Author
Posts: 257
Joined: Tue Dec 07, 2010 8:16 am

DNS Changing to the Fastest

Mon Dec 27, 2010 4:12 am

Is there a way to set up a client quick response in real time DNS servers where the router verifies, say every 5 or 10 mins. the resolve times of DNS servers and changes the client DNS servers in order of the fastest DNS servers?
 
rmichael
Forum Veteran
Forum Veteran
Posts: 718
Joined: Sun Mar 08, 2009 11:00 pm

Re: DNS Changing to the Fastest

Mon Dec 27, 2010 4:36 am

Even better, tinydns will query multiple DNS servers and forward the quickes reply to the client. tinydns runs on linux, but I think Acrylic DNS does something similar on Windows.
 
User avatar
Nollitik
Member Candidate
Member Candidate
Topic Author
Posts: 257
Joined: Tue Dec 07, 2010 8:16 am

Re: DNS Changing to the Fastest

Mon Dec 27, 2010 8:50 pm

Even better, tinydns will query multiple DNS servers and forward the quickes reply to the client. tinydns runs on linux, but I think Acrylic DNS does something similar on Windows.
Thank you rmichael for responding. I must point out that I am new to the Mikrotik, RouterOS, etc. Is it possible to add the Tinydns to the RouterOS? If the answer is yes, how do I do that? Would the Tinydns install as a plug-in? For info, I am using an Apple Macbook Pro.
 
Feklar
Forum Guru
Forum Guru
Posts: 1724
Joined: Tue Dec 01, 2009 11:46 pm

Re: DNS Changing to the Fastest

Mon Dec 27, 2010 9:57 pm

The closest you will probably be able to do is write a firewall rule that redirects all DNS requests to a given DNS server, you could then have the DNS server proxy the requests for the end user. Another option is to write a script that will run every few minutes that will try and resolve stuff and depending on the results, modify the NAT rule that handles the redirect. I'm not sure you'll get any real useful information to be able to use it in a script however.

As far as getting something like tinyDNS to run on MikroTik, it won't happen unless you set it up on a virtual machine with metarouter.
 
rmichael
Forum Veteran
Forum Veteran
Posts: 718
Joined: Sun Mar 08, 2009 11:00 pm

Re: DNS Changing to the Fastest

Mon Dec 27, 2010 11:58 pm

Another option is to write a script that will run every few minutes that will try and resolve stuff and depending on the results, modify the NAT rule that handles the redirect. I'm not sure you'll get any real useful information to be able to use it in a script however.
I doubt one can write a script to do that as resolve, ping, traceroute lack features in scripts to make anything useful. Also, DNS resolution is not a high priority it seems ("mikrotik is a router not a DNS server" argument).

What one could do at this point is to setup a netwatch script (where >150ms delay = failure) for IP addresses of DNS servers and enable or disable redirect to them depending on status. For example:
/ip firewall nat
add action=dst-nat chain=dstnat comment=ToDNS8.8.4.4 disabled=no dst-port=53 in-interface=LAN nth=3,1 protocol=udp \
    to-addresses=8.8.4.4
add action=dst-nat chain=dstnat comment=ToDNS8.8.8.8 disabled=no dst-port=53 in-interface=LAN nth=3,2 protocol=udp \
    to-addresses=8.8.8.8
add action=dst-nat chain=dstnat comment=ToDNS208.67.222.222 disabled=no dst-port=53 in-interface=LAN nth=3,3 protocol=udp \
    to-addresses=8.8.4.4

/tool netwatch
add comment="" disabled=no down-script="/ip firewall nat set disabled=yes [/ip firewall nat find comment=ToDNS8.8.4.4]" host=\
    8.8.4.4 interval=15s timeout=150ms up-script=\
    "/ip firewall nat set disabled=no [/ip firewall nat find comment=ToDNS8.8.4.4];"
add comment="" disabled=no down-script="/ip firewall nat set disabled=yes [/ip firewall nat find comment=ToDNS8.8.8.8];" host=\
    8.8.8.8 interval=1m timeout=150ms up-script=\
    "/ip firewall nat set disabled=no [/ip firewall nat find comment=ToDNS8.8.8.8];"
add comment="" disabled=no down-script="/ip firewall nat set disabled=yes [/ip firewall nat find comment=ToDNS208.67.222.222];" \
    host=208.67.222.222 interval=1m timeout=150ms up-script=\
    "/ip firewall nat set disabled=no [/ip firewall nat find comment=ToDNS208.67.222.222];"
Of course this is not very precise because ping test does not test DNS resolution itself. A better resolve command was promised in v5 so will have to wait see.
 
User avatar
Nollitik
Member Candidate
Member Candidate
Topic Author
Posts: 257
Joined: Tue Dec 07, 2010 8:16 am

Re: DNS Changing to the Fastest

Wed Dec 29, 2010 12:29 am

Another option is to write a script that will run every few minutes that will try and resolve stuff and depending on the results, modify the NAT rule that handles the redirect. I'm not sure you'll get any real useful information to be able to use it in a script however.
I doubt one can write a script to do that as resolve, ping, traceroute lack features in scripts to make anything useful. Also, DNS resolution is not a high priority it seems ("mikrotik is a router not a DNS server" argument).

What one could do at this point is to setup a netwatch script (where >150ms delay = failure) for IP addresses of DNS servers and enable or disable redirect to them depending on status. For example:
/ip firewall nat
add action=dst-nat chain=dstnat comment=ToDNS8.8.4.4 disabled=no dst-port=53 in-interface=LAN nth=3,1 protocol=udp \
    to-addresses=8.8.4.4
add action=dst-nat chain=dstnat comment=ToDNS8.8.8.8 disabled=no dst-port=53 in-interface=LAN nth=3,2 protocol=udp \
    to-addresses=8.8.8.8
add action=dst-nat chain=dstnat comment=ToDNS208.67.222.222 disabled=no dst-port=53 in-interface=LAN nth=3,3 protocol=udp \
    to-addresses=8.8.4.4

/tool netwatch
add comment="" disabled=no down-script="/ip firewall nat set disabled=yes [/ip firewall nat find comment=ToDNS8.8.4.4]" host=\
    8.8.4.4 interval=15s timeout=150ms up-script=\
    "/ip firewall nat set disabled=no [/ip firewall nat find comment=ToDNS8.8.4.4];"
add comment="" disabled=no down-script="/ip firewall nat set disabled=yes [/ip firewall nat find comment=ToDNS8.8.8.8];" host=\
    8.8.8.8 interval=1m timeout=150ms up-script=\
    "/ip firewall nat set disabled=no [/ip firewall nat find comment=ToDNS8.8.8.8];"
add comment="" disabled=no down-script="/ip firewall nat set disabled=yes [/ip firewall nat find comment=ToDNS208.67.222.222];" \
    host=208.67.222.222 interval=1m timeout=150ms up-script=\
    "/ip firewall nat set disabled=no [/ip firewall nat find comment=ToDNS208.67.222.222];"
Of course this is not very precise because ping test does not test DNS resolution itself. A better resolve command was promised in v5 so will have to wait see.
Thanks again rmichael for responding. Well after looking at the firewall nat, It seems a little intimidating especially with the word disable. Seeing that V5 is now in beta testing mode, it won't be too long before it's released. Meanwhile, I will continue to learn the system and visit the forum. Hopefully, in 3mths V5 might release.
 
Ansy
Frequent Visitor
Frequent Visitor
Posts: 72
Joined: Mon Oct 17, 2011 1:32 pm
Location: Russia
Contact:

Re: DNS Changing to the Fastest

Mon Jan 23, 2012 11:20 am

It sounds very sad for me :( ... I'd like to have tinydns on my RB750 & RB750U-2HnD.

We had to pay twice much for allocation extra servers in IX-datacenter, so we had to hold extra PC box only for our tiny zone DNS server.

Placing DNS server deeper in local network and redirecting requests from MikroTik router is not reliable case because local network is wireless (MAN).

I see the only workaround: get something like DMP eBOX-3300MX, install something like SMS on SD-card and hide it near heavy UPS equipment :?

Who is online

Users browsing this forum: inazmul, mihai9125 and 20 guests