找回密码
 立即注册
img_loading
智能检测中

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888广告投放联系QQ68610888
查看: 3186|回复: 1

[openwrt(x86)] Mosdns V5 配置文件请大师指点指点

[复制链接]
发表于 2023-5-3 20:01 | 显示全部楼层 |阅读模式



mosdns V4 用了一段时间想升级到V5试试,感觉上手难度远高于V4 了,网上搬了一份配置文件,求大师帮忙看看,一直在报错。


log:
  level: debug
  file: "/tmp/mosdns.log"


# API 入口设置     
api:
  http: "0.0.0.0:9080" # 在该地址启动 api 接口。

# 从其他配置文件载入 plugins 插件设置。
# include 的插件会比本配置文件中的插件先初始化。
include: []

plugins:
  - tag: "geosite-cn"
    type: domain_set
    args:
      files:
        - "/etc/mosdns/direct-list.txt"
        - "/etc/mosdns/apple-cn.txt"
        - "/etc/mosdns/google-cn.txt"

  - tag: "geosite-nocn"
    type: domain_set
    args:
      files:
        - "/etc/mosdns/proxy-list.txt"
        - "/etc/mosdns/gfw.txt"

  - tag: "geoip-cn"
    type: ip_set
    args:
      files: "/etc/mosdns/CN-ip-cidr.txt"

  - tag: "force-cn"
    type: domain_set
    args:
      files: "/etc/mosdns/force-cn.txt"
      
  - tag: "force-nocn"
    type: domain_set
    args:
      files: "/etc/mosdns/force-nocn.txt"

  - tag: "hosts"
    type: hosts
    args:
      files: "/etc/mosdns/hosts.txt"

  - tag: "cache"
    type: "cache"
    args:
      size: 1024
      lazy_cache_ttl: 0
      dump_file: /etc/mosdns/cache.dump
      dump_interval: 600

  # 转发至本地服务器的插件
  - tag: "forward_local"
    type: forward
    args:
      concurrent: 2
      upstreams:
        - addr: "https://223.5.5.5/dns-query"
          idle_timeout: 86400
        - addr: "https://120.53.53.53/dns-query"
          idle_timeout: 86400



  # 转发至远程服务器的插件
  - tag: "forward_remote"
    type: forward
    args:
      concurrent: 2
      upstreams:
        - addr: "https://8.8.4.4/dns-query"
          idle_timeout: 86400
        - addr: "https://1.0.0.1/dns-query"
          idle_timeout: 86400


  - tag: "primary_forward"
    type: sequence
    args:
      - exec: $forward_local
      - exec: ttl 60-3600
      - matches:
        - "!resp_ip $geoip-cn"
        - "has_resp"
        exec: drop_resp

  - tag: "secondary_forward"
    type: sequence
    args:
      - exec: prefer_ipv4
      - exec: $forward_remote
      - matches:
        - rcode 2
        exec: $forward_local
      - exec: ttl 300-3600


  - tag: "final_forward"
    type: fallback
    args:
      primary: primary_forward
      secondary: secondary_forward
      threshold: 150
      always_standby: true

  - tag: main_sequence
    type: sequence
    args:
      - exec: $hosts
      - exec: query_summary hosts
      - matches: has_wanted_ans
        exec: accept

      - exec: $cache
      - exec: query_summary cache
      - matches: has_wanted_ans
        exec: accept

      - exec: query_summary qtype65
      - matches:
        - qtype 65
#         exec: black_hole 127.0.0.1 ::1 0.0.0.0
        exec: reject 0

      - matches:
        - qname $geosite-cn
        exec: $forward_local
      - exec: query_summary geosite-cn
      - matches: has_wanted_ans
        exec: accept

      - matches:
        - qname $force-cn
        exec: $forward_local
      - exec: query_summary force-cn
      - matches: has_wanted_ans
        exec: accept

      - matches:
        - qname $geosite-nocn
        exec: $forward_remote
      - exec: query_summary geosite-nocn
      - matches: has_wanted_ans
        exec: accept

      - matches:
        - qname $force-nocn
        exec: $forward_remote
      - exec: query_summary force-nocn
      - matches: has_wanted_ans
        exec: accept

      - exec: $final_forward

  - tag: "udp_server"
    type: "udp_server"
    args:
      entry: main_sequence
      listen: 0.0.0.0:5335

  - tag: "tcp_server"
    type: "tcp_server"
    args:
      entry: main_sequence
      listen: 0.0.0.0:5335



只谈技术、莫论政事!(点击见详情) | 恩山无线论坛欢迎您的来访,请互相尊重、友善交流,建议保持一颗平常心看待网友的评论,切勿过度反应。
发表于 2023-5-4 15:04 | 显示全部楼层
用LUCI版内置预设,或者用LUCI内自定义配置参数看着改 准能跑起来。
只谈技术、莫论政事!(点击见详情) | 恩山无线论坛欢迎您的来访,请互相尊重、友善交流,建议保持一颗平常心看待网友的评论,切勿过度反应。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

欢迎大家光临恩山无线论坛

只谈技术、莫论政事!切勿转播谣言!为了你也为了他人。
只谈技术、莫论政事!(点击见详情) 切记不要随意传播谣言,把自己的日子过安稳了就行,为了自己好也为了大家好。 恩山无线论坛欢迎您的来访,请互相尊重、友善交流,建议保持一颗平常心看待网友的评论,切勿过度反应。

查看 »

有疑问请添加管理员QQ86788181|手机版|小黑屋|Archiver|恩山无线论坛(常州市恩山计算机开发有限公司版权所有) ( 苏ICP备05084872号 )

GMT+8, 2025-5-31 17:57

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

| 江苏省互联网有害信息举报中心 举报信箱:js12377 | @jischina.com.cn 举报电话:025-88802724 本站不良内容举报信箱:68610888@qq.com

快速回复 返回顶部 返回列表