美文网首页
2019-10-23 基于 DNS 的访问优化

2019-10-23 基于 DNS 的访问优化

作者: simonkuang | 来源:发表于2019-10-23 12:23 被阅读0次

    发现最近基于 DNS 做访问优化的国际大企业越来越多。

    阿里云,亚麻,azure,除了云服务上,甚至苹果这样做产品的也是。

    基于 DNS 做访问优化的一个特点就是,从全球各地不同 DNS 解析同一个域名,会得到不尽相同的 IP,引导客户端去连接最近的服务器。

    之前用 CoreDNS 做防毒的方案,显然没有考虑到这一点。所以在这里补充一下更新后的配置。更新后的配置考虑到几个常用的服务,这几个服务会走国内的 DNS 服务器做解析,以便获取到厂商在国内的服务器 IP,加快访问的速度。

    aliyun.com apple.com github.com fastly.net githubusercontent.com binary.com amazonaws.com azk9s.com {
      forward . 223.5.5.5 119.29.29.29 114.114.114.114 223.6.6.6 {
        max_fails 3
        expire 5s
        health_check 3s
        policy sequential
      }
    }
    
    company.com {
      hosts /etc/hosts {
        fallthrough
      }
    
      forward . 192.168.1.103 119.29.29.29 114.114.114.114 {
        max_fails 3
        expire 5s
        health_check 3s
        policy sequential
      }
    }
    
    # ---- global conf
    
    .:53 {
      hosts /etc/hosts {
        #127.0.0.1  a.com
        fallthrough
      }
    
      forward . tls://8.8.8.8 tls://9.9.9.9 tls://1.1.1.1 119.29.29.29 223.5.5.5 {
        force_tcp
        max_fails 3
        expire 10s
        health_check 5s
        policy sequential
        except company.com
      }
    
      prometheus
      cache 120
      reload 6s
      log
      errors
    }
    

    相关文章

      网友评论

          本文标题:2019-10-23 基于 DNS 的访问优化

          本文链接:https://www.haomeiwen.com/subject/oaahvctx.html