How to Set Up a Local DNS Proxy

Published on 28 Mar 2026
Last updated on 6 Oct 2026

Table 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

You can simply edit /etc/resolv.conf like so:

nameserver 127.0.0.1
nameserver ::1

Then set the "immutable file attribute" on resolv.conf using chattr +i /etc/resolv.conf. This is needed because most network managers overwrite the file (or add to it) with their own nameservers.

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.

Now you can restart your network manager.