Kitz Forum

Computers & Hardware => Networking => Topic started by: johnson on June 12, 2018, 03:07:50 PM

Title: Local DNS servers for home networks
Post by: johnson on June 12, 2018, 03:07:50 PM
Have been toying with the idea of a local DNS server for probably all the wrong reasons. Are they only useful if you want name resolution to local IPs, or is there some caching voodoo that can be achieved that normal systems don't do as well?

I'm openly ignorant on the issue, but do hosts on a network efficiently store DNS data to minimise lookups? Have had my ISPs DNS servers go down a couple of times in the past year, and its instantly apparent, doesnt feel like any local tables are stored at all.. but maybe thats the nature of DNS, with old records being considered out of date very quickly.

Have (VMs) on all the time that could easily perform the task, but wonder if I would be wasting my time even thinking about it. Any input welcomed!
Title: Re: Local DNS servers for home networks
Post by: Weaver on June 12, 2018, 03:49:58 PM
It is a good idea as machines can register themselves and get lan-local domain names for ease of admin, one of the other benefits of having a server that you control. Some routers are caching DNS servers, as are all modern operating systems. ago answer one of your questions, a modern o/s will cache the results of DNS lookups and this will prevent repeated lookups if the same thing and also make the cached results available to all other processes running in that machine. Besides this, having the o/s consult a second level ‘relay’ cache server in the router say or in a server on your LAN gives you the benefit of sharing the greater body of cached lookupresults that other boxes have requested earlier so that all machines on the LAN benefit.

My Firebrick router is one such caching DNS server, does not take dynamic self-registrations from boxes on the LAN though who want to register their own IPs and name themselves. I can make it add DNS names from static config file info and I indeed do so. I can set up a load of DNS records myself relating to domain names that my wife and I own in the control panel section for my ISPs DNS servers for customers’ domains, because my ISP does DNS hosting as well.

Like you, I would like to set up a local DNS server that can do dynamic registrations from clients on the LAN though, just to see how it goes, but I have broken my Raspberry Pi with a bad command that I entered and now it won't boot. And I can't physically do what is necessary to mend it without some help.

If it feels like things are not getting cached it could be the fault of the (remote) domain name admins setting the lifetime of DNS records to be way too short for stupid reasons. Occasionally lifetimes do have to be short, for various reasons, one being load-spreading using rotating DNS that keeps changing so clients keep getting directed by a shifting DNS to a different one of many servers where this makes sense and thus spreading the load. I have seen stupid 5 minute lifetime values where 40 hours might be better or even a month for some things.

Maybe some DNS server software can override returned lifetimes by imposing minimum override values and thus preventing domain admins’ stupidity, although this could be detrimental in the load-spreading rotating scenario, and perhaps a selective option would be useful. A bit naughty, going against various standards documents, but possibly for a good cause provided it is carefully thought about and the override values are moderate so that chaos does not ensue when domain owner admins need to reconfigure a network, move boxes around, renumber or rename things.

Some DNS software is a lot better than others, and there have been a few security scares so a sufficient level of security-related clue in quality server code matters.
Title: Re: Local DNS servers for home networks
Post by: jelv on June 12, 2018, 04:46:09 PM
If you only have a few devices why not give them fixed IPs and put them all in to the hosts file on each?
Title: Re: Local DNS servers for home networks
Post by: Weaver on June 12, 2018, 05:12:52 PM
Are you asking Johnson, Jelv ?

(In my case all the devices don't have a hosts file, they are iOS, Blackberry QNX o/s, a printer all sorts of things.)
Title: Re: Local DNS servers for home networks
Post by: j0hn on June 12, 2018, 05:37:49 PM
I'd be very surprised if the Firebrick didn't have an option to add hostnames for local devices on your LAN that have been assigned static IP's.

No need to do it on each separate device.
Seems overkill to run a local DNS server to resolve hostnames of local devices.
Title: Re: Local DNS servers for home networks
Post by: johnson on June 12, 2018, 05:49:50 PM
Thats most of my point, are there any benefits (mostly caching based I guess) to running a local DNS other than giving names to local IPs.
Title: Re: Local DNS servers for home networks
Post by: Weaver on June 12, 2018, 06:40:50 PM
@j0hn the Firebrick certainly can be set up to assign DNS names to static IPs, and that can be used for IPv4 on my LAN since every box on my LAN has a fixed, global route or public IPv4 address. But IPv6-speaking devices are another matter altogether. By design lots of operating systems allocate themselves IPv6 addresses that are either MAC-based, if you are lucky, or pseudo-random by design and they can also have a lifetime and can change, for privacy reasons. So if you want to associate IPv6 changing addresses with DNS then the machines in question have to register with a local DNS server or else there is simply no way to keep track of them in fact that is what the operating systems often want to achieve, anti-tracking.

@johnson No, I suspect that there are probably no other real benefits if your router already does relay DNS caching for you and clients are using the router as their DNS rather than going straight outside to the ISP. I am agreeing with you. But if your router doesn’t have this DNS functionality then a local DNS server on the LAN is a good performance booster.