大网数据广告活动
服务器运维问答

Public AND Private Authoritative DNS Servers

· 52CE 我爱测

Re this setup: My Public Authoritative DNS Server at <public dns ip> : example.com. A <public webserver IP> foo.bar.example.com. TXT "Hello World" My Private Authoritative DNS Server at 192.168.0.2 : foo.bar.example.com. A "192.1…

问题原文

原帖链接 · StampyCode · CC BY-SA 3.0

Re this setup:

My Public Authoritative DNS Server at <public dns ip>:

example.com.            A    <public webserver IP>
foo.bar.example.com.   TXT   "Hello World"

My Private Authoritative DNS Server at 192.168.0.2:

foo.bar.example.com.    A    "192.168.0.1"
bar.bar.example.com.  CNAME  "foo.bar.example.com"

So I have two authoritative DNS servers, one in the public domain, one in the private domain. I need the public one to serve some TXT records, but not A records, for a specific subset of domains. The private one needs to serve A and CNAME records, for internal use only, but will not serve TXT records.

If my clients have their DNS server IPs in the wrong order (public,private), is the public authoritative DNS server response going to prevent the private DNS server from being queried?

Example:

Client has resolv.conf set to:

<public dns ip>
192.168.0.2

If they run nslookup foo.bar.example.com from their console, will it resolve to 192.168.0.1 or will the public DNS server tell them the name doesn't exist and to stop looking?

已采纳解答

原帖链接 · Patrick Mevzek · CC BY-SA 3.0

Resolving does not work like you think it does. When you have multiple lines in your resolv.conf they are used as a fallback: the system always use the first nameserver and only if it does not reply at all (which is different from replying that a name does not exist) it will then query the second one and so on. This applies per query basically.

You should setup things differently: have only one authoritative nameserver and if you use bind use its views mechanism to reply different things to different clients. Let the normal tree walking of the DNS by the clients to find it.

But otherwise in theory you are right: if the "public" server does reply and say NXDOMAIN, search will stop there. Except you are mixing authoritative and recursive (the ones in resolv.conf) which is a very bad habit. And you still have a setup that is more complicated than needed and it will give you problems later on.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-12-12)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。