/etc/resolv.conf

/etc/resolv.conf

我正在用 BIND 9 构建循环 DNS。我以为我已经成功了,因为当我输入时nslookup stack.gearon.com,返回了几个 IP,如下所示:

Server:         10.1.2.210
Address:        10.1.2.210#53

Name:   stack.gearon.com
Address: 10.1.2.213
Name:   stack.gearon.com
Address: 10.1.2.210
Name:   stack.gearon.com
Address: 10.1.2.212

但是,当我 ping 时stack.gearon.com,返回的 IP 在该节点上始终相同。
让我用一个例子来说明这一点。假设我有 5 个节点 A、B、C、D 和 E。机器 C、D 和 E 是服务器,如果我stack.gearon.com在这些服务器机器上 ping,它们自己的 IP 将返回并且始终相同。如果我stack.gearon.com从客户端机器 A 或 B ping,返回的 IP 是服务器的 IP 之一,但也是固定的。

我的配置如下。

/etc/resolv.conf

# Generated by NetworkManager
nameserver 10.0.2.210

/etc/named.conf

options {
        listen-on port 53 { any; };
        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     { any; };

        /*
         - If you are building an AUTHORITATIVE DNS server, do NOT enable recursion.
         - If you are building a RECURSIVE (caching) DNS server, you need to enable
           recursion.
         - If your recursive DNS server has a public IP address, you MUST enable access
           control to limit queries to your legitimate users. Failing to do so will
           cause your server to become part of large scale DNS amplification
           attacks. Implementing BCP38 within your network would greatly
           reduce such attack surface
        */
        recursion no;

        dnssec-enable yes;
        dnssec-validation yes;

        /* Path to ISC DLV key */
        bindkeys-file "/etc/named.iscdlv.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";
};

zone "stack.com" IN {
  type master;
  file "stack.com.db";
  allow-update{none;};
};

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

/var/named/stack.com.db

$TTL 1D
@ IN SOA primary.gearon.com. root.stack.com.(
;2014112511 ;Serial
0 ;Serial
1D ;Refresh
1H ;Retry
1W ;Expire
3H ;Minimum TTL
)
;; 1st DNS
@ IN    NS      primary.gearon.com.
        A       10.1.2.210
;; Host List
primary         IN A 10.1.2.210
;; Enable round-robin here
stack           IN A 10.1.2.210
                IN A 10.1.2.212
                IN A 10.1.2.213

如果您需要更多详细信息,请告诉我,提前感谢您的帮助。欢迎任何评论。

答案1

对于遇到同样问题的人。我通过重新启动网络ifdownifup刷新ARP表格解决了该问题。

相关内容