Guides & reference

9NS Documentation

Advanced system DNS client, proxy & filtering engine for Windows.

Use Cases

Prevent DNS Leak

Windows applications and background services can bypass user-configured DNS settings, especially on multi-homed machines with several adapters, VPNs, or virtual switches. 9NS closes these leaks on three levels:

A crash watchdog runs alongside the proxy and restores the original adapter DNS settings if the main process ever terminates abnormally.

DNSSEC Made Easy

Enable dnssec_validation and 9NS validates every reply on the client side without any per-application setup:

DNS and Multiple Interfaces

On machines with several active adapters - LAN plus Wi-Fi, VPN tunnels, virtual switches - the operating system may leak queries through whichever interface it prefers. 9NS makes the behavior deterministic:

Introduction

The Domain Name System (DNS) is the fundamental component of Internet communications. It translates human-readable names, such as www.example.net, to IPv4 or IPv6 addresses that can be accessed through a network.

The standard DNS protocol is very old and cannot satisfy the requirements of modern networking, including security, flexibility and reliability. A number of improved protocols have been proposed - but even the latest operating systems and apps support them poorly, if at all.

9NS resolves hostnames over plain DNS, DNS over HTTPS (DoH), DNS over TLS (DoT), DNS over QUIC (DoQ), Oblivious DoH (ODoH) and DNSCrypt v2. Queries can be anonymized through DNSCrypt relays or ODoH relays, and answers are validated with client-side DNSSEC. For the strongest guarantee, a kernel-mode Windows Filtering Platform driver blocks any DNS traffic that would bypass the proxy.

The key feature of 9NS is system-level integration. There is no need to change DNS settings in multiple places: 9NS listens on local port 53, captures DNS requests at the system level, and processes them according to your configuration and rules. The engine can run as a regular desktop application, minimize to the system tray, or run as a Windows service with no user logged on.

Even without modern protocols, 9NS brings powerful features: multiple DNS servers and pools running simultaneously, hostname-mask rules with process/block/bypass/local actions, hosts-file blocklists, a real-time query log with per-domain right-click blocking, and a built-in browser for the public resolvers and relays lists with live latency benchmarking.

Installation and Uninstallation

Switching from 9ns: 9NS uses 9ns.exe, %ProgramData%\9NS, the 9NSService service and the NineNsFlt driver. Stop and quit the old installation so adapter DNS is restored, and remove its service and driver before installing the new ones. Do not run both versions together. Existing settings are left untouched; import a valid configuration explicitly, and never copy the old DNS-backup file.

9NS runs on 64-bit editions of Windows 10 and Windows 11. Download the 9NS-Setup-1.0.0.exe installer (or the portable 9ns-windows-x64.zip) from the GitHub Releases page.

Run the setup program and follow the wizard. It lets you choose the destination folder, create Desktop and Start Menu shortcuts, install 9NS as a background Windows service, and optionally install the NineNsFlt kernel DNS guard driver. No reboot is required. A portable installation is equally simple: extract the zip anywhere and run start-app.bat or 9ns.exe.

To uninstall, use Apps & features in Windows Settings, or run uninstall.bat from the installation folder. The uninstaller stops and removes the Windows service and the kernel driver, deletes shortcuts and registry entries, and removes the installation directory.

Administrator rights are required at runtime: 9NS binds local port 53 and changes adapter DNS settings. The manifest in 9ns.exe requests elevation automatically. The kernel driver is test-signed; loading it requires test signing mode or a machine-trusted code-signing certificate (see Kernel DNS Guard Driver).

Quick Start

When you start 9NS for the first time with an empty configuration, the First Start Wizard appears. It offers one-click scenarios: popular encrypted presets (Cloudflare, Google, Quad9, AdGuard), or the Public Resolvers browser with more than a thousand community servers. The wizard is available again at any time from the main window.

9NS adds its icon to the system tray while running. Open the main window by left-clicking the icon; right-click for quick access to the engine controls, cache flushing and the public resolvers browser.

Click Start Engine to activate protection. The engine status is shown live in the header, and every query appears in the Query Log as it is processed:

example.com   A     12.4 ms   Secure   DoH  cloudflare-doh
iana.org      AAAA   9.8 ms   Secure   DoT  google-dot

Right-click any row to inspect the decoded DNS packet, block or bypass that domain, or copy the name. To make 9NS start automatically, enable Autostart in the settings; to keep it running after the window is closed, leave Close to tray enabled.

Main Window

Open the main window from the system tray icon. The header card shows the engine and system-DNS state, Start/Stop, Save Changes with unsaved-change feedback, Flush Cache and the Public Resolvers launcher. Next to it, a sidebar navigates the six pages of the configuration (also reachable with Ctrl+1– Ctrl+6):

Inspect Query Details... opens a decoded view of the DNS packet - question, answer and authority sections side by side with a hex dump. Edits are a draft until saved and take effect on the next engine start. When you close the window, 9NS keeps running minimized in the system tray (if enabled); File › Exit always quits.

DNS Servers

Open the Servers & Pools sidebar page to manage upstreams. Each server has a user-friendly name used by rules, pools and logs, and a protocol selected from the list below.

TypeAddressKey parameters
plainIP (8.8.8.8, 8.8.8.8:53) UDP with TCP fallback on truncation
dohhttps://host/dns-query bootstrap_ips, tls_verify
dothost name or IP port (default 853), sni, bootstrap_ips
doqhost name or IP port (default 853), sni - DNS over QUIC, ALPN doq
odohhttps://target/dns-query proxy (ODoH relay URL), bootstrap_ips
dnscryptvia sdns:// stamp provider name, Ed25519 public key, optional relay

Use the Test Server button to measure the round-trip time of a live query before saving. The sdns:// button imports DNS Stamps - including DoQ (0x04), ODoH (0x05) and relay stamps (0x81/0x85) - such as those published in the dnscrypt-resolvers lists.

An example configuration entry for an ODoH target reached through a relay:

{
  "name": "odoh-target",
  "type": "odoh",
  "address": "https://adl01.dnscry.pt/dns-query",
  "proxy": "https://odoh-relay.numa.rs/relay"
}

Rules

Rules decide how each resolve request is handled. 9NS examines rules in order and the first match wins; if nothing matches, the default target (upstream or pool) is used. A rule combines a hostname mask list with an action:

Optional conditions narrow the match by query type (A, AAAA, PTR, ANY, ...) and by network adapter (interface GUID). A per-rule dnssec_mode can force or disable DNSSEC handling for the matched names.

{
  "name": "Block Ads & Trackers",
  "hostnames": ["*.doubleclick.net", "*.telemetry.microsoft.com"],
  "action": "block",
  "block_mode": "nxdomain"
}

Pools and Relays

Group upstreams into pools to add redundancy and load distribution. When a pool is assigned to a rule, the strategy decides which member serves each query:

StrategyBehavior
failoverPriority order; falls back to the next server on failure
fastestRoutes to the server with the lowest measured RTT
round_robinEven rotation across healthy members
randomUniform random selection per query

Relays make up the second use case. For Anonymized DNSCrypt, add a relay (protocol Relay, 0x81 stamps) alongside DNSCrypt servers in a pool: every query then travels through the relay to the server, so the resolver never sees your IP. For ODoH, put a relay URL into the upstream's proxy field - the query is HPKE-encrypted to the target and the relay only forwards sealed messages. Only combine ODoH relays with ODoH servers, and DNSCrypt relays with DNSCrypt servers.

DNS Servers Import

The built-in Public Resolvers browser synchronizes directly with the official dnscrypt-resolvers repositories:

Search by name, country or protocol (DoH, DoQ, ODoH, DNSCrypt, Relay), filter by capabilities - DNSSEC, No Logs, No Filter - and benchmark candidates with the live RTT pinger. One click imports a server into your configuration, and one-click pool generation groups the selected servers into a ready-to-use pool.

Configuration Files and Logs

9NS is configured through a single human-readable JSON file. It lives in a protected system folder - not next to the executable:

%ProgramData%\9NS\config.json    (configuration)
%ProgramData%\9NS\9ns.log  (log file)

The schema is documented by src/config/config.example.json and by the Configuration Reference in the README. The top-level keys control the listen port, cache sizes and TTL bounds, system DNS integration, leak prevention, DNSSEC validation, autostart and logging; upstreams, pools and rules arrays hold the routing configuration. Invalid values are rejected at load with an error naming the offending entry.

The query log is written according to log_level: error, info or debug. Set log_file to control the file name inside the data folder, or leave it empty to disable file logging. The same events are always visible live in the Query Log page.

Windows Service Mode

9NS can run as a Windows service, which provides two main features: the engine runs in the background even when no user is logged on, and only an administrator can start, stop or reconfigure it.

9ns.exe --install-service
9ns.exe --uninstall-service
9ns.exe --service

The setup installer can register the service for you (option Install as background Windows Service), or you can run the commands above from an elevated prompt. The service reads the same config.json from %ProgramData%\9NS. Build and test the configuration in regular desktop mode first; the service picks it up at its next start.

Kernel DNS Guard Driver

The optional NineNsFlt driver is a Windows Filtering Platform callout that enforces the proxy at the kernel level: every outbound connection to remote port 53 (UDP or TCP) is permitted only when it targets loopback (127.0.0.0/8, ::1). Anything else is blocked, so applications cannot leak DNS to hard-coded resolvers.

The policy applies to all software on the machine - including 9NS's own plain-DNS upstreams. While the driver is active, configure encrypted upstreams (DoH, DoT, DoQ, ODoH, DNSCrypt).

Building from Source

The application is built with the MSYS2 MinGW64 toolchain (mingw-w64-x86_64-{gcc,cmake,ninja,qt6-base,qt6-svg,openssl,libsodium}):

cmake -S . -B build-win -G Ninja -DCMAKE_BUILD_TYPE=Release -DOPENSSL_ROOT_DIR=<msys64>/mingw64
cmake --build build-win

The kernel driver requires Visual Studio Build Tools (C++) and the Windows Driver Kit:

src\driver\build.cmd

Packaging produces the portable zip and the setup installer (both including the driver package):

python scripts/package_windows.py
python scripts/create_setup.py

Pushing a v* tag builds everything on GitHub Actions and publishes a GitHub Release with both artifacts attached.

9NS is free and open source software licensed under the GNU Affero General Public License v3.0. Source code, issues and contributions: github.com/amini8/9ns.