问题描述
想要在刷了 openwrt 的路由器上使用加密 dns,使用 dns over tls(DOT) 可以用 stubby 包,但是它不支持 dns over https(DOH) 和 dns over quic(DOQ)。
解决方案
使用 adguard 的 dnsproxy。
项目地址 https://github.com/AdguardTeam/dnsproxy
参考 stubby 的使用方法和 dnsproxy 的文档,使用以下命令在 openwrt 中安装使用 dnsproxy。
参考 https://github.com/AdguardTeam/dnsproxy 的 README 配置 dnsproxy。
# 安装dnsproxy
opkg update
opkg install dnsproxy
# 配置dnsproxy
# 也可以直接编辑 /etc/config/dnsproxy 文件
uci set dnsproxy.global.enabled="1"
uci -q delete dnsproxy.servers.bootstrap
uci add_list dnsproxy.servers.bootstrap="114.114.114.114" #相当于dnsproxy -b 114.114.114.114
uci -q delete dnsproxy.servers.fallback
uci add_list dnsproxy.servers.fallback="tls://dns.pub" #相当于dnsproxy -f tls://dns.pub
uci -q delete dnsproxy.servers.upstream
uci add_list dnsproxy.servers.upstream="https://doh.pub/dns-query" #相当于dnsproxy -u https://doh.pub/dns-query
uci commit dnsproxy
/etc/init.d/dnsproxy enable
/etc/init.d/dnsproxy start
# 转发dns到dnsproxy
/etc/init.d/dnsmasq stop
uci set [email protected][0].noresolv="1"
uci set [email protected][0].localuse="1"
uci -q delete [email protected][0].server
uci add_list [email protected][0].server="$(uci -q get dnsproxy.global.listen_addr)#$(uci -q get dnsproxy.global.listen_port)"
uci commit dhcp
/etc/init.d/dnsmasq start
文章评论