因为会定期从 github 上下载 adblock 的 conf 文件到 conf-dir ,但是其中有三两条不想启用,用 sed 删除倒是可以,但路由器的存储写入很慢,所以尝试手动添加正常解析规则到自定义文件进行覆写,但 reload 或 restart 后,似乎没起作用,还是不能解析。
比如,similarweb.com 和 sentry.io 被下载文件中的 address 规则屏蔽了,我在0.conf
或mine.conf
加入正常解析规则后,重启 dnsmasq ,还是不能解析。0.conf
排在adblock-for-dnsmasq.conf
前面,mine.conf
排在adblock-for-dnsmasq.conf
后面。
root@OpenWrt:/etc/dnsmasq.d# grep similarweb *
0.conf:server=/similarweb.com/127.0.0.1#5311
adblock-for-dnsmasq.conf:address=/similarweb.com/
mine.conf:server=/similarweb.com/127.0.0.1#5311
root@OpenWrt:/etc/dnsmasq.d# grep sentry *
0.conf:server=/sentry.io/127.0.0.1#5311
adblock-for-dnsmasq.conf:#address=/sentry.io/
mine.conf:server=/sentry.io/127.0.0.1#5311
请教该如何进行覆写达成我的目标。
1
vsyf 2023-05-07 12:15:49 +08:00 via Android
/etc/dnsmasq 是你自己加的吗?默认都在 /tmp/dnsmasq.d
|
2
nowheretoseek OP @vsyf 我系统版本是 19.07.6 ,dnsmasq 版本是 2.8.0 ,/etc/dnsmasq.d 是写在 /etc/dnsmasq.conf 里面的,测试确认 /etc/dnsmasq.d 和 /tmp/dnsmasq.d 都被读取,因为如果里面有语法错误,都无法启动 dnsmasq 。
``` root@OpenWrt:/etc/dnsmasq.d# dnsmasq -v Dnsmasq version 2.80 Copyright (c) 2000-2018 Simon Kelley Compile time options: IPv6 GNU-getopt no-DBus no-i18n no-IDN DHCP no-DHCPv6 no-Lua TFTP no-conntrack no-ipset no-auth no-nettlehash no-DNSSEC no-ID loop-detect inotify dumpfile This software comes with ABSOLUTELY NO WARRANTY. Dnsmasq is free software, and you are welcome to redistribute it under the terms of the GNU General Public License, version 2 or 3. ``` ``` root@OpenWrt:/etc/dnsmasq.d# tail /etc/dnsmasq.conf #Example zeroconf #txt-record=_http._tcp.example.com,name=value,paper=A4 # Provide an alias for a "local" DNS name. Note that this _only_ works # for targets which are names from DHCP or /etc/hosts. Give host # "bert" another name, bertrand # The fields are <cname>,<target> #cname=bertand,bert srv-host=_vlmcs._tcp.lan,OpenWrt.lan,1688,0,100 conf-dir=/etc/dnsmasq.d ``` |