How to Set Up a Local DNS Proxy
Published on 28 Mar 2026Table of Contents
# Installing a proxy
First you need to install a proxy and configure it to your liking. I'd recommend either dnss or dnsmasq.
# Creating a service
Then start and enable the service. If the package doesn't provide a service, or if you built it from source, you'll have to create a service yourself. Here's how to do it with systemd. If you're not using systemd then I'm sure you're competent enough to figure it out yourself.
Copy this file to /etc/systemd/system/dnss.service:
[Unit]
Description=DNS proxy
[Service]
ExecStart=/usr/bin/dnss
[Install]
WantedBy=multi-user.target
Then run
sudo systemctl daemon-reload
sudo systemctl enable dnss
sudo systemctl start dnss
# Configure your network manager
## No network manager
If you're not using a network manager, or if your network manager doesn't overwrite resolv.conf, you can simply edit /etc/resolv.conf like so:
nameserver 127.0.0.1
nameserver ::1
## NetworkManager
If you're using NetworkManager, you need to edit /etc/NetworkManager/conf.d/dns.conf:
[main]
dns=none
Then configure as if you had No network manager and run nmcli general reload.
## ConnMan
If you're using ConnMan, you need to disable the built-in DNS proxy by adding the --nodnsproxy flag when starting it. See the ArchWiki for more information.
Then you need to set the "immutable file attribute" on resolv.conf using chattr +i /etc/resolv.conf to prevent ConnMan from changing it.
Then configure as if you had No network manager and restart the ConnMan service.