防止DNS污染 – openwrt路由器安装stubby

其他内容

本文最后更新于 2020年8月5日   请注意相关内容可能已过时

前面我有提到过使用dnsmasq非标准端口来防止dns污染,不过目前有个stubby可以用上DOT和DOH,可用来与dnsmasq搭配使用。

openwrt安装stubby

opkg update opkg install stubby

安装完成以后配置文件在

/etc/stubby/stubby.yml

配置文件例子:

# Note: by default on OpenWRT stubby configuration is handled via
# the UCI system and the file /etc/config/stubby. If you want to
# use this file to configure stubby, then set "option manual '1'"
# in /etc/config/stubby.
resolution_type: GETDNS_RESOLUTION_STUB
round_robin_upstreams: 1
appdata_dir: "/var/lib/stubby"
tls_authentication: GETDNS_AUTHENTICATION_REQUIRED
tls_query_padding_blocksize: 128
edns_client_subnet_private: 0
idle_timeout: 10000
listen_addresses:
- 127.0.0.1@5453
- 0::1@5453
dns_transport_list:
- GETDNS_TRANSPORT_TLS
upstream_recursive_servers:
## Google
- address_data: 8.8.8.8
tls_auth_name: "dns.google"
- address_data: 8.8.4.4
tls_auth_name: "dns.google"

其中:

round_robin_upstreams  指的是dns轮询,可根据自己测试关闭与否,设置为0即为关闭

edns_client_subnet_private  指的是edns隐私保护,国内的话建议关闭,否则会导致网站cdn解析到国外,

不过即使是关闭了,有时候解析某些地址还是会解析到国外的cdn。

 

启动:

/etc/init.d/stubby start

停止:

/etc/init.d/stubby stop

测试:## -C 为大写, -v7为debug模式,输出详细的log

stubby -C /etc/stubby/stubby.yml -v7

设置好以后可直接在dnsmasq上游服务器填写 127.0.0.1#5453

发表评论

邮箱地址不会被公开。 必填项已用*标注