How do I set up my own DNS on my LAN, with delegation of public domains?
I want to have a local DNS server on my home LAN, say at
192.168.1.123. All of my machines will use
192.168.1.123 as their only DNS server when connected to my home network.
By default, my DNS server will process requests by checking them with a public DNS service on the internet. I am planning to also add caching to this (eg. dnsmasq) and use a secure DNS query method (eg. dnscrypt). These will only be set up on one machine (the DNS server) so by pointing all other clients (laptops, phones) to the server I will avoid having to configure dnsmasq and dnscrypt on each one.
My DNS server will also have its own configuration file with some arbitrary domain-IP mappings (or perhaps I can just use
/etc/hosts on that machine). When processing a DNS query, the server will first check that file and if it finds a match, return that. If not, it will then try the public DNS servers on the internet. I am planning to use this to assign user-friendly domains to various machines in my LAN, such as printers, so that I don't have to type in their IP address every time. I can also use this to assign non-functional IPs to real domains that I don't want to resolve (like ad servers).
I have access to a regular Linux server on the network which is always on. I would prefer to set up the DNS service on this server, because it's easier to maintain.
I also have an open source firmware running on my router (OpenWRT). I'd prefer not to set up DNS there because the hardware and software is more limited than the server, but it's an option.
What is a practical way to set up a local DNS service like I describe?