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

How to append a domain to a PTR resolution?

· 52CE 我爱测

I have a bind9 server authoritative for my domain example.com . Forward resolution works, PTRs as well up to a point. I currently have 254.10.10 IN PTR srv. in my PTR zone for 10.x , which correctly resolves to root@srv ~# dig -x…

问题原文

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

I have a bind9 server authoritative for my domain example.com. Forward resolution works, PTRs as well up to a point.

I currently have

254.10.10   IN  PTR srv.

in my PTR zone for 10.x, which correctly resolves to

root@srv ~# dig -x 10.10.10.254
(...)
;; ANSWER SECTION:
254.10.10.10.in-addr.arpa. 604800 IN    PTR     srv.

I would like the resolution to be a FQDN and therefore replaced srv. by srv (removed the dot) in the configuration above, leading to a resolution of

root@srv ~# dig -x 10.10.10.254
(...)
;; ANSWER SECTION:
254.10.10.10.in-addr.arpa. 604800 IN    PTR     srv.10.in-addr.arpa.

How can I inform bind9 to resolve 10.10.10.254 into srv.example.com instead of srv.10.in-addr.arpa?

Note: I know that I could have

254.10.10   IN  PTR srv.example.com.

in my configuration. What I am looking for is how to set the default appended domain.

已采纳解答

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

As far as I know Bind will only append/substitute the implicit zone name 10.10.10.in-addr.arpa. or the explicit value of $ORIGIN (which usually would also be the zone name 10.10.10.in-addr.arpa.) when the trailing dot . is missing or when the @ shorthand is used.

You will need to use FQDN's and can't use any shorthand.

Or rather you can't expect to use different shorthands to be used for the resource record and it's value.

A typical reverse zone looks like:

$ORIGIN 1.0.10.in-addr.arpa.
$TTL 86400
@     IN     SOA    dns1.example.com.     hostmaster.example.com. (
                    2001062501 ; serial
                    21600      ; refresh after 6 hours
                    3600       ; retry after 1 hour
                    604800     ; expire after 1 week
                    86400 )    ; minimum TTL of 1 day

      IN     NS     dns1.example.com.
      IN     NS     dns2.example.com.

20    IN     PTR    alice.example.com.
21    IN     PTR    betty.example.com.
22    IN     PTR    charlie.example.com.
23    IN     PTR    doug.example.com.
24    IN     PTR    ernest.example.com.
25    IN     PTR    fanny.example.com.

What you can do is change/redefine $ORIGIN - the domain name that gets used/appended to unqualified records, such as those with the hostname and nothing more. You can even change $ORIGIN multiple times...

Although technically this should work as intended it is a very uncommon approach and likely to introduce human error and overall a Bad IdeaTM

The following means that you can't use 25 anymore but will need to use the FQDN 25.1.0.10.in-addr.arpa. as the RR, but you can use short hostnames for the actual hosts.

$ORIGIN 1.0.10.in-addr.arpa.
$TTL 86400
@     IN     SOA    dns1.example.com.     hostmaster.example.com. (
                    2001062501 ; serial
                    21600      ; refresh after 6 hours
                    3600       ; retry after 1 hour
                    604800     ; expire after 1 week
                    86400 )    ; minimum TTL of 1 day

      IN     NS     dns1.example.com.
      IN     NS     dns2.example.com.

$ORIGIN example.com.
20.1.0.10.in-addr.arpa.    IN     PTR    alice
21.1.0.10.in-addr.arpa.    IN     PTR    betty
22.1.0.10.in-addr.arpa.    IN     PTR    charlie
23.1.0.10.in-addr.arpa.    IN     PTR    doug
24.1.0.10.in-addr.arpa.    IN     PTR    ernest
25.1.0.10.in-addr.arpa.    IN     PTR    fanny

$ORIGIN example.co.uk.
26.1.0.10.in-addr.arpa.    IN     PTR    geoff
27.1.0.10.in-addr.arpa.    IN     PTR    honey

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

资料来源与适用范围

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

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

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