跳转至内容

Cloudflared

来自 ArchWiki

本文或本章节已过时。

原因: cloudflared 的 proxy-dns 命令已被移除。请参阅此贴。(在 Talk:Cloudflared 中讨论)

Cloudflared 可用于运行本地的 DNS over HTTPS 服务器 (DoH),即存根解析器 (stub resolver)。

安装

安装 cloudflared 软件包。

用法

运行 cloudflared proxy-dns 来启动 DNS over HTTPS 代理服务器。

使用 --address--port 选项来指定 cloudflared 监听的地址和端口。它们分别默认为 localhost53。可用命令行选项列表请参阅此处

您可以创建一个 systemd 服务文件,例如

/etc/systemd/system/cloudflared.service
[Unit]
Description=DNS over HTTPS proxy client
Wants=network-online.target nss-lookup.target
Before=nss-lookup.target

[Service]
AmbientCapabilities=CAP_NET_BIND_SERVICE
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
DynamicUser=yes
ExecStart=/usr/bin/cloudflared proxy-dns --port 54

[Install]
WantedBy=multi-user.target
注意 extra 仓库中的软件包不提供服务文件。请参阅 archlinux/packaging/packages/cloudflared#1

启动服务后,您可以使用 drill(1)(由 ldns 软件包提供)来测试其是否正常工作

$ drill archlinux.org @127.0.0.1 -p 54

检查

使用 1.1.1.1/help 来检查浏览器是否正在使用 Cloudflare DoH

端点

默认情况下,cloudflared 使用 https://1.1.1.1/dns-queryhttps://1.0.0.1/dns-query(即 Cloudflare 的 DNS over HTTPS 服务器)作为上游端点 URL。

您可以通过 --upstream 选项指定不同的上游端点 URL。

注意 请选择您信任的 DNS 解析器。请参阅 域名解析#第三方 DNS 服务

参见

© . This site is unofficial and not affiliated with Arch Linux.

Content is available under GNU Free Documentation License 1.3 or later unless otherwise noted.