Configure Ubuntu 22.04 as a DNS server using ControlD
Introduction
If you want to run your own DNS server for increased security, privacy, and control, using
Control Dis a great way to accomplish this.Control D is a fully customizable DNS service, similar to Pi-Hole, AdGuard or NextDNS, but with proxy capabilities.
This means it not only blocks things (ads, porn, etc), but can also unblock websites and services.
Prerequisites
An active
Control Daccount.A
Control DResolver ID.A device and profile already configured on the Dashboard.
Installation
Install the
ctrldutility.
$ sudo sh -c 'sh -c "$(curl -sL https://api.controld.com/dl)" -s RESOLVER_ID_HERE'Substitute RESOLVER_ID_HERE for your actual Resolver ID.
Start the
Control DDNS proxy service.
$ sudo ctrld startHere is a successful start:
Edit the
/etc/controld/ctrld.tomlfile to change theip = '127.0.0.1'line to the actual IP address of the server.
Restart the
ctrldservice.
Verify that the server's IP address is listed as the only nameserver in the
/etc/resolv.conffile and change this if necessary, for example:
Make the following changes to the
/etc/systemd/resolved.conffile:
Substitute RESOLVER_ID_HERE for your actual Resolver ID.
Use one of ControlD's DNS resolvers as the DNS IP address, for example: 76.76.2.22.
See the Free DNS Resolvers page for more detail.
Restart the
systemd-resolvedservice.
Restart the
ctrldservice one more time.
Run a test query using the
digcommand specifying the IP address of the system.
If verify.controld.com resolves, you are successfully using Control D for DNS requests. You can now use this system as the DNS server for your entire network by simply configuring your router to use this system's IP address.
If you are unable to specify a DNS server in your router, you can also change any client on your network to point to this system's IP address as an alternative.