DNS仅适用于ip,但不适用于NS CentOS + Bind9


0

我对DNS很头疼。

让我说我的公共IP是1.2.3.4,我的本地IP是192.168.0.10,我的域是example.com我在虚拟机(Parallels Desktop for Mac)上运行CentOS,并为其保留了LAN卡,因此它获得了IP直接来自路由器。我将端口80,443,53转发到192.168.0.10。Mac OS和CentOs防火墙都处于关闭状态。

奇怪的是当我从我的另一台PC 输入 dig @ 1.2.3.4 example.com时我得到:

; <<>> DiG 9.8.3-P1 <<>> @1.2.3.4 example.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 16941
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 2
;; WARNING: recursion requested but not available

;; QUESTION SECTION:
;example.com.           IN  A

;; ANSWER SECTION:
example.com.        86400   IN  A   1.2.3.4

;; AUTHORITY SECTION:
example.com.        86400   IN  NS  ns2.example.com.
example.com.        86400   IN  NS  ns1.example.com.

;; ADDITIONAL SECTION:
ns1.example.com.        86400   IN  A   1.2.3.4
ns2.example.com.        86400   IN  A   1.2.3.4

;; Query time: 8 msec
;; SERVER: 1.2.3.4#53(1.2.3.4)
;; WHEN: Sat Nov  2 09:37:36 2013
;; MSG SIZE  rcvd: 109

但是当我输入:dig @ ns1.example.com example.com它会等待几秒钟并返回dig:无法获取'ns1.dsht.in'的地址:未找到

这是我的配置文件:/etc/named.conf

options {
    listen-on-v6 { none; };

    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";

    allow-query{ localhost; 192.168.0.0/24; };
    allow-transfer { localhost; 192.168.0.0/24; };
    recursion yes;

    dnssec-enable yes;
    dnssec-validation yes;
    dnssec-lookaside auto;

    bindkeys-file "/etc/named.iscdlv.key";
    managed-keys-directory "/var/named/dynamic";
};
logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};

# change all from here
view "internal" {
        match-clients {
                localhost;
                192.168.0.0/24;
        };
        zone "." IN {
                type hint;
                file "named.ca";
        };
        zone "example.com" IN {
                type master;
                file "example.com.zone";
                allow-update { none; };
        };
        zone "0.168.192.in-addr.arpa" IN {
                type master;
                file "0.168.192.in-addr.arpa";
                allow-update { none; };
        };
include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";
};
view "external" {
        match-clients { any; };
        allow-query { any; };
        recursion no;
        zone "example.com" IN {
                type master;
                file "example.com.zone";
                allow-update { none; };
        };
        zone "4.3.2.1.in-addr.arpa" IN {
                type master;
                file "4.3.2.1.in-addr.arpa";
                allow-update { none; };
        };
};

/var/named/exmaple.com.zone

$TTL 86400
@   IN  SOA     ns1.example.com. host.example.com. (
        2013042201  ;Serial
        3600        ;Refresh
        1800        ;Retry
        604800      ;Expire
        86400       ;Minimum TTL
)
; Specify our two nameservers
        IN  NS      ns1.example.com.
        IN  NS      ns2.example.com.
; Resolve nameserver hostnames to IP, replace with your two droplet IP addresses.
ns1     IN  A       1.2.3.4
ns2     IN  A       1.2.3.4

; Define hostname -> IP pairs which you wish to resolve
@       IN  A       1.2.3.4
        IN  A       1.2.3.4
www     IN  A       1.2.3.4
server2 IN  A   192.168.0.2
*       IN  A       1.2.3.4

/var/named/4.3.2.1.in-addr.arpa

$TTL 2d  ; 172800 seconds
$ORIGIN 4.3.2.1.IN-ADDR.ARPA.
@             IN      SOA   ns1.example.com. host.example.com. (
                              2013010304 ; serial number
                              3h         ; refresh
                              15m        ; update retry
                              3w         ; expiry
                              3h         ; nx = nxdomain ttl
                              )
              IN      NS      ns1.example.com.
              IN      NS      ns2.example.com.
              IN      PTR     example.com.
; etc

/var/named/0.168.192.in-addr.arpa

$TTL 2d  ; 172800 seconds
$ORIGIN 0.168.192.IN-ADDR.ARPA.
@             IN      SOA   ns1.example.com. host.example.com. (
                              2013010304 ; serial number
                              3h         ; refresh
                              15m        ; update retry
                              3w         ; expiry
                              3h         ; nx = nxdomain ttl
                              )
              IN      NS      ns1.example.com.
              IN      NS      ns2.example.com.
10            IN      PTR     example.com.
2         IN      PTR     server2.example.com
; etc

如果有人可以帮助我,我会很高兴的。

先感谢您


请从远程PC和NS提供/ etc / hosts和/etc/resolv.conf。你在ISP的CentOS盒子上有IPv6吗?
2013年

你的example.com是ns1.dsht.in吗?
2013年

您的CentOS机箱上有IPv6还是来自ISP的远程PC?
2013年
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.