I have a small utility (made up of two shell scripts and a python script) which watches /var/db/dhcpd.leases for changes and parses it to produce the zonefiles for nsd.
The DNS server will contact the Root servers for the TLD namesevers of a domain, the TLD nameservers and then the actual authoritative nameserver for the particular domain.
No forwarder needed.
This means you bypass any DNS based filtering any DNS ‘forwarder’ may have in place.
Dynamic routing is fun :)
I also have an OpenBSD box similar to what you describe, but I run ISC dhcpd and BIND because it’s the only setup that does old-school dynamic DNS where the dhcp server sends zone updates to BIND when a lease happens.
But I hate BIND, and not to mention this setup doesn’t work with DHCPv6 (no idea why, it should in principal…) maybe I should just do the “script to read the leases and generate the zone file” approach instead.
Serial numbers were a bane 3 decades ago. When Daniel J. Bernstein invented djbdns, xe made the software (tinydns-data) auto-generate the serial numbers from the last modification timestamp of the source file, and made several observations on the subject of serial numbers that are well known, or at least easy to work out for onesself with a modicum of thought.
This article warns the reader thrice, in all-capitals, about remembering to manually increment serial numbers. That's still after all these years reasonable advice for BIND users and a still habit to form if one uses BIND. The numbering scheme used here will only allow 100 changes per day, of course.
But nothing in the article, nor the planned parts 2 and 3 described in the ensuing FediVerse discussion, actually needs zone serial numbers to be incremented at all, as there's no replication of any kind, let alone "zone transfer", here and parts 2 and 3 (if they end up as stated, they not having been published yet) will not encompass replication either. It's heavily stressed because it has been a common pitfall for BIND users for decades; but ironically the article series does not actually need it.
It's a shame, really, because the things that should be emphasized as much if not more here, are reduced in comparison. internal. still not being an IANA special-use domain name is one. (See RFC 8375 for home.arpa., which is a special-use domain name.) The way that this setup will leak 192.168.0.0/16 reverse lookups outwith 192.168.1.0/24 to the world at large, and 172.16.0.0/12 lookups outwith 172.16.0.0/16, is another. (named.rfc1912.zones does not cover any of the requisite domain apices, RFC 1912 not being RFC 1918, and is in any case a RedHatism that one cannot rely upon on even, say, Debian, let alone on a non-Linux-based operating system.) The pitfalls of using a superdomain that one does not own, e.g. homelab.jhw. here, is a third that is glossed over. (Anyone who has tried to set up an organization's domain naming will know of the pitfalls that this entails; this is as much of a bad habit to avoid gaining in the first place as updating BIND's serial numbers is a habit to learn.)
Furthermore, making "everything at home just work, even with no internet connection" involves something further, missing from this and from the described forthcoming parts 2 and 3: a private root content DNS server. There's a surprising amount of stuff that relies on at minimum getting negative answers from the . content DNS servers for top-level domains that do not exist, and various blackholed domains.
Real men cry into their text editors with BIND and PowerDNS but you do get the whole toy box with these beasties. I've whizzed up many BIND daemons. I once ran a pair of PDNS servers with a MySQL replicated back end.
I currently have an internet exposed and rather locked down PDNS for ACME DNS-01 (Lets Encrypt). The CA consortium are insisting on SSL certs going down to 40 odd day lifetimes within about three years. I look after quite a few SSL certs for my customers. Anyway.
For home labbers, you might consider a Pi Hole (doesn't have to run on a Pi - a VM will do) or, a bit more hard core: https://technitium.com/dns/ (web GUI - yay!) pfSense has Unbound built in and I think OPNSense does too - both are fine choices of router. OpenWRT probably has unbound in it.
When I say, you can't go too far wrong with unbound, I mean it. If it works then it is almost certainly configured correctly.
My DNS server of choice remains PowerDNS. I also find the API easier to use with certbot and the available web UIs.
It's hard to go much deeper than that in practice as the zonefiles for TLDs are massively larger, massively more dynamic (i.e. syncing once a day isn't usually enough), and much harder to get ahold of (if it all, sometimes).
Regardless of how you go about not using a forwarder, if that's the path you choose then I also heavily recommend considering setting up some additional things like cached entry prefetching so recently used expiring entries don't get "hitches" in latency.
Enjoy
The sheer luxury of two B channels at 64kBps each and if you were cunning, the D channel at 16k (I wasn't cunning and didn't bother)! Yay, double phone charges if you raised the second channel. That was a BRI. A PRI was lots of channels (30) and an even more eye watering bill.
A customer dumped their BRI that was acting as a backup to SIP n that about six months ago. That's the last one I know of.
options {
allow-recursion { localhost; localnets; };
forwarders { 1.1.1.1; 8.8.8.8; 4.2.2.2 };
forward only;
};
And it would have done the same job the person was looking for. This binds to all interfaces, avoids explicitly respecifying the default paths as a lot of the config lines on the site do, logs what most people care to log to syslog, and forwards requests from any private subnet or the local machine. Alternatively, the distro probably comes with a default file with any distro specific customization you may wish to align to and just needs these 3 lines added.For the next 8% where people operate "real" dns servers I agree the zone definition syntax is a bit verbose (especially if you're doing many domains or reverse lookup zones) but not necessarily that complicated. The last 2% probably care about all of the syntax that starts to look like mumbo-jumbo which bind documentation focuses on. Oh, I will complain about bind expecting you to manually increment serial numbers in your zonefiles though... but most deployments like this (or even ones acting as the nameserver for some domains) don't actually need that anyways.
No complaints about choosing PowerDNS though. Hard to go wrong with it for this either.
* https://news.ycombinator.com/item?id=44318136
There are actually several additional subdomains of arpa. that one can also replicate, not on that list, which are largely invariant.
And really it's not about technical correctness. It has been known how to set up private roots since the 20th century. Some of us have had them for almost that long. Even the IETF has glacially slowly now come around to the view that idea is a good one, with there now being an RFC on the subject.
The underlying problem for most of that time has been that they're difficult to do with BIND, at least a lot more difficult to do than with other content DNS server softwares, if one clings, as exhibited even here in the headlined article, to a single server vainly wearing all of the hats at once.
All of the people commenting here that they use unbound and nsd, or dnscache and tinydns, or PowerDNS and the PowerDNS Recursor, have already overcome the main BIND Think obstacle that makes things difficult.
Why not .lan? The key word is official?
It's technically incorrect in that IANA would like you to have your DNS server use the DNS protocol's built in system of record querying and expiry rather than pull a static file at your own interval (IIRC I don't think root servers support AXFR for performance reasons?) as there is no predefined fixed schedule for root zone updates. Practically, root zone update changes are absolutely glacial and minuscule (the "real" root servers only get 1-2 updates per day anyways) so pulling the file once per day is effectively good enough to never care it's not as DNS would intend you to get the record updates.
Setting this up in bind should be no more difficult than adding a `zone "."` entry pointing to this file, the named.conf need not be more than ~a dozen lines long. It's easy to make bind config complicated though (much like this article), but I'm not sure that was the barrier vs just being comfortable enough about DNS to be aware the endeavour is even something one could seek to do - let alone set out to.
Its easy to feed an RBL to unbound to do pi-hole type work, I use pf to transparently redirect all external DNS requests to my local unbound server but I get the bind automation around things like DNSSEC, DHCP ddns and ACME cert renewals.
I'm surprised this isn't a more common stack.
Doesn’t stop you from using your own private CA, either, but at least you have the option.
* https://jdebp.uk/FGA/dns-use-domain-names-that-you-own.html
* https://news.ycombinator.com/item?id=45144631
You can find the case of dev. in particular discussed in umpteen places here on Hacker News over the years.
https://arstechnica.com/information-technology/2024/02/doing...
I never took the plunge - dnsmasq, adguardhome, and let's encrypt for me..
The author has a randomized username but is actively posting today. If you see this, 1vuio0pswjnm7, thanks for the tip!
To me a huge benefit of unbound is that it allows to return whatever you want for wildcards.
Including TLD wildcards.
Seychelles DNS has been hijacked as a whole and only serves malware? Null route the entire .sc.
.ru ? Nah, that won't resolve at my place.
etc.
Then unbound is at ease, even on an old Raspberry Pi, with blocklists made of hundreds of thousands of lines.
I always thought of dnsmasq as a bit of a toy, but I have to admit I've been impressed. So far it's worked flawlessly, and I'm especially impressed that you can reconfigure it without restarting the process.
My only complaint is not specific to dnsmasq, and that's with ipv6. Devices assign themselves essentially random addresses, so it's impossible to correlate DNS lookups from those addresses with what actual device is making the request. The obvious solution to this, a fully managed DHCP6 setup, does not seem to be well supported by dnsmasq, but it wouldn't matter even if it was because so many devices don't support DHCP6, only slaac. So the whole thing is a bit of a mess.
Cloudflare (and probably others) let you enter non-routable IPs into their DNS, so myhomeserver.mydomain.com can point to 192.168.1.45 on your LAN without having to run your own DNS/hosts.
Technitium is a full fledged authoritative recursive DNS resolver with adblock, whereas pihole is more focused solely on the adblock experience. Technitium supports full zone management, DNSSEC, and all DNS record types. Pihole is limited to a handful of types and can't do custom zones and the management is somewhat clunky IMO. Technitium has full DNS logging, statistics, conditional forwarding, and a full rest API for management.
I think Pihole is a great project, but Technitium caters better to power users and people that want/need more complex control over their internal DNS infrastructure (while still remaining relatively simple from a management perspective).
Simply put, Pihole is adblock with some DNS sprinkled in, Technitium is a DNS server first with adblock support. I don't think you can go wrong either way, but if you're going to need more advanced DNS capabilities at home, roll Technitium to save yourself a migration down the line.
Looking online, seems some people run both, not sure if that’s worth it though.
Relevant reading: https://issuetracker.google.com/issues/36949085
Android Public Tracker - Support for DHCPv6 (RFC 3315) - Status: wontfix
Probably.
For interactive use you'd typically only use part of the domain anyway, with correctly set up search list. Also has the advantage of easily making some hosts available via IPv6 to the outside - or with split horizon DNS and a gateway host expose specific services, where inside connection directly goes to the specific host, and outside via a reverse proxy.
Overall he's just describing a typical simple internal DNS setup - from the title was expecting him to talk about how he got a stable authoritative DNS server for his public domain running at home (and how he got around the "two nameservers" requirement).
On the plus side, that made me realize that my current home connection _is_ stable enough to host one of my three authoritative DNS servers, which should save me about 7 EUR per month.
- Draft: DELEG (a new way of doing delegations, replacing the NS/DS records).
- A draft to follow: Using the extensible mechanisms of DELEG to allow you to specify alternative transports for those nameservers (eg: DoH/DoT/DoQ).
This would allow a recursive server to make encrypted connections to everything it talks to (that has those DELEG records and supports encrypted transports) as part of resolution.
Of course, traffic analysis still exists. If you are talking to the nameservers of bigtittygothgirls.com, and the only domains served by those name servers are bigtittygothgirls ...
I'm using dnsmasq for DHCPv6 and it seems to work fairly well for me. "dig <device-name> AAAA" returns the correct addresses for my DHCPv6-supporting devices.
> but it wouldn't matter even if it was because so many devices don't support DHCP6, only slaac.
This should theoretically work with "--dhcp-range=slaac,ra-names" [0], but it doesn't seem to actually do anything for me.
[0]: https://thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html#:~:t...
The trouble starts when you want to provide ALL domains I guess. I wonder what database would be best for that; just MySQL with int to name table?
The trouble with DNS is that you need a fixed external IP that has port 53 open.
Not easy to get at home cheaply.
That said! I haven't used AdGuard Home in a very long time, might be time for me to revisit.
Likewise. I remember setting it up first in the mid 2010s when pis went mainstream. Although I've also used AdGuard home, but I keep a pi-hole running for 'high availability.'
The exception to this is .local, which you shouldn’t use for internal systems because it will confuse the heck out of them in weird ways, because .local is by RFC not meant to be used in that way.
If you're talking about "censorship of unencrypted DNS traffic in general": The censorship (or security/privacy risk or whatever your reason for caring it's unencrypted) doesn't care if you're sending traffic to a root nameserver for recursive resolution or traffic to a forwarder. What you need is something like encrypted DNS over another commonly encrypted channel that won't be blocked (e.g. DoH), which actually fits better with using a forwarder since most servers you'll recurse to don't support such transports.
Recursive resolution of public domains is really not as useful as it may sound for most people. The folks it perhaps helps the most are those interested in having the fewest external dependencies in their infrastructure. I have another comment about how to maximize that goal more than just resursing to the public root servers.
The easiest solution I've found is to not play the game. I.e. just use HTTP for your homelab, and if the service doesn't let you use anything but HTTPS then bind it to 127.0.0.1 and set up Caddy to reverse proxy and ignore the cert in a few lines. If you want to expose things externally and do happen to own a domain then set up a single external *.yourdomain.tld record which points to your public IP, bind an instance of Caddy to it, and reverse proxy to the internal HTTP only services. The internal service DNS entries can still use .internal so you won't have to deal with split-horizon DNS either.
> EVERY HOSTNAME RECORD ENDS WITH A . YOU WILL FORGET THIS. YOU WILL FIX THIS.
> WITH A DOT AT THE END. DO NOT FORGET THE DOT!
> WITH THE DOT AT THE END. AND DID YOU UPDATE THE SERIAL? :)
I just love these comments. You made my day! :D
And if using Technitium as encouraged/promoted/facilitated,^1 now "DNS provider like Google DNS or Cloudflare DNS [or IBM Quad9 DNS]... _can_ see and control what website you can visit even when the website employ[s] HTTPS security" and "_can_ redirect, block or inject content into websites you visit"
If the ISP seeing "what website you can visit" is the issue, then Technitium is not going to help. A DNS lookup does not necessarily mean a "visit" but even assuming it does, then the ISP can already see the "visit" (the actual TCP connection not the DNS lookup) via the SNI extension in the TLS ClientHello
If the issue is ISP "control [over] what website you can visit", then Technitium _might_ help
But if the issue is _any_ third party "control [over] what website you can visit", then all that has been done with Technitium is to substitute a "DNS provider" other than the ISP as the third party
Technitium uses the word "can" to describe the issue: "your ISP can see and control..." and "some ISPs can redirect, block or inject..."
Maybe this is purely coincidental, who knows
The fact is some ISPs _have_ redirected, blocked or injected content by utilising their control over DNS
It has happened and, certainly with redirection at least, it is ongoing. Why use the word "can". ISPs do it
As far as we know neither Google nor Cloudflare has done it
It may or may not have happened. But either way, they _can_ do it
There is nothing that stops third parties from doing it in the future, whether it's an ISP or an advertising services and surveillance company or a TLS MiTM CDN
Excerpt from RFC 1035:
"Name servers manage two kinds of data. The first kind of data held in sets called zones; each zone is the complete database for a particular "pruned" subtree of the domain space. This data is called authoritative. A name server periodically checks to make sure that its zones are up to date, and if not, obtains a new copy of updated zones from master files stored locally or in another name server. The second kind of data is cached data which was acquired by a local resolver. This data may be incomplete, but improves the performance of the retrieval process when non-local data is repeatedly accessed. Cached data is eventually discarded by a timeout mechanism."
The "DNS provider" is not a source for authoritative data
Many self-proclaimed "technical" people use it this way; hopefully they understand exactly what they are doing
For example, according to RFC 1035 the operator of the nameserver for example.com controls the DNS data for example.com, not the ISP, not Google, not Cloudflare or any other third party "DNS provider"
The internet user can run his own authoritative nameserver and/or a cache^2 and decide what the DNS data for example.com should be served when his computers ask for it; he could thereby eliminate the need for third parties
He could obtain that DNS data from the nameserver(s) for example.com
He could also obtain it from an "upstream" third party cache, such as an ISP, Google, or Cloudflare; i.e., he could rely on a third party
But according to RFC 1035 only the nameserver for example.com is the authoritative source^3
1. "Self-host" is not the default
DnsServer-master/Apps/AdvancedForwardingApp/dnsApp.config
2. These do not have to be the same program, as is the case with Pi-Hole (dnsmasq) and Technitium
3. As it happens, many website operators use third parties for authoritative DNS service
Thanks, didn't even know it existed.
> I didn't see a specific RFC that reserved .lan
There is no RFC AFAIK, but it has certainly seen some adoption over the past decade. Mikrotik devices use `router.lan` as a default domain name for their routers, for instance. Home labbers on YouTube seem to like to use `.lan`, too.
Would it be fair to think there is a chance `.lan` might get an RFC of its' own given the popularity? Or that's completely irrelevant in case with RFCs? Hard to tell what's the reasoning there - `.home.arpa` seems excessivly long and inconvenient.
Would be a real shame and a bummer if `.lan` ends up becoming public :')
In my interaction with IETF standards they are created / implemented in two ways:
1. They set the forward direction for a new technology before it is wide spread.
2. They wait for a technology to become popular / accepted and start to set standards from that baseline.
Both are reasonable paths of implementation given how the pace of changes in technology.I doubt .lan, .local, .home, etc will either become public or a standard just based on existing devices that default to these domains and documentation or books that might reference them as example domains.
I really must get around to looking into opnsense again. I look after 50 odd pfSense boxes (about half on Netgate gear) across the UK but I am a believer in choice and I remember when opensense sort of split from pfSense. Its great to see the project thriving.
When you deploy a well respected alternative to your ISP provided equipment and get it to work, you generally get it right. They (pfSense, opnsense, openwrt and all the rest) will not do an insecure config out of the box. You do have to try quite hard to get it wrong!
Adguard, pfBlocker, pi-hole and co. all largely do a similar job and that is keeping your devices away from the seamier parts of the internet and the seamier sides of the internet away from your network. They are not perfect but are really good at it.
Think steel bound three inch thick front door, with really good hinges and a lock that would give a professional a hard time, rather than PVC or wooden panel with a mortice lock. Do keep an eye on the windows though ... 8)
Keep it and everything else reasonably up to date and you are probably golden.
We were sadly not past expressions like that in say the 70s or 80s but by the 90s, that phrase was definitely considered ironic (in the modern sense). Back then irony was merely one metallic mouth feel, along with steely, coppery and brassic.