跳转至

使用 SmartDNS 进行 DNS 分配## 0. 简介Mikrotik的DNS始终是一个令人困惑的问题。我们将引入智能DNS来克服它。

1. 在 Mikrotik 上设置 SmartDNS 容器上一篇文章解释了如何做到这一点。

2. 智能DNS配置在本节中,我们将演示 DNS 组和流程。

3. DNS 组和请求DNS 记录将分为 3 组:- [中国名单][中国名单] - 使用 SmartDNS 配置文件中配置的 CHINA 组的公共 DNS 服务器进行解析- [GFW 列表][GFW 列表] - 使用 SmartDNS 配置文件中配置的 GFW 组的外部 DNS 服务器进行解析- 其他的 - 使用 SmartDNS 配置文件中配置的 OverSea 组的混合 DNS 服务器进行解析

4. 智能DNS配置```

server-name SmartDNS

bind :53 -force-https-soa

cache-size 131072

cache-persist yes

cache-file /tmp/smartdns.cache

cache-checkpoint-time 120

prefetch-domain yes

serve-expired yes

serve-expired-ttl 0

serve-expired-reply-ttl 10

serve-expired-prefetch-time 86400

force-qtype-SOA 65

dualstack-ip-selection-threshold 10 dualstack-ip-allow-force-AAAA no dualstack-ip-selection yes

rr-ttl 60 rr-ttl-min 1 rr-ttl-max 60

max-reply-ip-num 6

max-query-limit 0

response-mode fastest-response

log-level notice log-file /var/log/smartdns/smartdns.log log-size 128k log-num 2 log-file-mode 644

audit-enable yes audit-file /var/log/smartdns/smartdns-audit.log audit-size 128k audit-num 2

server-https https://1.1.1.1/dns-query -group GFW -exclude-default-group -proxy Proxy -http-host one.one.one.one

server-tls 223.5.5.5:853 -group China -exclude-default-group

server-tls 8.8.8.8:853 -group OverSea

expand-ptr-from-address yes

mdns-lookup yes

speed-check-mode ping,tcp:80,tcp:443

domain-set -name chinalist -file /etc/smartdns/chinalist.conf domain-set -name gfwlist -file /etc/smartdns/gfwlist.conf

nameserver /domain-set:chinalist/China nameserver /domain-set:gfwlist/GFW

domain-rules /domain-set:gfwlist/ -speed-check-mode none ```

参考文献[1]. https://www.right.com.cn/forum/thread-8301362-1-1.html

[2]. 基于RouterOS和Openwrt的IP地址列表分配 [中国列表]:https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/accelerated-domains.china.conf[GFW列表]:https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/gfw.txt