openwrt 的 dnsmasq, conf-dir 下配置文件的覆写规则是什么 - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
OpenWrt 是一个专门面向嵌入式设备的 Linux 发行版。你可以将 OpenWrt 支持的型号的嵌入式设备,比如各种路由器上的系统,换成一个有更多可能性可以折腾的 Linux 系统。
OpenWrt 官方网站
nowheretoseek
V2EX    OpenWrt

openwrt 的 dnsmasq, conf-dir 下配置文件的覆写规则是什么

  •  
  •   nowheretoseek 2023-05-07 11:14:05 +08:00 1538 次点击
    这是一个创建于 939 天前的主题,其中的信息可能已经有所发展或是发生改变。

    因为会定期从 github 上下载 adblock 的 conf 文件到 conf-dir ,但是其中有三两条不想启用,用 sed 删除倒是可以,但路由器的存储写入很慢,所以尝试手动添加正常解析规则到自定义文件进行覆写,但 reload 或 restart 后,似乎没起作用,还是不能解析。

    比如,similarweb.comsentry.io 被下载文件中的 address 规则屏蔽了,我在0.confmine.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 

    请教该如何进行覆写达成我的目标。

    vsyf
        1
    vsyf  
       2023-05-07 12:15:49 +08:00 via Android
    /etc/dnsmasq 是你自己加的吗?默认都在 /tmp/dnsmasq.d
    nowheretoseek
        2
    nowheretoseek  
    OP
       2023-05-07 13:53:42 +08:00
    @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
    ```
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     2359 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 20ms UTC 15:46 PVG 23:46 LAX 07:46 JFK 10:46
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86