zfl9 / chinadns-ng

chinadns 重构增强版,支持域名分流、ipset/nftset、UDP/TCP/DoT
GNU Affero General Public License v3.0
1.09k stars 184 forks source link

关于设置ipset-name4 ipset-name6 参数, #203

Closed yuanwb1984 closed 1 hour ago

yuanwb1984 commented 2 hours ago

之前有过类似报错,[ipset.c:708 test_res_ipset] error when querying ip: (2) No such file or directory 提过issues,设置成 ipset-name4 inet@global@chnroute ipset-name6 inet@global@chnroute6 这个就不报错了;后来配置文件丢了,直接抄了 ipset-name4 chnroute ipset-name6 chnroute6 就有上面的报错,不过貌似功能正常,就没在意;这两天重新改成 ipset-name4 inet@global@chnroute ipset-name6 inet@global@chnroute6 后如下报错 2024-09-20 03:54:27 E [ipset.c:549 init] mixing two backends is not allowed 2024-09-20 03:54:27 E [ipset.c:550 init] backend: ipset, setnames: inet@global@chnroute,inet@global@chnroute6 启动不了 写到命令行也一样 -4 inet@global@chnroute -6 inet@global@chnroute6

zfl9 commented 2 hours ago

mixing two backends is not allowed 就是问题所在:你混用了 ipset 和 nftset 后端。

集合名带 @ 字符的都是 nftset 后端,不带 @ 字符的是 ipset 后端。

你肯定还有其他 add-tagxxx-ip 或 group-ipset 配置,它们的后端不一样。

把完整配置发出来。


文档说明:

https://github.com/zfl9/chinadns-ng?tab=readme-ov-file#ipsetnftset-%E7%9B%B8%E5%85%B3%E8%AF%B4%E6%98%8E

yuanwb1984 commented 2 hours ago

感谢大佬

#/root/chinadns/chinadns-ng+wolfssl@mipsel-linux-musl@mips32+soft_float@fast+lto  --config /root/chinadns/chinadns.o.conf
# 监听地址和端口
bind-addr 0.0.0.0
bind-port 53535@udp
# 国内上游、可信上游
china-dns udp://221.179.155.177
china-dns tls://dns.alidns.com@223.5.5.5
china-dns tls://dot.pub@1.12.12.12
trust-dns tls://dns.google@8.8.4.4
trust-dns tls://dns10.quad9.net@149.112.112.10
trust-dns tls://1dot1dot1dot1.cloudflare-dns.com@1.1.1.1
# 域名列表,用于分流
chnlist-file /root/chinadns/chnlist.txt
gfwlist-file /root/chinadns/gfwlist.txt
#chnlist-first
# 收集 tag:chn、tag:gfw 域名的 IP
add-tagchn-ip chnip,chnip6   ###这里么
add-taggfw-ip gfwip,gfwip6   ###这两个抄的说明里的
# 测试 tag:none 域名的 IP
ipset-name4 inet@global@chnroute
ipset-name6 inet@global@chnroute6
# dns 缓存
cache 32768
cache-db /root/chinadns/cache.db
cache-stale 3600
cache-refresh 10
# verdict 缓存
verdict-cache 32768
verdict-cache-db /root/chinadns/verdict-cache.db

#noip-as-chnip
#reuse-port
#verbose
zfl9 commented 2 hours ago
# 收集 tag:chn、tag:gfw 域名的 IP
add-tagchn-ip chnip,chnip6   ###这里么
add-taggfw-ip gfwip,gfwip6   ###这两个抄的说明里的

# 测试 tag:none 域名的 IP
ipset-name4 inet@global@chnroute
ipset-name6 inet@global@chnroute6

很显然了,你如果不需要收集这些 IP 到 ipset/nftset 集合,那就把 add-tagxx-ip 注释掉。

另外,要清楚的是,ipset-name4、ipset-name6 集合需要预先导入(res/chnroute.ipset、res/chnroute.nftset),具体选 ipset 还是 nftset 看你需求,并且要与 chinadns.conf 的配置相对应。

yuanwb1984 commented 1 hour ago

感谢,已解决