Centos7

DNS,名稱伺服器和域在同一個專用 IP - 名稱伺服器的 PTR 記錄?

  • April 6, 2020

我的專屬IP:xx.xxx.xxx.59

我的 IP 有 2 個 PTR 記錄(ns1 和域)是否正確地做到了這一點?

反向 DNS 區域文件 59.xxx.xxx.xx.in-addr.arpa.db

$TTL 86400
@       IN      SOA     ns1.example.com. admin.example.com. (
        2020040201     ; Serial
              3600     ; Refresh
              7200     ; Retry
           1209600     ; Expire
             86400 )   ; Negative Cache TTL

@       IN      NS              ns1.example.com.
@       IN      NS              ns2.example.com.

;Reverse lookup for Name Server
59      IN      PTR             ns1.example.com.

;PTR Record IP address to HostName
59      IN      PTR             example.com.

而我的實際 DNS 區域:

$TTL 86400
@       IN      SOA     ns1.example.com. admin.example.com. (
        2020040201     ; Serial
              3600     ; Refresh
              7200     ; Retry
           1209600     ; Expire
             86400 )   ; Negative Cache TTL

; name servers - NS records
@       IN      NS              ns1.example.com.
@       IN      NS              ns2.example.com.

; name servers - A records
ns1.example.com.     IN      A               xx.xxx.xxx.59
ns2.example.com.     IN      A               xx.xxx.xxx.59

; All other A records
@       IN      A               xx.xxx.xxx.59
mail    IN      A               xx.xxx.xxx.59
www     IN      A               xx.xxx.xxx.59
@       IN      MX      10      mail.example.com.
@       IN      TXT             "v=spf1 a mx ip4:xx.xxx.xxx.59 ?all"

還有我的 /etc/named.conf

options {
       listen-on port 53 { 127.0.0.1; xx.xxx.xxx.59; };
#       listen-on-v6 port 53 { ::1; };
       directory       "/var/named";
       dump-file       "/var/named/data/cache_dump.db";
       statistics-file "/var/named/data/named_stats.txt";
       memstatistics-file "/var/named/data/named_mem_stats.txt";
       recursing-file  "/var/named/data/named.recursing";
       secroots-file   "/var/named/data/named.secroots";
       allow-query     { localhost; xx.xxx.xxx.0/24};

       recursion no;

       dnssec-enable yes;
       dnssec-validation yes;
       bindkeys-file "/etc/named.root.key";
       managed-keys-directory "/var/named/dynamic";
       pid-file "/run/named/named.pid";
       session-keyfile "/run/named/session.key";
};

logging {
       channel default_debug {
               file "data/named.run";
               severity dynamic;
       };
};

zone "." IN {
       type hint;
       file "named.ca";
};

include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";

zone "example.com" {type master; file "/var/named/example.com.db";};
zone "59.xxx.xxx.xx.in-addr.arpa" {type master; file "/var/named/59.xxx.xxx.xx.in-addr.arpa.db";};

DNS 伺服器不需要反向 DNS 驗證,因此 PTR 記錄上的值對它們來說並不重要。如果您的 IP 提供商沒有為您的 IP 地址塊委派 PTR 區域,您將不需要配置 PTR 記錄。

您的提供商可以使用 CNAME 記錄將 PTR 記錄請求重定向到您的域。在這種情況下,您的域配置中需要 PTR 記錄。通常不這樣做。

如果您確實需要特定的 PTR 記錄,您的 IP 提供商可能會提供您可以使用的請求機制。通常,只有需要 rDNS 有效性的郵件伺服器才需要這樣做。(不幸的是,許多合法的郵件伺服器都有無效的 PTR 記錄。)

少於 /24 網路的 IP 委託需要使用 CNAME 記錄將 PTR 記錄委託給 IP 持有者。這在描述無類 ip-addr.arpa 委託 的RFC 2317中有記錄。

引用自:https://serverfault.com/questions/1010607