Configs2026年6月2日·1 分钟阅读

SmartDNS — Local DNS Server for Fastest IP Resolution

A lightweight local DNS server written in C that queries multiple upstream DNS servers simultaneously and returns the fastest responding IP address. Supports DNS over TLS, DNS over HTTPS, and custom routing rules for optimized network performance.

Agent 就绪

先审查再安装

这个资产需要先审查。复制的指令会要求 Agent dry-run、列出写入项,确认后再继续。

Needs Confirmation · 64/100策略:需确认
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
SmartDNS
先审查命令
npx -y tokrepo@latest install 8666e429-5ec1-11f1-9bc6-00163e2b0d79 --target codex

先 dry-run,确认写入项后再运行此命令。

Introduction

SmartDNS is a local DNS server that improves DNS resolution speed by querying multiple upstream DNS servers concurrently and selecting the result with the lowest latency. It runs on Linux, OpenWrt, macOS, and Windows, and supports modern encrypted DNS protocols including DNS over TLS and DNS over HTTPS.

What SmartDNS Does

  • Queries multiple upstream DNS servers in parallel and returns the fastest responding result
  • Supports DNS over TLS (DoT) and DNS over HTTPS (DoH) for encrypted upstream queries
  • Caches DNS results locally with configurable TTL for faster repeat lookups
  • Provides domain-based routing rules to direct specific queries to designated upstream servers
  • Runs as a lightweight daemon suitable for routers, servers, and developer workstations

Architecture Overview

SmartDNS is written in C for minimal resource usage. It listens on a configurable local port and forwards incoming queries to all configured upstream servers simultaneously. When responses arrive, it evaluates them based on response time, IP address reachability, and optional speed-check probes. The best result is cached and returned to the client. The configuration is a simple text file with server definitions, routing rules, and cache settings.

Self-Hosting & Configuration

  • Install from prebuilt packages for Debian, OpenWrt, macOS, or compile from source
  • Configure upstream servers in /etc/smartdns/smartdns.conf with protocol and port settings
  • Group upstream servers for split-horizon DNS (e.g., domestic vs. international resolution)
  • Set speed-check-mode to ping or tcp:port for latency-based result selection
  • Adjust cache-size and prefetch-domain for optimal caching behavior

Key Features

  • Parallel querying of multiple upstream servers minimizes DNS resolution latency
  • Encrypted DNS support (DoT and DoH) prevents DNS queries from being intercepted
  • Domain-based routing sends queries for specific domains to designated resolvers
  • IP address filtering and BOGUS NXDOMAIN handling block known bad results
  • Lightweight C implementation runs on resource-constrained devices like routers

Comparison with Similar Tools

  • Pi-hole — Focuses on ad blocking with DNS; SmartDNS focuses on speed optimization
  • CoreDNS — Kubernetes-oriented DNS server; SmartDNS is optimized for client-side resolution
  • AdGuard Home — Combines ad blocking with DNS; SmartDNS specializes in fastest-IP selection
  • Unbound — Recursive resolver; SmartDNS is a forwarding resolver that races upstream servers
  • dnscrypt-proxy — Focuses on encrypted DNS; SmartDNS adds parallel querying and speed testing

FAQ

Q: How does SmartDNS choose the fastest IP? A: It queries all configured upstream servers simultaneously and optionally probes returned IPs with ping or TCP connection tests to select the lowest-latency result.

Q: Can I use SmartDNS on my router? A: Yes. SmartDNS supports OpenWrt and other embedded Linux distributions. Prebuilt packages are available for common router architectures.

Q: Does it block ads? A: SmartDNS can block domains using a blocklist file, but it is not primarily an ad blocker. Combine it with Pi-hole or AdGuard Home for ad blocking.

Q: Can I route certain domains to specific DNS servers? A: Yes. Use nameserver groups and domain-rules to direct queries for specific domains or domain patterns to designated upstream server groups.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产