经过上个帖子的讨论,对初始版本进行了优化,这次给出完整的dns配置,可直接用于覆写。
版本 1(适用于最新版 mihomo 内核)
dns:
enable: true
ipv6: true #如网络环境不支持IPv6请设为false
enhanced-mode: fake-ip
fake-ip-range: 198.18.0.1/16
fake-ip-filter: #使用geosite域名集合以精简配置,也可使用规则集(ruleset)
- geosite:private
- geosite:category-ntp
use-hosts: false #如有特殊需求请设为true
use-system-hosts: false #如有特殊需求请设为true
nameserver:
- https://1.1.1.1/dns-query
- https://8.8.8.8/dns-query
proxy-server-nameserver:
- https://223.5.5.5/dns-query
- https://223.6.6.6/dns-query
direct-nameserver:
- https://223.5.5.5/dns-query
- https://223.6.6.6/dns-query
respect-rules: true
版本 2(不使用direct-nameserver,改用nameserver-policy)
dns:
enable: true
ipv6: true
enhanced-mode: fake-ip
fake-ip-range: 198.18.0.1/16
fake-ip-filter:
- geosite:private
- geosite:category-ntp
use-hosts: false
use-system-hosts: false
nameserver:
- https://1.1.1.1/dns-query
- https://8.8.8.8/dns-query
proxy-server-nameserver:
- https://223.5.5.5/dns-query
- https://223.6.6.6/dns-query
nameserver-policy:
#还可增加其他条目,让特定网址走特定DNS解析
geosite:cn: #也可使用规则集(ruleset)
- https://223.5.5.5/dns-query
- https://223.6.6.6/dns-query
respect-rules: true
版本 3(综合前面两个版本的完全体,一般人用不到)
dns:
enable: true
ipv6: true
enhanced-mode: fake-ip
fake-ip-range: 198.18.0.1/16
fake-ip-filter:
- geosite:private
- geosite:category-ntp
use-hosts: false
use-system-hosts: false
nameserver:
- https://1.1.1.1/dns-query
- https://8.8.8.8/dns-query
proxy-server-nameserver:
- https://223.5.5.5/dns-query
- https://223.6.6.6/dns-query
nameserver-policy:
geosite:cn:
- https://223.5.5.5/dns-query
- https://223.6.6.6/dns-query
respect-rules: true
direct-nameserver:
- https://223.5.5.5/dns-query
- https://223.6.6.6/dns-query
direct-nameserver-follow-policy: true #优先让nameserver-policy的设定生效