How and why I run my own DNS servers

  • Responding to several comments in this thread RE: what is the point of doing this ...

    The point of running your own email and dns server is so that you are a peer on the network.[1]

    This is important and is becoming lost in the current era of Internet adoption.

    By many measures the Internet is the largest cultural and commercial force in the world today and by an accident of history, the researchers at (D)ARPA gave us a network that allowed normal citizens to be peers on the network.

    Don't lose this.

    [1] As opposed to, for instance, the telephone network. You can own your own domain and perform the first level of network interaction on your Internet systems, but the analogy on the phone network (owning your own phone number and controlling the first touch from other networks) by creating a CLEC is administratively and financially ($100k +) impossible.

  • I used to do this as well, with tinydns. I even wrote an article with a similar name[1]. Then I wrote another article with a similar name[2] when I decided that I was being silly.

    I use Route53 now with a little cron that periodically updates the record that points at my home IP[3]. Route53 is bulletproof in a way that I'm unable to accomplish on my own.

    edit: Route53 is not actually cheaper than this person's setup. That said, $0.50 per hosted zone is a bargain for what you get and there's a volume break to $0.10 after 25 zones. We're talking about global 100% DNS uptime with an SLA[4] for $0.50/mo.

    [1]: https://www.petekeen.net/how-i-run-my-own-dns

    [2]: https://www.petekeen.net/how-and-why-im-not-running-my-own-d...

    [3]: https://github.com/peterkeen/route53_ddns

    [4]: https://aws.amazon.com/route53/sla/

  • Good article on How, pretty bad at describing why

    # It’s Cheap

    There are plenty of cheap & free DNS hosts out there.

    # More Control

    Every DNS host I've ever used has offered full control of DNS records. If all you've ever experienced is poor shared hosting maybe this looks is something new.

    A why not section would be good

    * High latency for people who do not live near one of your servers.

    * Time to set up

    * Cost (lots of cheaper alternatives)

    * Some overhead. Running any server that is public facing has some overhead even if it's just installing patches.

    Interestingly zwischenzugs.com isn't hosted on authors own DNS (maybe a restriction of wordpress.com?)

  • Although the article does cover this, perhaps it doesn't emphasize the point strongly enough:

    The IP addresses for your authoritative servers are going to be stored in the glue record for your zone, which is physically held in the root servers (i.e. not your servers).

    Those glue records can't be changed quickly.

    Therefore you need to be very sure that your servers' IP addresses are really static.

    We run our own DNS (for mostly historical and paranoia about reliability reasons). One of our servers is on a subnet that we own, so that totally under our control. The other is at a provider where I have had a detailed back-and-forth with the support staff about the circumstances under which its IP might change, and how to ensure it won't change, specifically mentioning that we are going to run an authoritative DNS server on their infrastructure (currently IBM/Softlayer, moving to Packet.net soon). I am skeptical that a low-cost provider (DO, etc) can give a strong enough guarantee that the machine's IP address won't change.

    Makes Route53 look very attractive for common/garden purposes.

  • >The YOUREMAIL.YOUREMAILDOMAIN. part must be replaced by your own email. For example, my email address: ian.miell@gmail.com becomes ianmiell.gmail.com.. Note also that the dot between first and last name is dropped. email ignores those anyway!

    Isn't that only the case for gmail (and maybe some others)?

    As an aside I'm surprised someone setting up their own dns-server would still be using gmail. I've found running my own email-server to be very useful and satisfying. (0-configuration throwaway addresses, automatic sorting with sieve, personal and professional mail on the same account, etc. etc.)

  • I've been down this route but ultimately found much more stability running BIND as a hidden master and pushing NOTIFYs to secondary nameservers (I use DNSMadeEasy) whenever the zone is modified. Supports DNSSEC as well.

    I wrote up my setup here: https://www.c0ffee.net/blog/dns-hidden-master

    I host mostly static IPs, but I also use this setup with shared keys and PFSense's RFC2136 feature to push dynamic DNS updates for my home network.

  • Somebody pointed out to me that you can get a free DNS service here:

    https://dns.he.net/

  • Came here because of this advice:

    > setup a strong root password

    You should ideally disable root login over SSH and only allow key-based login. Checkout /etc/ssh/sshd_config for more info on that. I don't think this has been suggested yet.

  • Modern alternatives to BIND that I have had good (though limited) experience with:

    - unbound (recursive resolver) https://www.unbound.net

    - nsd (authoritative server) https://www.nlnetlabs.nl/projects/nsd

  • On the other side: I run my own DNS recursive resolver on my laptop/desktop, and it's one of the things I really miss on the ChromeBook. I've done this for a long time, originally starting with BIND, then switching to powerdns, but lately I've used dnsmasq and it works great. It has a really nice way to set up multiple resolution zones, so I can have my work IPs resolve using the private DNS servers over the VPN.

    The down side is sometimes wireless hotspots will block all traffic until you hit their portal, including DNS resolution, and some captive portals don't work when you can't resolve the name. I've worked around this by letting NetworkManager poke the DNS settings in, and then my VPN will update the resolv.conf once the VPN is up.

    Means I don't end up getting weird DNS responses from clever hotspots or ISPs.

  • Thinking about all the servers I've run over the years, I think DNS is one that was most satisfying in a weird way. Incredibly handy also for making amendments to a bunch of records.

  • I've got a little script that runs on my home router that makes zone updates to CloudFlare over its API. Cost per month: $0, infrastructure to manage: $0.

  • I've done this for my domain parking company too. For my need, it's (probably) a must, since you want to make sure you have a reliable DNS server which you can fully control.

    I've used PowerDNS, which was a breeze for me. It's super efficient too. So I set up my DNS on a very cheap VPS on Vultr ($5/month) and everything has been running well.

    I do wish PowerDNS had a better web interface, but hey it does the job.

  • I know it is not the point of the article, but it is possible to do this with one VPS if the provider offers an API to update DNS records. I have this working with Digital Ocean: https://developers.digitalocean.com/documentation/v2/#update...

  • I've run my own DNS servers since the mid 90's. Anyone doing this should check out the "DNS and BIND" O'Reilly book.

  • Lately, I've been feeling the urge to rent colo space for my own servers. I used to have my own colo space & servers, but like everyone else was "sold" on the benefits of moving to the cloud.

    Now, I have a different perspective and believe more people should be owning their own data and servers.

  • I have a similar problem, but there's just no way I'm running a DNS server in the open (amplification attacks, etc.). I was thinking of using https://icanhazip.com + OVH's API to regularly update my A records.

    However, I still didn't get around to finding (or writing) a CLI for their DNS offering (it is possible, because acme.sh does it [0] -- maybe I'll just use this as a base?)

    [0] https://github.com/Neilpang/acme.sh/tree/master/dnsapi

  • While this is an entertaining read - i.e. all the technical details, it can be made so much less work. If you register a domain or transfer it to a registrar that supports dynamic DNS updates you just run a daemon inside your network and forget about it. I have several domains on Namecheap with a dynamic IP at home and do this [1].

    [1] https://www.namecheap.com/support/knowledgebase/article.aspx...

  • Anybody knows why he uses ssh to update the records and not nsupdate?

  • I use Route53 for two reasons:

    1. $$$

    2. certbot certonly --dns-route53 [...]

  • Does anyone have experience with using dot.tk domains as described in the article?

  • tl,dr:

    1. host them on the cheapest dodgy vps provider you can find 2. host primary and secondary on the same provider 3. use a free throwaway domain registrar 4. use the dns server software with the worst security track record

  • This is not really a great idea. It's just adding more brittleness to your system. Leave DNS to people with distributed DNS networks and redundancy.

    I mean obviously you can do it if you want to, I'm not stopping you, but to me it's silly.

  • How does this compare to pi-hole?

  • This is pretty simple stuff, and the two ads for your book make this look like an ad rather than something not otherwise posted on tens of other blogs.