10. The DNS server
Tunnelry can run a DNS server: the service that turns names such as example.com into addresses. It answers your VPN
devices and, if you want, every device in your local network, so it can replace a separate DNS filter such as
AdGuard Home. You choose who may ask, which servers it asks in turn, what is blocked, allowed or rewritten, and you see a
few counters. Everything is on the DNS page in the menu, in four tabs: General (who may ask, upstream servers),
Blocking, Rewrites and Statistics. Names, servers and networks are tables: Add opens a small dialog, and
each row has Edit and Remove. Rows are saved as you add, change or remove them.

What it can do
| Function | Where |
|---|---|
| Serve VPN devices and, optionally, the local network | Who may use it |
| Ask the upstream servers you choose, optionally encrypted (DNS over TLS) | Upstream servers |
| Block popular services with one switch | Blocking, Services |
| Block your own names, and keep chosen names always allowed | Blocking |
| Use filter lists that other people keep up to date | Filter lists |
| Answer a name with your own address, also for everything under a name | Rewrites |
| Show counters (questions, cache, failures) | Statistics |
Not there (yet): a record of who asked for which name, and different rules for different devices. Tunnelry keeps no list of the names people look up.
Turning it on
- Open DNS and switch on Run a DNS server on this server. Pick your upstream servers (the buttons fill in Cloudflare, Quad9, Google or AdGuard) and press Save.
- Apply the change with the bar at the top of the page, and confirm in time, as for any change to the server.
VPN devices are told to use this server for names from then on. Devices that are already connected pick it up when they reconnect.
Using it for your whole local network
This is how you replace a separate DNS server such as AdGuard Home.
- Make sure the server has a static address (guide 8): when it changes, every device in the network loses its DNS.
- In Who may use it tick Also answer devices in my local network. Tunnelry proposes the server's address and the
network around it (for example
192.168.1.0/24). Only private networks are accepted: the server never answers the internet. Press Save and apply the change. - Try it on one device first: set this server's address as the DNS server by hand and look something up.
nslookup example.com 192.168.1.20
- When it works, set the same address as the DNS server in the DHCP settings of your router, so that every device gets it by itself. Until you do, devices keep using their old DNS server, so nothing changes by surprise.
If something goes wrong, put the old DNS server back in the router: devices need nothing else.
Upstream servers
The servers this one asks for names it does not know. Add them one by one, or use a preset. Leave the list empty and Tunnelry looks names up by itself (a little slower the first time, and more private).
Tick Encrypt the questions (DNS over TLS) so that nobody between this server and the upstream server can read the
names. Then each server also has the name on its certificate (for example cloudflare-dns.com for 1.1.1.1); the presets
fill them in.
Blocking and allowing
A blocked name blocks everything below it: blocking example.com blocks www.example.com too.
- Services. Tick a service (TikTok, YouTube, Netflix, Facebook and more) and its main names are blocked. Apps may use other names, and services change them, so this is a convenience, not a guarantee.
- Your own blocked names. A table: Block a name adds one.
- Always allowed names. A name here, and everything under it, is never blocked, whatever a list, a service or your own block says. Use it when a list blocks something you need.
Filter lists

A filter list is a long list of unwanted names (advertising, trackers, malicious sites) that other people keep up to
date. Press one of the recommended lists, or add your own with a name and an address. Hosts files, plain lists of names
and ad-block rules (||example.com^) are understood.
The server downloads the lists itself, only from https addresses, and refreshes them every day. A list you add is
downloaded as soon as you apply the change; Update now downloads it again. If a download fails, the previous
version keeps being used and the list is marked as failed. The recommended lists belong to their publishers and have
their own licences. Very large lists use memory: at most 500 000 names are supported in total.
Rewrites
One table. Add a rewrite asks for the name (for example nas.lan) and the address it should resolve to. Tick
Also every name under it and home.lan and every name below it (tv.home.lan) get that address. A name of its own
(nas.lan) wins over the one that covers everything under it.
A rewrite is never blocked by a list. Remember that VPN devices also need a rule in their role that lets them reach the address.
Statistics
The counters since the DNS server started: questions answered, how many were answered without asking another server (from the cache, or by the server itself for blocked and rewritten names), how many had to be asked, the average lookup time and the failures. The counters cannot tell blocked names apart from the others. A restart (for example after an update or applied changes) starts them again.
Who may change it
The page needs its own permission, Manage the DNS server. Accounts that could manage the VPN server before got it with the update. It is a privileged permission: rewriting a name decides where people behind the VPN end up. Anyone with it can also apply saved changes with the bar at the top of the page.
From the console there is a twin of the page for scripts:
sudo -u tunnelry php /opt/tunnelry/current/artisan tunnelry:dns --show