|
| 1 | + |
| 2 | + |
| 3 | +<p align="center"> |
| 4 | + <a href="https://dyne.org"> |
| 5 | + <img src="https://img.shields.io/badge/%3C%2F%3E%20with%20%E2%9D%A4%20by-Dyne.org-blue.svg" alt="Dyne.org" /> |
| 6 | + </a> |
| 7 | +</p> |
| 8 | + |
| 9 | +<h4 align="center"> |
| 10 | + <a href="#-install">💾 Install</a> |
| 11 | + <span> • </span> |
| 12 | + <a href="#-quick-start">🎮 Quick start</a> |
| 13 | + <span> • </span> |
| 14 | + <a href="#-configuration">🔧 Configuration</a> |
| 15 | + <span> • </span> |
| 16 | + <a href="#-license">💼 License</a> |
| 17 | +</h4> |
| 18 | + |
| 19 | +`ns2dohd` is a local DNS-to-DoH gateway daemon. |
| 20 | +It listens on `127.0.0.1:53` (by default), accepts classic DNS requests, and forwards them to a trusted DoH endpoint using wolfSSL + nghttp2. |
| 21 | + |
| 22 | +*** |
| 23 | +# 💾 Install |
| 24 | + |
| 25 | +Build requirements: `gcc` or `clang`, `make`, `wolfSSL`, `nghttp2`. |
| 26 | + |
| 27 | +1. Build binaries: |
| 28 | + |
| 29 | +```bash |
| 30 | +make build |
| 31 | +``` |
| 32 | + |
| 33 | +2. Install binaries and manpages (default prefix `/usr/local`): |
| 34 | + |
| 35 | +```bash |
| 36 | +sudo make install |
| 37 | +``` |
| 38 | + |
| 39 | +You can override installation paths, for example: |
| 40 | + |
| 41 | +```bash |
| 42 | +sudo make install PREFIX=/usr |
| 43 | +``` |
| 44 | + |
| 45 | +*** |
| 46 | +# 🎮 Quick start |
| 47 | + |
| 48 | +Run as root to bind port `53`, then drop privileges using `-u`: |
| 49 | + |
| 50 | +```bash |
| 51 | +ns2dohd -d https://dns.dyne.org/dns-query -u nobody |
| 52 | +``` |
| 53 | + |
| 54 | +`ns2dohd` daemonizes by default. Use `-F` to stay in foreground. |
| 55 | + |
| 56 | +Common options: |
| 57 | + |
| 58 | +- `-d <https://...>` DoH endpoint URL (mandatory) |
| 59 | +- `-p <port>` local UDP port (default: `53`) |
| 60 | +- `-u <user>` drop privileges after bind |
| 61 | +- `-r <resolver_ip>` bootstrap resolver used to resolve the DoH endpoint host (default: `1.1.1.1`) |
| 62 | +- `-A <cafile>` custom CA bundle |
| 63 | +- `-F` foreground mode |
| 64 | +- `-v` verbose logs |
| 65 | + |
| 66 | +See full options with: |
| 67 | + |
| 68 | +```bash |
| 69 | +ns2dohd -h |
| 70 | +man ns2dohd |
| 71 | +``` |
| 72 | + |
| 73 | +*** |
| 74 | +# 🔧 Configuration |
| 75 | + |
| 76 | +To use `ns2dohd` as your host DNS resolver, configure your system DNS to point to localhost. |
| 77 | + |
| 78 | +## /etc/resolv.conf |
| 79 | + |
| 80 | +Set: |
| 81 | + |
| 82 | +```conf |
| 83 | +nameserver 127.0.0.1 |
| 84 | +``` |
| 85 | + |
| 86 | +## NetworkManager |
| 87 | + |
| 88 | +Set `127.0.0.1` as the primary DNS server in your active network profile, then reconnect. |
| 89 | + |
| 90 | +After either configuration, keep `ns2dohd` running as a background daemon as root (with `-u` recommended). |
| 91 | + |
| 92 | +Notes: |
| 93 | + |
| 94 | +- `ns2dohd` uses a separate bootstrap resolver (default `1.1.1.1`) for resolving the DoH endpoint hostname, avoiding resolver recursion. |
| 95 | +- Change bootstrap resolver with `-r`, for example `-r 9.9.9.9`. |
| 96 | + |
| 97 | +*** |
| 98 | +# 💼 License |
| 99 | + |
| 100 | +This is free software distributed under the GNU Affero General Public License (AGPLv3). |
| 101 | + |
| 102 | +Author: Dyne.org Foundation `<info@dyne.org>` |
0 commit comments