服务器找不到 vm3:NXDOMAIN

服务器找不到 vm3:NXDOMAIN

我在查询不同网络 192.168.56.0/24 上的名称服务器以获取包含主机、vm1、vm2 和 vm3 的记录时遇到问题。我不明白为什么。无论如何有人可以解释发生了什么事吗?

法拉利

/etc/resolv.conf

# Generated by NetworkManager
search luxury.auto.ops
nameserver 172.45.20.3
nameserver 192.168.56.2

/etc/主机

127.0.0.1   localhost localhost.localdomain localhost4      localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
172.45.20.1 host
172.45.20.1 host host.oadese.ops

/etc/named.conf

options {
    directory       "/var/named";
    allow-query     { 127.0.0.1; 172.45.20.0/24; 192.168.56.2;};
    forwarders { 192.168.56.1; };
};

zone "localhost"{
    type master;
    file "named.localhost";
};

zone "luxury.auto.ops."{
    type master;
    file "mydb-for-luxury-auto-ops";
    allow-transfer { 172.45.20.4; };
};

zone "20.45.172.in-addr.arpa." {
    type master;
    file "mydb-for-172.45.20";
};

vi /etc/sysconfig/network-scripts/ifcfg-eth0

TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
NAME=eth0
UUID=78aa1a9b-0607-492a-b7dc-55d6f76f05d5
DEVICE=eth0
ONBOOT=yes
DOMAIN=luxury.auto.ops
IPADDR=172.45.20.3
NETMASK=255.255.255.0
HWADDR=52:54:00:8d:9e:93
GATEWAY=172.45.20.1
DNS1=172.45.20.3
DNS2=192.168.56.2

虚拟机1 192.168.56.2

/etc/named.conf

options {
        directory       "/var/named";
        allow-query     { 127.0.0.1; 192.168.56.0/24; 172.45.20.0/24;};
        forwarders { 192.168.56.1; };
};

zone "localhost"{
        type master;
        file "named.localhost";
};

zone "oadese.ops" {
        type master;
        file "mydb-for-oadese-ops";
};

zone "56.168.192.in-addr.arpa." {
        type master;
        file "mydb-for-192.168.56";
};

/var/named/mydb-for-oadese-ops

$TTL    3D
@       IN      SOA     vm1.oadese.ops.      hostmaster.oadese.ops.(
                2016010301       ; Serial
                8H      ; Refresh
                2H      ; Retry
                1W      ; Expire
                1D      ; Negative Cache TTL
);
@       IN      NS      vm1.oadese.ops.
vm1     IN      A       192.168.56.2
vm2     IN      A       192.168.56.3
vm3     IN      A       192.168.56.4
host    IN      A       192.168.56.1

[root@ferrari ~]# nslookup vm1
Server:     192.168.56.2
Address:    192.168.56.2#53

Non-authoritative answer:
Name:   vm1
Address: 192.168.56.2

[root@ferrari ~]# nslookup vm2
Server:     192.168.56.2
Address:    192.168.56.2#53

Non-authoritative answer:
Name:   vm2
Address: 192.168.56.3

[root@ferrari ~]# nslookup vm3
Server:     192.168.56.2
Address:    192.168.56.2#53

Non-authoritative answer:
Name:   vm3
Address: 192.168.56.4

[root@ferrari ~]# nslookup host
Server:     192.168.56.2
Address:    192.168.56.2#53

Non-authoritative answer:
Name:   host
Address: 192.168.56.1

[root@ferrari ~]# nslookup ferrari
Server:     172.45.20.3
Address:    172.45.20.3#53

Name:   ferrari.luxury.auto.ops
Address: 172.45.20.3

[root@ferrari ~]# host vm1
Host vm1 not found: 3(NXDOMAIN)
[root@ferrari ~]# host vm2
Host vm2 not found: 3(NXDOMAIN)
[root@ferrari ~]# host vm3
Host vm3 not found: 3(NXDOMAIN)
[root@ferrari ~]# host host
[root@ferrari ~]# host ferrari
ferrari.luxury.auto.ops has address 172.45.20.3

Mar 18 10:43:50 ferrari named[2242]: error (connection refused) resolving 'vm1.oadese.ops/A/IN': 192.168.56.2#53
Mar 18 10:43:50 ferrari named[2242]: error (network unreachable) resolving 'vm1.oadese.ops/A/IN': 2001:500:2f::f#53
Mar 18 10:43:50 ferrari named[2242]: error (connection refused) resolving './NS/IN': 192.168.56.2#53
Mar 18 10:43:50 ferrari named[2242]: error (network unreachable) resolving './NS/IN': 2001:500:2f::f#53
Mar 18 10:43:51 ferrari named[2242]: error (connection refused) resolving 'vm1/A/IN': 192.168.56.2#53
Mar 18 10:43:51 ferrari named[2242]: error (network unreachable) resolving 'vm1/A/IN': 2001:500:1::803f:235#53
Mar 18 10:43:51 ferrari named[2242]: error (network unreachable) resolving 'vm1/A/IN': 2001:7fe::53#53

答案1

在第二个名称服务器中,您为服务器本身定义了一个转发器。对于你的架构应该是:

forwarders { 172.45.20.3 };

还有search指令的问题/etc/resolv.conf;如果您有两个域名,但只有一个域名。为了让解析器尝试将域添加到两个域的查询中,您必须使用:

search luxury.auto.ops. oadese.ops.

顺便说一下,不要忘记点。

此外,您正在配置虚拟机以使用不同的视图询问不同的名称服务器。 DNS 解析器不是这样工作的,只有当第一个名称服务器出现故障时才会使用第二个名称服务器。如果第一个启动并说它不知道 DNS 地址,则不会查询第二个。

如果您想在不同的名称服务器中拥有独立的 DNS 域,请将另一台服务器的域设置为从属服务器,并将其设置为另一台服务器的主控;另一种更简洁的选择是让其中一台服务器成为两个域的主服务器,另一台服务器成为从服务器。

相关内容