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:
- System integration. With
system_dnsenabled, 9NS sets itself (127.0.0.1and::1) as the DNS server on every active adapter, so all system DNS traffic arrives at the local proxy on port 53. - Smart multi-homed resolution policy. With
prevent_dns_leaksenabled, 9NS manages theDisableSmartNameResolutionpolicy so Windows cannot parallel-query alternate resolvers behind your back. - Kernel enforcement. The optional NineNsFlt
driver blocks every DNS connection (UDP/TCP 53) that does not target loopback - even
apps that hard-code
8.8.8.8are forced through 9NS.
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:
- The Authenticated Data (AD) bit from the upstream resolver is honored over secure transports (DoH, DoT, DoQ, ODoH, DNSCrypt).
- RRSIG signatures are checked against their inception and expiration timestamps to catch replayed or expired signatures.
- Answers are classified as
Secure,Insecure,BogusorIndeterminate, andBogusreplies are turned intoSERVFAILbefore they can poison the cache. - Per-rule overrides via
dnssec_mode(default,force,ignore) let you relax or tighten validation for specific domains.
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:
- Dual-stack loopback redirection installs
127.0.0.1and::1on every adapter (configurable viaipv6_loopback). - Rules can be bound to a specific network adapter through the interface GUID, so names belonging to a VPN domain are resolved only when that tunnel is up.
- Upstream connections honor
bootstrap_ips, removing the chicken-and-egg problem of resolving the resolver's own hostname.
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
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.
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):
- Overview - protection summary, live metrics and last-tested upstream latency.
- Query Log - the central, real-time view of all DNS traffic: query
name, type, response code, target server, latency and DNSSEC status badges. Filter by
domain (
Ctrl+F) or status, and right-click any row for context actions. - Servers & Pools - manage upstream servers, pools and the default target, with inline reachability tests.
- Rules - the routing and blocking engine, evaluated top to bottom with the first match winning.
- Settings - listener and cache, security, background operation and logging.
- System Log - the diagnostics output.
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.
| Type | Address | Key parameters |
|---|---|---|
plain | IP (8.8.8.8, 8.8.8.8:53) |
UDP with TCP fallback on truncation |
doh | https://host/dns-query |
bootstrap_ips, tls_verify |
dot | host name or IP | port (default 853), sni, bootstrap_ips |
doq | host name or IP | port (default 853), sni - DNS over QUIC, ALPN doq |
odoh | https://target/dns-query |
proxy (ODoH relay URL), bootstrap_ips |
dnscrypt | via 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:
- Hostnames - comma, semicolon or newline separated; wildcards such as
*.example.com,ad*.domain.orgor*are supported. From File... loads a blocklist or a standard/etc/hostsformatted file. process- resolve through a designated upstream server or pool.block- suppress the answer using a configurable mode:nxdomain,null_ip(0.0.0.0/::),refused, or silentdrop.bypass- let the query escape to the system network adapter unchanged.local- return a static mapped IPv4 or IPv6 address.
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:
| Strategy | Behavior |
|---|---|
failover | Priority order; falls back to the next server on failure |
fastest | Routes to the server with the lowest measured RTT |
round_robin | Even rotation across healthy members |
random | Uniform 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:
public-resolvers.md(780+ resolvers) andrelays.md(315+ anonymized relays)odoh-servers.md(ODoH targets) andodoh-relays.md(ODoH relays)
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.
- Installed optionally by the setup installer, or manually by right-clicking
NineNsFlt.infand choosing Install. - Registers as a kernel service depending on the Base Filtering Engine (BFE) and
copies the driver to
System32\Drivers. - Test-signed: to load it, enable test signing
(
bcdedit /set testsigning on) and trust the certificate actually used to sign the package (Root + Trusted Publishers). The default build uses 9NS Test Signing; an explicit signing-thumbprint override may select a different existing certificate.
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.