我正在尝试让两个名称服务器工作,但遇到了很大困难。我有两台服务器,一台是主服务器,一台是从服务器,主机名分别为 ns3.example.com 和 ns4.example.com。两个 IP 地址分别为:21.117.15.20 和 21.117.15.21。我使用的是 RedHat Linux。最后,我打开了端口 53,并在两台服务器上安装了 DNS 服务。
当我挖掘或对主机名进行 nslookup 时,它们似乎指向正确的 IP 地址。当我在 Web 浏览器中输入 IP 地址时,网站会为两个服务器加载。但主机名并未指向相应的 IP 地址。
以下是我对 /etc/named.conf 所做的更改,由 #***** 标识:
MASTER
======
options {
listen-on port 53 { 127.0.0.1; 21.117.15.20; }; #*****
# 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";
secroots-file "/var/named/data/named.secroots";
recursing-file "/var/named/data/named.recursing";
allow-query { localhost; 21.117.15.0/24; }; #*****
allow-transfer { localhost; 21.117.15.21; }; #*****
SLAVE
=====
options {
listen-on port 53 { 127.0.0.1; 21.117.15.21; }; #*****
# 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";
secroots-file "/var/named/data/named.secroots";
recursing-file "/var/named/data/named.recursing";
allow-query { localhost; 21.117.15.0/24; }; #*****
我还将其添加到 /etc/named.conf:
MASTER
======
zone "example.com" IN {
type master;
file "forward.example";
allow-update { none; };
};
zone "15.117.21.in-addr.arpa" IN {
type master;
file "reverse.example";
allow-update { none; };
};
SLAVE
=====
zone "example.com" IN {
type slave;
file "slaves/example.fwd.zone";
masters { 21.117.15.20; };
};
zone "15.117.21.in-addr.arpa" IN {
type slave;
file "slaves/example.rev.zone";
masters { 21.117.15.20; };
};
这是我的正向区域文件:
$ORIGIN example.com.
$TTL 86400
@ IN SOA ns3.example.com. support.example.com. (
2022070201 ;Serial
3600 ;Refresh
1800 ;Retry
604800 ;Expire
86400 ;Minimum TTL
)
;Name Server Information
@ IN NS ns3.example.com.
@ IN NS ns4.example.com.
;IP Address for Name Server
ns3 IN A 21.117.15.20
ns4 IN A 21.117.15.21
;A Record for the following Host name
www IN A 21.117.15.20
example.com. 3599 IN A 21.117.15.20
;CNAME Record
ftp IN CNAME www.example.com.
我没有包含邮件服务器,因为它在另一台服务器上。最后,这是我的反向区域文件:
$TTL 86400
@ IN SOA ns3.example.com. support.example.com. (
2022070201 ;Serial
3600 ;Refresh
1800 ;Retry
604800 ;Expire
86400 ;Minimum TTL
)
;Name Server Information
@ IN NS ns3.example.com.
@ IN NS ns4.example.com.
ns3 IN A 21.117.15.20
ns4 IN A 21.117.15.21
;Reverse lookup for Name Server
20 IN PTR ns3.example.com.
21 IN PTR ns4.example.com.
;PTR Record IP address to Hostname
20 IN PTR example.com.
20 IN PTR www.example.com.
我在其他服务器上使用了同样的代码,邮件服务器除外,运行正常。我已经这样做了好几天,但什么都没起作用。
如果有人能告诉我我做错了什么,我将不胜感激。