Skip to content

DNS-Distribution-with-SmartDNS

0. Brief

Mikrotik's DNS always a confused problem. We are going to introduce SmartDNS to overcome it.

1. Setup SmartDNS Container on Mikrotik

A previous post expalined how to do this.

2. SmartDNS Config

In this section, we are going to demonstrate the DNS group and flow.

3. DNS Group & Request

DNS records will be separate to 3 groups: - China List - resolve with public DNS server configured CHINA group in SmartDNS config file - GFW List - resolve with foreign DNS server configured GFW group in SmartDNS config file - Others - resolve with mixed DNS server configured OverSea group in SmartDNS config file

4. SmartDNS Config

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

<!-- proxy-server socks5://127.0.0.1:1080 -name Proxy -->

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

REF

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