I’ve been setting up a Mikrotik router for my (very) small office, and it’s gone well so far, even though I’m an absolute noob when it comes to networking. But I can’t seem to figure out how to get the router to act as a DNS server to resolve local host names. I have a few different servers that should be accessible by host name (for instance truenas.local), but I can only reach them by IP. I’ve ticked the “Allow Remote Requests” box and made sure that my clients use the router’s IP for DNS, but no luck so far. What am I missing?
I’ve tried to search around for answers, but haven’t found anything. I have however found that apparently using .local domains is discouraged and it’s better to use a subdomain like .internal.company.com. How do I go about setting that up? I suppose I need to change my DNS records (Which one? CNAME? To where?) but what do I do on the Mikrotik side?
As a bonus I’d also like this to work for L2TP IPsec road warriors and across site to site OVPN tunnels, but let’s do the basics first …
There are a few components to this. Firstly to enable the Mikrotik router to act as a DNS server you need to enable remote requests, and specify forwarders that it will use for addresses that are not resolved locally. I use Open DNS servers.
/ip dns
set allow-remote-requests=yes servers=208.67.222.222,208.67.220.220
To deal with resolving local machines, first decide on your chosen domain for internal addresses, for example “home.lan”. Now you can add static DNS host entries for devices with fixed IP addresses for example ..
Finally if you want to be smart you can add a script to the DHCP server so that it creates DNS entries for any addresses it issues. I cribbed one from somewhere, I haven’t taken the trouble to run though it and understand it but I know it works.
It’s half-true. The .local TLD is used by mDNS, and if all devices support it, it’s good idea to use it, because then the router as DNS server doesn’t need to be involved at all. But as manually configured it’s not good, because it conflicts with mDNS. Problem is that as the name suggests, it’s local, in fact very local. And to overcome that, router would have to be involved, but RouterOS currently doesn’t help with that. Related topic: mDNS repeater feature
Cheers! It works now using static DNS entries, so that’s something. It also works on L2TP road warrior clients, but I haven’t tested on site-to-site VPNs yet. But why do I need to add a static entry for the TrueNAS server even though TrueNAS’ UI allows for entering its hostname/domain there?
And in the list of DHCP leases, there are quite a few clients listed with host names – but I can’t access them by those host names – unless I add a static entry obviously.
This isn’t really important, I can assign static IPs to everything that I want to access by host name anyway, I just didn’t realise it was necessary to do it this way (but I don’t mind!)
What you enter on NAS is only for NAS itself, so that it knows its identity. Same for clients, they do have hostnames and they send them to DHCP server, but there’s no standard saying that DHCP server should add them to DNS (you can do it with DHCP lease script, look around the forum for some). Some clients can do DNS updates themselves, but you need DNS server that supports it. The one in RouterOS doesn’t.