sbwml / luci-app-mosdns

一个 DNS 转发器 - OpenWrt 🎁 MosDNS v5 is Ready! 🎉
https://github.com/IrineSistiana/mosdns
1.1k stars 214 forks source link

使用自定义配置无法启动 #189

Closed chuwza closed 6 months ago

chuwza commented 7 months ago

我是参照 (https://github.com/IrineSistiana/mosdns/discussions/605) 的配置文件,在/etc/mosdns放入了china_ip_list.txt、direct-list.txt、proxy-list.txt、reject-list.txt文件,创建了空白hosts文件,但是无法启动。

OpenWrt使用默认配置是能启动的,说明自定义配置文件有问题。但是同样的配置文件,在Windows(更改对应路径)和WSL2 Docker Desktop(几乎不用更改他的配置)上就能启动,很奇怪……现在临时用NAS的Docker顶替着,但是NAS是会关机的,最好还是能在OpenWrt上运行,希望大佬指点一下

还有,目前通过ssh使用/etc/init.d/mosdns restart命令重启时,就会报错 Command failed: Not found /etc/rc.common: line 204: can't create : nonexistent directory

下面就是我的自定义配置

log: level: info

plugins:

缓存

sbwml commented 7 months ago

看不懂

发自我的iPhone

在 2024年1月28日,16:34,chuwza @.***> 写道:

 我是参照(https://github.com/IrineSistiana/mosdns/discussions/605)的配置文件,在/etc/mosdns放入了china_ip_list.txt、direct-list.txt、proxy-list.txt、reject-list.txt文件,创建了空白hosts文件,但是无法启动,同样的配置(更改对应路径),在Windows上就能启动 这是自定义配置 log: level: info

plugins:

缓存

tag: cache type: cache args: size: 10240 lazy_cache_ttl: 86400 重定向域名

tag: redirect type: redirect args: rules:

  • www.cnbeta.com www.cnbeta.com.cdn.cloudflare.net 转发至国内DNS,并发查询

tag: forward_local type: forward args: concurrent: 2 upstreams:

  • addr: udp://119.29.29.29
  • addr: udp://223.5.5.5 转发至国外DNS,并发查询

tag: forward_remote type: forward args: concurrent: 2 upstreams:

  • addr: tcp://8.8.8.8
  • addr: tcp://1.1.1.1 自定义hosts

tag: hosts type: hosts args: files:

  • "/etc/mosdns/hosts" china ip和自己的vps ip

tag: local_ip type: ip_set args: files:

  • /etc/mosdns/china_ip_list.txt fallback的primary服务器,返回非国内ip则drop_resp

tag: local_sequence type: sequence args: exec: $forward_local matches: "!resp_ip $local_ip" exec: accept exec: drop_resp fallback的secondary服务器,返回非国内ip则添加至ipset,返回国内ip只接受不会添加ipset

tag: remote_sequence type: sequence args: exec: $forward_remote matches: "!resp_ip $local_ip" exec: ipset gfwlist,inet,24 exec: accept fallback sequence

tag: fallback type: fallback args: primary: local_sequence secondary: remote_sequence threshold: 500 always_standby: true gfwlist解析出的ip添加至ipset,添加前先判断是否为国内ip或内网ip

tag: gfw-list type: sequence args: exec: ttl 300-3600 matches: "!resp_ip $local_ip" exec: ipset gfwlist,inet,24 exec: accept 主运行序列

tag: main_sequence type: sequence args:

exec: $hosts

matches: has_resp exec: accept

matches: qtype 65 exec: reject 3

matches: qname &/etc/mosdns/reject-list.txt exec: reject

exec: prefer_ipv4

exec: $redirect

动态域名跳过缓存

matches: "!qname 00006801.com" exec: $cache

matches: has_resp exec: accept

matches: qname &/etc/mosdns/direct-list.txt exec: $forward_local

matches: has_resp exec: accept

matches: qname &/etc/mosdns/proxy-list.txt exec: $forward_remote

matches: has_resp exec: goto gfw-list

exec: $fallback

启动监听服务

tag: udp_server type: udp_server args: entry: main_sequence listen: :5335

tag: tcp_server type: tcp_server args: entry: main_sequence listen: :5335

ssh使用/etc/init.d/mosdns restart命令,报错Command failed: Not found /etc/rc.common: line 204: can't create : nonexistent directory

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.