hzqim
V2EX  ›  问与答

Dnsmasq 指定域名用 DNS 解析时,域名前面带. 和不带点有区别吗?

  •  
  •   hzqim · Feb 8, 2015 · 7026 views
    This topic created in 4133 days ago, the information mentioned may be changed or developed.
    比如
    server=/google.com/127.0.0.1#5353 和
    server=/.google.com/127.0.0.1#5353 有什么区别?
    第二个写法不包括 http://google.com?

    更有这样写的
    server=/*.google.com/127.0.0.1#5353 有什么区别?是画蛇添足吗?

    谢谢解答。
    8 replies    2015-04-22 17:13:09 +08:00
    KyonLi
        1
    KyonLi  
       Feb 8, 2015 via Android   ❤️ 1
    不带点的可以把形如 hehegoogle.com 的包括进去,带点的只能包括形如 hehe.google.com
    LazyZhu
        2
    LazyZhu  
       Feb 8, 2015 via Android   ❤️ 1
    man 没有加点的说明,不加的话匹配所有下级域名
    More specific domains take precendence over less specific domains, so: --server=/google.com/1.2.3.4 --server=/www.google.com/2.3.4.5 will send queries for *.google.com to 1.2.3.4, except *www.google.com, which will go to 2.3.4.5
    真相要看源代码才能知道
    aa65535
        3
    aa65535  
       Feb 8, 2015   ❤️ 1
    看看代码就知道了

    server=/google.com/127.0.0.1#5353 和 server=/.google.com/127.0.0.1#5353
    是一样的效果,dnsmasq 会忽略前面的点(不管有多少个),匹配域名为「*.google.com」

    server=/*.google.com/127.0.0.1#5353 是错误的写法,因为dnsmasq会将「*.google.com」当做一个域名,但是根本就没有这个域名。

    同样适用于 --local --address --rebind-domain-ok 这几个参数的处理。
    LazyZhu
        4
    LazyZhu  
       Feb 8, 2015 via Android   ❤️ 1
    注意
    一级域名匹配*.google.com,
    二级域名匹配*www.google.com,
    LazyZhu
        5
    LazyZhu  
       Feb 8, 2015 via Android   ❤️ 1
    *.google.com会作为字符串,匹配*\*.google.com
    LazyZhu
        6
    LazyZhu  
       Feb 8, 2015 via Android   ❤️ 1
    aa65535
        7
    aa65535  
       Feb 8, 2015   ❤️ 1
    @LazyZhu 意思就是dnsmasq会将「*.google.com」 这个字符串作为一个特定域名,但是现实中是没有这个域名的,所以实现并不是预期。

    那个 fork 好像是提升 ipset 性能的,希望可以提交 patch 给作者。
    Samloya
        8
    Samloya  
       Apr 22, 2015
    @aa65535 你好 请问下你的优化版dnsmasq –min-cache-ttl 参数 最大可以设定到多少的?
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5551 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 93c8b4a0 · 43ms · UTC 07:20 · PVG 15:20 · LAX 00:20 · JFK 03:20
    ♥ Do have faith in what you're doing.