Setting Up DNS2P: Step-by-Step for Windows, macOS, and Linux
This guide shows how to install and configure DNS2P (DNS-over-POST), a privacy-focused DNS transport, on Windows, macOS, and Linux. Steps assume DNS2P server URL and credentials (if required). If you don’t have a server, use a reputable public DNS2P provider or run a local DNS2P proxy.
Before you begin
- Requirement: Administrative/root access on each system.
- Assumed values: Replace these with your provider’s details:
- DNS2P endpoint: https://dns.example/dns2p
- Local DNS2P proxy listen address: 127.0.0.1:5353
Overview of the approach
- Install a DNS2P client or generic DNS-over-HTTP(S) proxy that supports DNS2P.
- Configure the client to forward DNS queries to the DNS2P endpoint.
- Point system DNS to the local proxy (127.0.0.1:5353).
- Verify encrypted DNS is working.
Windows (⁄11)
1) Install a DNS2P-capable client
- Download and install a compatible client (example: dns2p-proxy.exe or a DoH/DoT client that supports DNS2P). Place it in C:\Program Files\DNS2P.
2) Configure the client
- Create a config file C:\Program Files\DNS2P\config.yaml with:
Code
listen: 127.0.0.1:5353 endpoint: “https://dns.example/dns2p” mode: “post”
- If credentials are required, add them per provider instructions (e.g., api_key: “YOURKEY”).
3) Run as a service
- Open PowerShell as Administrator and create a Windows service:
Code
New-Service -Name DNS2P -BinaryPathName “C:\Program Files\DNS2P\dns2p-proxy.exe -config C:\Program Files\DNS2P\config.yaml” -DisplayName “DNS2P Proxy” -StartupType Automatic Start-Service DNS2P
4) Point Windows DNS to local proxy
- Open Settings → Network & Internet → Change adapter options → Right-click adapter → Properties → IPv4 → Properties → Use the following DNS server addresses:
- Preferred: 127.0.0.1
- Alternate: leave blank
- Or run:
Code
netsh interface ip set dns “Ethernet” static 127.0.0.1
5) Verify
- In PowerShell:
Code
nslookup example.com 127.0.0.1:5353
- Use a DNS leak test site in browser; ensure resolver matches your DNS2P provider.
macOS (11+)
1) Install client
- Use Homebrew (if client available):
Code
brew install dns2p-proxy
- Or download a macOS binary and move to /usr/local/bin.
2) Create config
- Create /usr/local/etc/dns2p/config.yaml:
Code
listen: 127.0.0.1:5353 endpoint: “https://dns.example/dns2p” mode: “post”
3) Run as a launchd service
- Create ~/Library/LaunchAgents/com.dns2p.proxy.plist with appropriate ProgramArguments to run the binary and config. Load it:
Code
launchctl load ~/Library/LaunchAgents/com.dns2p.proxy.plist
4) Point system DNS to proxy
- System Preferences → Network → Advanced → DNS → + add 127.0.0.1 at top. Click OK → Apply.
- Or via command line for network service “Wi-Fi”:
Code
networksetup -setdnsservers “Wi-Fi” 127.0.0.1
5) Verify
Code
scutil –dns dig @127.0.0.1 -p 5353 example.com
Linux (systemd-based, e.g., Ubuntu)
1) Install client
- If packaged:
Code
sudo apt install dns2p-proxy
- Or download binary to /usr/local/bin and make executable.
2) Create config
- /etc/dns2p/config.yaml:
Code
listen: 127.0.0.1:5353 endpoint: “https://dns.example/dns2p” mode: “post”
3) Create systemd service
- /etc/systemd/system/dns2p.service:
Code
[Unit] Description=DNS2P Proxy After=network.target[Service] ExecStart=/usr/local/bin/dns2p-proxy -config /etc/dns2p/config.yaml Restart=on-failure User=nobody[Install] WantedBy=multi-user.target
- Enable and start:
Code
sudo systemctl daemon-reload sudo systemctl enable –now dns2p
4) Configure system DNS
- If using systemd-resolved:
Code
sudo ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf sudo sed -i ’s#127.0.0.53#127.0.0.1#’ /etc/resolv.conf
- Or set DNS in /etc/resolv.conf:
Code
nameserver 127.0.0.1
5) Verify
Code
dig @127.0.0.1 -p 5353 example.com systemd-resolve –status
Troubleshooting (quick)
- No resolution: confirm proxy running and listening on 127.0.0.1:5353 (use netstat or ss).
- TLS errors: check endpoint URL and system clock.
- DNS leaks: ensure no alternate DNS servers set in adapter settings.
- Permissions: services need admin/root to bind privileged ports (<1024).
Example config options to consider
- timeout: 5s
- cache_size: 10000
- bootstrap_dns: 1.1.1.1 (used to resolve the DNS2P endpoint if needed)
If you want, I can generate ready-to-use config files and service unit files customized for your DNS2P endpoint and credentials.
Leave a Reply