Everyone wants to improve their internet speed, whether by boosting their Wi-Fi performance or switching to fiber-to-the-home. Those are good ideas for straight-line download speeds, but to make your browsing feel snappier for every website you visit, there's only one (almost) guaranteed fix. That's to self-host your own DNS server. Your devices sending DNS lookups to something on your home network are an order of magnitude faster than sending those same requests to an external DNS server and waiting for the reply.

DNS servers sit between your browser and the millions of servers and websites on the internet, translating human-readable URLs like xda-developers.com into the IP addresses that the browser needs to query for data. It's how the internet has worked for decades; it works well, but it has a few issues. Sending requests out to a remote server takes time, and the DNS server provider can use various methods to steer you to sites it wants or block sites it doesn't want you seeing. Plus, normal DNS requests are sent out in plaintext and can be intercepted.

But hosting your own DNS server to cache the DNS entries of sites you visit often speeds up the process, and it also keeps your browsing private. It's also fantastic if you have a home lab filled with self-hosted services, because you can use custom DNS entries to give the IP addresses of those services a nicer URL to use instead. I'm using a Synology NAS to host mine, simply because that's what I have, but you could use a Raspberry Pi, or run Unbound on any device on your network.

What you'll need

Self-hosting a DNS server is easier than you might think

Self-hosting a DNS server is a fairly lightweight task, so almost any network-attached device you have will work. We've had good success with using Raspberry Pi SBCs, and it should be possible on your brand of NAS device, whether through a container or a native function. We're using a Synology NAS because that's what we had to hand, but any LAN-port enabled NAS will work.

  • Synology DiskStation DS923+
    CPU
    AMD Ryzen R1600
    Memory
    4 GB DDR4
    Drive Bays
    4
    Expansion
    2x M.2 PCIe NVMe, 1x PCIe 3.0 x2
    Ports
    2x 1 GbE, 2x USB-A 3.2 Gen 1, 1x eSATA
    Caching
    Yes

    Synology's DiskStation DS923+ has it all. Inside is an AMD Ryzen processor (not the same as the desktop-class chips, mind you), optional 10GbE networking, and 4GB of RAM. It's great for storing data, running apps and services, and even a media streaming platform.

  • Synology DS223
    CPU
    Realtek RTD1619B (Plus NPU)
    Memory
    2GB
    Drive Bays
    2 (Upto 36TB storage)
    Expansion
    None
    Ports
    1 x 1GbE RJ-45; 3 x USB-A 3.2 Gen 1
    OS
    Diskstation Manager

    The Synology DS223 is an entry-level 2-bay NAS drive offering up to 36TB of cumulative storage. The drive is powered by a Realtek 1619B chipset paired with 2GB of RAM and runs the Synology DSM operating system. The drive can be configured to run apps for photo, video, or music storage, as well as run Docker. The port selection includes three USB-A 3.2 Gen 1 ports for expansion and a single gigabit Ethernet connector. 

Set up a static IP address on your NAS

This will give you an IP address to use on your devices as the new DNS server

Before we get the DNS server running, it's crucial that your NAS has a static IP address. You can set a reserved IP address in your DHCP server, or set a static IP inside the NAS software. We're using the Synology DSM Control Panel here:

  1. Sign in to your Synology NAS and open Control Panel.
  2. Select Network and then Network Interface.
  3. Select the LAN port your NAS connects to your network with and select Edit.
  4. Select Use manual configuration and enter the IPv4 details for the static IP you want to use, and select Ok to save the setttings.

Installation and initial configuration

Synology has a handy DNS Server package which is all you'll need

While you're on the Synology dashboard, open Package Center and search for DNS Server. Select Install and wait while the NAS downloads and installs the new program. Now that's finished, it's on with configuring the DNS server so that we can use it.

Configuration

The first thing to set up is Resolution, which governs which DNS Forwarders are used if your local DNS cache isn't able to resolve DNS requests. Open the DNS Server and select Resolution from the left menu. Then you'll want to set:

  1. Check the box next to Enable resolution service.
  2. Check Enable forwarders and put the DNS services you want to use as backups into the two boxes. I used 1.1.1.1 (Cloudflare) and 9.9.9.9 (Quad DNS) because they both have a reputation for not blocking sites unless they serve malware or phishing and for privacy.
  3. Forward policy should probably be set to Forward first.
  4. The Limit source IP service lets you limit which IP ranges can use this DNS server. Mine is set to inside either of my two subnets.

Now, to set up the Primary Forwarding Zone

This takes any DNS requests from your devices and forwards them on

Your Synology NAS is already running a DNS Server, but we have a few things to set up so that it will cache DNS records or forward DNS requests to our DNS resolvers if it doesn't already have them. Select the Zones tab, then Create, and Primary Zone. Enter the following into the form fields

  • Domain type: Forward zone
  • Domain name: [whatever you want your domain to be]
  • Primary DNS server: [your external static IP - this can be a Synology DDNS IP]
  • Serial format: You can choose either option here.
  • Limit zone transfer: Checked
  • Limit source IP service: Checked if preferred, and limits added in the Source IP List

Remember to select Save to keep these settings and exit the creation tool. The Forward zone translates xda-developers.com into the Internet Protocol Address necessary to connect to the remote server when browsing.

If you are using reverse proxies in your home lab or network and want human-readable URLs, you can select the Primary zone and then Edit resource record and enter the service URLs you want and their IP plus Port details as A Type records

And a Primary Reverse Zone

This translates IP addresses back to human-readable URLs

This step is optional, but if you want fully qualified domain names to show up in log files so you don't need to search for IP addresses, it's worth spending a few minutes setting it up. Select the Zones option again from the DNS Server app, then Create and Primary zone. We're going to use some different settings this time:

  • Domain type: Reverse zone
  • Domain name: Reverse IP notation for your subnet
  • Name server: Choose the one you created in the Primary Forwarding Zone
  • Serial format: Choose your preferred option
  • Limit zone transfer: Checked
  • Limit source IP service: If preferred, enter your subnet zones or IP ranges in the list.

Note that the Domain name here is the reverse of the subnet for which you want to provide records. If your IP range is 192.168.1.0, this setting will be 1.168.192.in-addr-arpa. For IPv6 subnets, change the dropdown to .ip6.arpa.

Your NAS is now running its own DNS Server but you'll need to change some network settings

If everything set up correctly, your NAS is now configured to handle all DNS requests, either from the local cache or by forwarding them on to the DNS servers you provided, and then relay the information back to your devices. You can now go set up the DHCP server of your router to point at the Synology external IP address that you used in the Primary Forwarding Zone, and browse as normal. Now your DNS requests will be more private, and once you've browsed to a website once, faster on every subsequent visit.