uBlockDNS Client 是一个独立项目,与 uBlock Origin 或其维护者无关,亦未获其认可或与其存在关联。
uBlockDNS Client 为您的整个设备带来 DNS 级别的广告和跟踪器拦截。它使用社区维护的过滤器列表(如 EasyList 和 EasyPrivacy),在 DNS 层应用,因此应用、浏览器和后台服务都会被覆盖,无需逐个安装浏览器扩展。
网站: ublockdns.com
uBlockDNS Client 适用于桌面和服务端环境,在这些环境中,您希望通过一次安装实现全系统保护,并通过 uBlockDNS 仪表板进行远程配置。
在 ublockdns.com 创建一个免费账户,然后按照仪表板中的设置指南操作。该指南涵盖所有受支持的平台,提供可复制粘贴的命令和分步说明。
macOS 和 Linux 快速安装:
curl -sSfL https://ublockdns.com/install.sh | sh -s -- <profile-id>
使用 -L,让 curl 遵循托管安装脚本上的 Cloudflare 重定向。
安装过程中,系统可能会提示您输入 Mac 或 Linux 管理员密码,以更新系统 DNS 设置。
验证安装程序脚本校验和(Linux):
curl -sSfLO https://ublockdns.com/install.sh
curl -sSfLO https://github.com/ugzv/ublockdnsclient/releases/latest/download/SCRIPT_SHA256SUMS
grep " install.sh$" SCRIPT_SHA256SUMS | sha256sum -c -
sh install.sh <profile-id>
Windows 10 或更高版本(以管理员身份运行 PowerShell):
irm https://ublockdns.com/install?id=<profile-id> | iex
仪表板使用此引导流程。它会从 /install-script 下载安装程序,从而避免可能破坏直接 /install.ps1 下载的 Cloudflare 重定向问题。
已发布的 Windows 安装程序和二进制文件要求 Windows 10 或更高版本。不支持 Windows 7、Windows 8 和 Windows 8.1。
验证安装程序脚本校验和(PowerShell):
iwr https://ublockdns.com/install-script -OutFile install.ps1
iwr https://github.com/ugzv/ublockdnsclient/releases/latest/download/SCRIPT_SHA256SUMS -OutFile SCRIPT_SHA256SUMS
$expected = (Select-String -Path .\SCRIPT_SHA256SUMS -Pattern " install.ps1$").Line.Split()[0].ToLower()
$actual = (Get-FileHash .\install.ps1 -Algorithm SHA256).Hash.ToLower()
if ($actual -ne $expected) { throw "install.ps1 checksum mismatch" }
powershell -ExecutionPolicy Bypass -File .\install.ps1 -ProfileId <profile-id>
在发布页面上还提供 Windows GUI 安装程序(.exe)。
该服务每天自行更新;在应用之前,会根据 uBlockDNS 签名密钥验证版本。在服务环境中设置 UBLOCKDNS_NO_AUTOUPDATE=1 可选择退出,或使用 sudo ublockdns upgrade 手动更新。
自动更新适用于 macOS、Windows 和 Linux。在 FreeBSD 上,rc.d 不会重启已退出的服务,因此客户端在那里不会自行更新;请使用 sudo ublockdns upgrade。客户端会在启动时记录其当前所处的模式。
没有 upgrade 命令的旧版本:重新运行一次安装命令,自动更新将接管。
macOS 和 Linux:
sudo ublockdns uninstall
Windows(以管理员身份运行 PowerShell):
& "$env:ProgramFiles\uBlockDNS\ublockdns.exe" uninstall
开头的 & 是必需的。没有它,PowerShell 会将带引号的路径视为普通字符串,并报告 Unexpected token 'uninstall'。
卸载会停止服务并恢复您之前的 DNS 设置。二进制文件会保留在磁盘上;如果不再需要,请手动删除。之后运行 ublockdns status,确认系统 DNS 不再指向 127.0.0.1。
仪表板设置指南还涵盖 Chrome、Firefox、iOS、Android 和路由器。这些设备直接使用 DNS-over-HTTPS,不需要此客户端。
linux/amd64, linux/arm64, linux/armv7, darwin/amd64, darwin/arm64, windows/amd64, windows/arm64, freebsd/amd64
ublockdns install -profile <profile-id> Install as system service
ublockdns uninstall Remove service and restore DNS
ublockdns start Start the service
ublockdns stop Stop the service
ublockdns status Show service state and readiness details
ublockdns status -json Show machine-readable status with ready_code and probe_error
ublockdns wait-ready -timeout 45s Wait until service and DNS are active
ublockdns wait-ready -timeout 45s -json Emit machine-readable readiness state for automation
ublockdns upgrade Update to the latest release and restart the service
ublockdns version Print version
从仪表板管理您的过滤器列表、自定义规则和查询日志。CLI 的范围刻意保持狭窄:安装本地服务、验证其健康状况,然后让仪表板处理策略变更。
客户端在 127.0.0.1:53 上运行本地 DNS 代理,并通过加密的 DNS-over-HTTPS 将所有查询转发到 uBlockDNS 服务。该服务会根据您的配置文件启用的过滤器列表和自定义规则评估每个查询,然后返回正常的 DNS 应答或阻止响应。
当您在仪表板中更新过滤器列表或自定义规则时,客户端会实时接收这些更改并自动刷新本地 DNS 缓存,以便新的决策快速生效。
需要 Go 1.25 或更高版本。
go build -o ublockdns .
sudo ./ublockdns install -profile <profile-id>
发现错误或有建议?打开一个 issue。
对于拦截问题(广告未被拦截或网站被错误拦截),请先检查您在仪表板中启用了哪些过滤器列表。uBlockDNS 使用社区维护的列表,不控制其内容。
请通过 GitHub Security Advisories 私下报告安全漏洞。不要为安全问题创建公开的 issue。
有关信任模型详情、开发透明度和当前审计状态,请参阅 SECURITY.md。
MIT