AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 816740
Accepted
Eric Duncan
Eric Duncan
Asked: 2016-11-24 13:37:20 +0800 CST2016-11-24 13:37:20 +0800 CST 2016-11-24 13:37:20 +0800 CST

DNSMasq 无法解析公共域名上的不可路由 IP

  • 772

我们的 DNSMasq 无法解析来自指定私有 IP 地址的公共域的 A、CNAME 或别名记录。

例如:

$ nslookup
> server 172.16.1.1
Default server: 172.16.1.1
Address: 172.16.1.1#53

> www.work-domain.com
Server:         172.16.1.1
Address:        172.16.1.1#53

Non-authoritative answer:
Name:   www.work-domain.com
Address: 55.77.XXX.XXX

> server-b.work-domain.com
Server:         172.16.1.1
Address:        172.16.1.1#53

Non-authoritative answer:
*** Can't find server-b.work-domain.com: No answer

但是切换到公共 DNS 工作正常:

$ nslookup
> server 8.8.8.8
Default server: 8.8.8.8
Address: 8.8.8.8#53

> www.work-domain.com
Server:         8.8.8.8
Address:        8.8.8.8#53

Non-authoritative answer:
Name:   www.work-domain.com
Address: 55.77.XXX.XXX

> server-b.work-domain.com
Server:         8.8.8.8
Address:        8.8.8.8#53

Non-authoritative answer:
Name:   server-b.work-domain.com
Address: 10.1.XXX.XXX

请注意,该server-b.work-domain.com条目正确解析为不可路由的 IP 地址10.1.XXX.XXX?那是我的问题,它不适用于本地网络上的本地 dnsmasq。

这些 IP 地址是我们 Amazon AWS 私有子网的一部分,我们有 VPN 可以访问它们。

这与在多个子网的 4 个不同公共域注册的所有 200 多台服务器都是 100% 一致的,所有服务器都使用私有不可路由 IP 地址。但是,使用公共可路由 IP 地址的所有其他记录都可以正常工作,在同一个域上!

其他一切都 100% 使用本地 dnsmasq 正常工作:

  • 解析所有公共域
  • 解析公共 IP 的所有 IP 反向查找
  • 解析所有内部私有域和主机
  • 解决私有 IP 和 DHCP 租约的所有 IP 反向查找

它只是使用私有不可路由 IP 的公共记录。

我一定错过了一些无法中断阅读 MAN 页面的选项。

版本:

Dnsmasq version 2.73 # (part of AdvancedTomato)

配置(删除敏感条目,留下示例):

# dhcp-option=lan,3,172.16.1.1
cache-size=8192
log-async=25
strict-order
#local=/lan/
#domain=lan,172.16.1.0/24,local
expand-hosts
domain-needed

# network devices
address=/router-gateway.lan/172.16.1.1
address=/router-office.lane/172.16.1.2
...and so on x 70

# arpa entries
ptr-record=1.1.16.172.in-addr.arpa,"router-gateway.lan"
ptr-record=2.1.16.172.in-addr.arpa,"router-office.lan"
...and so on

AdvancedTomato 上的本地解析吐出:

# cat /etc/resolv.conf
nameserver 127.0.0.1

# cat /etc/resolv.dnsmasq
nameserver 8.8.8.8
nameserver 8.8.4.4

再次.. 一切都与 Windows、OSX 和 Linux 客户端上的本地 LAN 完美配合,解析公共和内部域和 LAN,甚至没有域后缀的主机(server-xyz -> 解析为 server-xyz.lan)。

它只是使用不可路由 IP 的公共域。

dnsmasq
  • 1 1 个回答
  • 2624 Views

1 个回答

  • Voted
  1. Best Answer
    Eric Duncan
    2016-11-24T14:02:08+08:002016-11-24T14:02:08+08:00

    @HåkanLindqvist 的评论为我指明了正确的方向。只要他回答,我就会将他标记为答案。直到那时...

    他的评论向我指出了rebinddnsmasq 的选项:

    --stop-dns-rebind
        Reject (and log) addresses from upstream nameservers which are in the private IP ranges. This blocks an attack where a browser behind a firewall is used to probe machines on the local network.
    --rebind-localhost-ok
        Exempt 127.0.0.0/8 from rebinding checks. This address range is returned by realtime black hole servers, so blocking it may disable these services.
    --rebind-domain-ok=[<domain>]|[[/<domain>/[<domain>/]
        Do not detect and block dns-rebind on queries to these domains. The argument may be either a single domain, or multiple domains surrounded by '/', like the --server syntax, eg. --rebind-domain-ok=/domain1/domain2/domain3/
    

    有了这些知识,我看到这实际上是正在发生的事情:

    # cat /tmp/etc/dnsmasq.conf
    ...
    rebind-localhost-ok
    ...
    

    然后我将以下内容添加到我的 dnsmasq.conf 以修复它:

    rebind-domain-ok=/work-domain1.com/work-domain2.com/
    

    呜呼!有用!

    我的 dnsmasq 必须使用默认的严格选项进行编译。

    • 2

相关问题

  • 用于 PXE 引导的 TFTP 和 DHCP 单独服务器

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve