【问题标题】:resolve Non-exist Domain Name to local IP using dnsmasq使用 dnsmasq 将不存在的域名解析为本地 IP
【发布时间】:2017-06-03 23:59:44
【问题描述】:

当用户查询一个不存在的域名(例如http://www.not-exist-website.com/)时,是否可以使用dnsmasq将其解析为本地IP?

另外一种情况,当dnsmasq无法解析请求域名时(如中国http://www.google.com/),是否可以使用dnsmasq解析到本地IP?

PS:

不知道在实现上与上述情况是否有区别。

我正在开发使用 dnsmasq 作为本地 DNS 服务器的 OpenWRT 路由器。

本地 IP 运行托管本地主页的 nginx 服务器。

【问题讨论】:

    标签: redirect nginx dns openwrt dnsmasq


    【解决方案1】:

    添加到 /etc/hosts

    192.168.0.10 www.nonexistentdomain.com www
    

    将以下内容添加到 /etc/dnsmasq.conf

    server=8.8.8.8
    server=8.8.4.4
    domain=nonexistentdomain.com
    

    您可以通过添加以下行使 dnsmasq 对给定域具有权威性

    domain=existingdomain.com
    

    请注意,上述域的 dns 解析仅限于本地条目。

    您可以将现有域的条目添加到 /etc/hosts

    192.168.1.10 www.existingdomain.com
    

    【讨论】:

      猜你喜欢
      • 2010-09-05
      • 1970-01-01
      • 1970-01-01
      • 2013-07-09
      • 2014-10-13
      • 2021-03-22
      • 2011-03-12
      • 2015-03-06
      • 2021-10-08
      相关资源
      最近更新 更多