Community discussions

MikroTik App
 
sam1275
Member Candidate
Member Candidate
Topic Author
Posts: 110
Joined: Thu May 21, 2015 2:46 pm

(Solved thanks) Mikrotik's DNS not working with DNScrypt

Wed Dec 28, 2016 4:01 am

Hello people.

Days ago I setup a DNScrypt server in my network:

http://forum.mikrotik.com/viewtopic.php?f=2&t=115965

It works, but the router's built-in DNS service refuse to work with it, please see pictures:

Image

Image

Image

As you can see, the router neither response the DNS requests from clients, nor cache any, but it can resolve a host name itself... I don't know why.

If anyone can help me, it would be great.

Thank you all.
Last edited by sam1275 on Mon Jan 02, 2017 3:27 am, edited 1 time in total.
 
Sob
Forum Guru
Forum Guru
Posts: 9121
Joined: Mon Apr 20, 2009 9:11 pm

Re: (New problem) Mikrotik's DNS not working with DNScrypt

Wed Dec 28, 2016 4:50 am

If it's the same router that does dstnat for those fake addresses, then it can't work with them, because output packets from router won't go to dstnat chain. I'm wondering where it got address for "mikrotik.com" from...
 
sam1275
Member Candidate
Member Candidate
Topic Author
Posts: 110
Joined: Thu May 21, 2015 2:46 pm

Re: (New problem) Mikrotik's DNS not working with DNScrypt

Wed Dec 28, 2016 6:10 am

If it's the same router that does dstnat for those fake addresses, then it can't work with them, because output packets from router won't go to dstnat chain. I'm wondering where it got address for "mikrotik.com" from...
Thank you, so there's no workaround available?
Yes, itself can resolve any host, just refuse to provide to clients.
Another strange thing is in the last picture, it says cache used 17, but only list 2...
 
teamer
just joined
Posts: 21
Joined: Mon Sep 12, 2016 9:18 am

Re: (New problem) Mikrotik's DNS not working with DNScrypt

Wed Dec 28, 2016 9:44 am

Try to use src-nat with dst-nat to guarantee DNS answer passed through the router and then de-nated rightly.
 
User avatar
janisk
MikroTik Support
MikroTik Support
Posts: 6263
Joined: Tue Feb 14, 2006 9:46 am
Location: Riga, Latvia

Re: (New problem) Mikrotik's DNS not working with DNScrypt

Wed Dec 28, 2016 3:48 pm

DNS cache will hapily cache DNS cahce replies, but you have to allow larger packets (I think that default was already changed to 4096 packet size) That usually fixes dnsec issues.
 
sam1275
Member Candidate
Member Candidate
Topic Author
Posts: 110
Joined: Thu May 21, 2015 2:46 pm

Re: (New problem) Mikrotik's DNS not working with DNScrypt

Wed Dec 28, 2016 8:17 pm

If it's the same router that does dstnat for those fake addresses, then it can't work with them, because output packets from router won't go to dstnat chain. I'm wondering where it got address for "mikrotik.com" from...
I just tried "check update" in packages and it says "cannot resolve host", so it can resolve host in ping tool somehow...
 
sam1275
Member Candidate
Member Candidate
Topic Author
Posts: 110
Joined: Thu May 21, 2015 2:46 pm

Re: (New problem) Mikrotik's DNS not working with DNScrypt

Wed Dec 28, 2016 8:18 pm

DNS cache will hapily cache DNS cahce replies, but you have to allow larger packets (I think that default was already changed to 4096 packet size) That usually fixes dnsec issues.
Thanks, but it still not work when it is 4096.
 
sam1275
Member Candidate
Member Candidate
Topic Author
Posts: 110
Joined: Thu May 21, 2015 2:46 pm

Re: (New problem) Mikrotik's DNS not working with DNScrypt

Wed Dec 28, 2016 8:19 pm

Try to use src-nat with dst-nat to guarantee DNS answer passed through the router and then de-nated rightly.
Could you give me a sample script please? Thank you.
 
Sob
Forum Guru
Forum Guru
Posts: 9121
Joined: Mon Apr 20, 2009 9:11 pm

Re: (New problem) Mikrotik's DNS not working with DNScrypt

Thu Dec 29, 2016 5:06 am

Yes, itself can resolve any host, ...
But how? Your previous thread was about making fake addresses and redirecting DNS traffic going to them to another host and non-standard ports. It can work fine when other devices try to access those fake addresses. But when you give same fake DNS resolvers to same router, it can't reach them. Unless some of those addresses was actually reachable somewhere and run DNS resolver. But then the router's DNS cache would work too.
 
sam1275
Member Candidate
Member Candidate
Topic Author
Posts: 110
Joined: Thu May 21, 2015 2:46 pm

Re: (New problem) Mikrotik's DNS not working with DNScrypt

Thu Dec 29, 2016 6:18 pm

Yes, itself can resolve any host, ...
But how? Your previous thread was about making fake addresses and redirecting DNS traffic going to them to another host and non-standard ports. It can work fine when other devices try to access those fake addresses. But when you give same fake DNS resolvers to same router, it can't reach them. Unless some of those addresses was actually reachable somewhere and run DNS resolver. But then the router's DNS cache would work too.
I don't know why, but the ping tool really can resolve any DNS, I tried a lot.
However some function don't work, as picture shown:
Image
 
Sob
Forum Guru
Forum Guru
Posts: 9121
Joined: Mon Apr 20, 2009 9:11 pm

Re: (New problem) Mikrotik's DNS not working with DNScrypt

Fri Dec 30, 2016 6:00 am

If ping can resolve hostnames, it must get the answer from somewhere. Try to add some logging rules:
/ip firewall mangle
add action=log chain=input protocol=udp src-port=53
add action=log chain=input protocol=tcp src-port=53
Then ping different hostnames and see what happens.
 
cdemers
Member Candidate
Member Candidate
Posts: 224
Joined: Sun Feb 26, 2006 3:32 pm
Location: Canada
Contact:

Re: (New problem) Mikrotik's DNS not working with DNScrypt

Fri Dec 30, 2016 3:08 pm

Try using ping from terminal and not winbox. Winbox could be resolving name for ping.

Sent from my Nexus 5 using Tapatalk
 
Sob
Forum Guru
Forum Guru
Posts: 9121
Joined: Mon Apr 20, 2009 9:11 pm

Re: (New problem) Mikrotik's DNS not working with DNScrypt

Fri Dec 30, 2016 7:15 pm

You're right, that's it. Quick test with packet sniffer shows that DNS queries for hostnames entered in WinBox come from PC, not from router.
 
sam1275
Member Candidate
Member Candidate
Topic Author
Posts: 110
Joined: Thu May 21, 2015 2:46 pm

Re: (New problem) Mikrotik's DNS not working with DNScrypt

Sun Jan 01, 2017 9:15 pm

I tried ping from ssh, yes you guys are right, it not work now...
Image
 
sam1275
Member Candidate
Member Candidate
Topic Author
Posts: 110
Joined: Thu May 21, 2015 2:46 pm

Re: (New problem) Mikrotik's DNS not working with DNScrypt

Sun Jan 01, 2017 9:18 pm

Could anyone explain this picture in my previous post?
Image
It shows 17 caches in use but only 2 in the list, I just checked and it's still like that right now... Why?
 
cdemers
Member Candidate
Member Candidate
Posts: 224
Joined: Sun Feb 26, 2006 3:32 pm
Location: Canada
Contact:

Re: (New problem) Mikrotik's DNS not working with DNScrypt

Sun Jan 01, 2017 9:46 pm

Can you ping the dns servers?

Sent from my Nexus 5 using Tapatalk
 
sam1275
Member Candidate
Member Candidate
Topic Author
Posts: 110
Joined: Thu May 21, 2015 2:46 pm

Re: (New problem) Mikrotik's DNS not working with DNScrypt

Sun Jan 01, 2017 10:40 pm

Can you ping the dns servers?

Sent from my Nexus 5 using Tapatalk
Of course not, they are fake addresses.
However if you mean the real address 192.168.88.5, yes I can.
 
Sob
Forum Guru
Forum Guru
Posts: 9121
Joined: Mon Apr 20, 2009 9:11 pm

Re: (New problem) Mikrotik's DNS not working with DNScrypt

Sun Jan 01, 2017 10:41 pm

It shows 17 caches in use but only 2 in the list, ...
It's not the number of records:
cache-used (read-only: integer) displays the current cache size in KiB
Can you ping the dns servers?
He can't, because they don't exist. :) It only makes sense when you read the other thread linked in first port and understand what he did.

And I don't think there's currently a way to make this kind of setup work from router itself.
 
sam1275
Member Candidate
Member Candidate
Topic Author
Posts: 110
Joined: Thu May 21, 2015 2:46 pm

Re: (New problem) Mikrotik's DNS not working with DNScrypt

Sun Jan 01, 2017 11:21 pm

Thank you so much Sob.
It confused the hell out of me when I see 17 while only 2 listing....
I think I may not use this NAT method and just assign several IPs to the DNS server, that will solve the problem.
 
sam1275
Member Candidate
Member Candidate
Topic Author
Posts: 110
Joined: Thu May 21, 2015 2:46 pm

Re: (Solved thanks) Mikrotik's DNS not working with DNScrypt

Mon Jan 02, 2017 3:29 am

After assign multiple IP to my server and not using the NAT method anymore, it's fully working now. The router also can resolve DNS.

Who is online

Users browsing this forum: armandfumal, mstanciu, Paltri34, yonutm and 121 guests