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

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

  •  
  •   nowheretoseek · 354 天前 · 918 次点击
    这是一个创建于 354 天前的主题,其中的信息可能已经有所发展或是发生改变。

    因为会定期从 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  
       354 天前 via Android
    /etc/dnsmasq 是你自己加的吗?默认都在 /tmp/dnsmasq.d
    nowheretoseek
        2
    nowheretoseek  
    OP
       354 天前
    @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   ·   我们的愿景   ·   实用小工具   ·   1602 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 17:01 · PVG 01:01 · LAX 10:01 · JFK 13:01
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.