首页 > 代码库 > DNS服务器搭建笔记
DNS服务器搭建笔记
DNS在linux服务器上的服务名是named,而named服务依赖软件bind。
环境:
系统版本:VBOX虚拟机centos6.0。
本机内网IP 192.168.2.198。
一、安装软件bind。
1.显示bind相关的软件包。
[root@localhost ~]# yum list bind*
bind.i686
bind-chroot.i686
bind-devel.i686
bind-dyndb-ldap.i686
bind-libs.i686
bind-sdb.i686
bind-utils.i686
2.安装必要包。主要安装三个软件包,其他的目前没有必要安装。bind安装成功后服务器是named。
[root@service ~]# yum install bind bind-libs bind-utils -y
3.查看bind安装产生的文件。主要用到两个文件。如下:
[root@localhost ~]# rpm -ql bind | less
/etc/NetworkManager/dispatcher.d/13-named
/etc/logrotate.d/named
/etc/named
/etc/named.conf----------------主配置文件
/etc/named.iscdlv.key
/etc/named.rfc1912.zones-------zone配置文件,include到主配置文件
/etc/named.root.key
/etc/portreserve/named
/etc/rc.d/init.d/named
/etc/rndc.conf
/etc/rndc.key
/etc/sysconfig/named
....很多行....
二、配置DNS缓存服务器
1.打开/etc/named.conf文件配置修改options配置块内以下选项:
listen-on port 53 { 127.0.0.1; }; 改为 listen-on port 53 { 127.0.0.1; 192.168.2.198;}; //192.168.2.198是我的内网IP,根据自己情况修改。
#listen-on-v6 port 53 { ::1; }; //注释掉,如果不用的话。
allow-query { localhost; }; 改为 allow-query { any; };
保存退出;
2.打开配置/etc/named.rfc1912.zones, 即主配置文件named.conf底部include进来的zone文件。
注释掉bind自动生成的除以下zone块,也就是除了以下两块意外的都注释掉:
zone "localhost" IN { //正向解析配置
type master;
file "named.localhost"; //文件相对于/var/named/目录
allow-update { none; };
};
zone "1.0.0.127.in-addr.arpa" IN { //反向解析配置
type master;
file "named.loopback"; //文件相对于/var/named/目录
allow-update { none; };
};
3.配置正向解析文件
[root@localhost named]# vim /var/named/named.localhost
填写以下内容:
$TTL 1D
@ IN SOA localhost. root.localhost. (
201406251006 ; serial //序列号,随便写我一般写成单签日期时间
1D ; refresh //命令slave多久进行一次主动更新。
1H ; retry //如果到了refresh的时间,但是slave却无法连接master时,那么多久之后,slave会再次的主动尝试与主机连线。
1W ; expire //如果slave一直无法与master连接上,那么经过多久的时间后,则命令slave不要在连接master了。
3H ) ; minimum //没有指定生存期的数据,可以保存在数据库中的时间,及TTL
IN NS localhost.
IN A 127.0.0.1
4.配置反向解析文件,实际上就是把正向解析的配置文件复制一份,然后把里面的A记录反过来写“A”写成“PTR”
[root@localhost named]# vim /var/named/named.loopback
填写如下内容:
$TTL 1D
@ IN SOA localhost. root.localhost. (
201406251006 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
IN NS localhost.
IN PTR localhost.
5.修改named的相关文件属组为named
[root@localhost named]# chown :named /var/named/named*
6.检查配置文件,相关命令named-checkconf、named-checkzone
[root@localhost named]# named-checkconf [/etc/named.conf] //检查主配置文件,如果没有输出错误信息表示正常。
[root@localhost named]# named-checkzone "localhost" /var/named/named.localhost //检查正向解析配置
zone localhost/IN: loaded serial 20140625
OK
[root@localhost named]# named-checkzone "1.0.0.127.in-addr.arpa" /var/named/named.loopback //检查反向解析配置
zone 1.0.0.127.in-addr.arpa/IN: loaded serial 20140625
OK
7.启动named服务
[root@localhost named]# service named start //或者用/etc/init.d/named start启动
启动 named: [确定]
[root@localhost named]# service named status //查看服务运行状态
version: 9.8.2rc1-RedHat-9.8.2-0.23.rc1.el6_5.1
CPUs found: 1
worker threads: 1
number of zones: 18
debug level: 0
xfers running: 0
xfers deferred: 0
soa queries in progress: 0
query logging is OFF
recursive clients: 0/0/1000
tcp clients: 0/100
server is up and running
named (pid 2144) 正在运行...
8.测试NDS
a.使用命令dig测试
[root@localhost named]# dig -t A localhost @127.0.0.1 //后面@127.0.0.1表示用本机解析,如果不想每次都写修改/etc/resolv.conf文件,添加nameserver 127.0.0.1
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.23.rc1.el6_5.1 <<>> -t A localhost @127.0.0.1
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 58945
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0
;; QUESTION SECTION:
;localhost. INA
;; ANSWER SECTION:
localhost. 86400IN A 127.0.0.1
;; AUTHORITY SECTION:
localhost. 86400IN NS localhost.
;; Query time: 3 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Wed Jun 25 10:25:28 2014
;; MSG SIZE rcvd: 57
[root@localhost named]# dig -t NS localhost @127.0.0.1
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.23.rc1.el6_5.1 <<>> -t NS localhost @127.0.0.1
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 36123
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; QUESTION SECTION:
;localhost. INNS
;; ANSWER SECTION:
localhost. 86400IN NS localhost.
;; ADDITIONAL SECTION:
localhost. 86400IN A 127.0.0.1
;; Query time: 2 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Wed Jun 25 10:29:55 2014
;; MSG SIZE rcvd: 57
b.使用nslookup命令测试
[root@localhost named]# nslookup
> server 127.0.0.1
Default server: 127.0.0.1
Address: 127.0.0.1#53
> set q=A
> localhost
Server: 127.0.0.1
Address: 127.0.0.1#53
Name: localhost
Address: 127.0.0.1
> set q=NS
> localhost
Server: 127.0.0.1
Address: 127.0.0.1#53
localhost nameserver = localhost.
>exit
三、配置DNS主域名解析服务器,假设域名是itxingzhe.com
1.打开编辑/etc/named.rfc1912.zones文件,添加如下内容。
[root@localhost etc]# vim /etc/named.rfc1912.zones
zone "itxingzhe.com" IN { //正向解析
type master;
file "named.itxingzhe.com.zone";
allow-update { none; };
};
zone "2.168.192.in-addr.arpa" IN { //反向解析,注意IP写法是反过来的网段。
type master;
file "named.2.168.192.arpa";
allow-update { none; };
};
2.到/var/named目录下创建正/反向解析配置文件。
a.正向解析配置
[root@localhost named]# vim /var/named/named.itxingzhe.com.zone
$TTL 1D
@ IN SOA ns1.itxingzhe.com. root.itxingzhe.com. (
20140625 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
IN NS ns1.itxingzhe.com.
IN A 192.168.2.198
www.itxingzhe.com. IN A 192.168.2.198
ftp.itxingzhe.com. IN A 192.168.2.198
//其他的域名一次类推
b.反向解析配置
[root@localhost named]# vim /var/named/named.2.168.192.arpa
$TTL 1D
@ IN SOA ns1.itxingzhe.com. root.itxingzhe.com. (
20140625 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
IN NS ns1.itxingzhe.com.
198 IN PTR ns1.itxingzhe.com.
198 IN PTR www.itxingzhe.com.
c.修改配置文件属组为named
[root@localhost named]# chown :named /var/named/named.2.168.192.arpa /var/named/named.itxingzhe.com.zone
//这样也可以
[root@localhost named]# chown :named /var/named/named*
3.检查配置文件
参考以上“二、6.检查配置文件”。
[root@localhost named]# named-checkconf
[root@localhost named]# named-checkzone "itxingzhe.com" /var/named/named.itxingzhe.com.zone
zone itxingzhe.com/IN: loaded serial 20140625
OK
[root@localhost named]# named-checkzone "named.2.168.192.arpa" /var/named/named.2.168.192.arpa
zone named.2.168.192.arpa/IN: loaded serial 20140625
OK
4.重启named服务或重新加载配置文件
[root@localhost named]# service named restart
停止 named:. [确定]
启动 named: [确定]
或
[root@localhost named]# /etc/init.d/named reload
重新载入named: [确定]
5.测试DNS
参考以上“二、8.测试DNS”。
[root@localhost named]# dig -t A www.itxingzhe.com @192.168.2.198//测试A记录
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.23.rc1.el6_5.1 <<>> -t A www.itxingzhe.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 62759
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1
;; QUESTION SECTION:
;www.itxingzhe.com. INA
;; ANSWER SECTION:
www.itxingzhe.com. 86400IN A 192.168.2.198
;; AUTHORITY SECTION:
itxingzhe.com. 86400IN NS ns1.itxingzhe.com.
;; ADDITIONAL SECTION:
ns1.itxingzhe.com. 86400IN A 192.168.2.198
;; Query time: 3 msec
;; SERVER: 192.168.2.198#53(192.168.2.198)
;; WHEN: Wed Jun 25 11:24:20 2014
;; MSG SIZE rcvd: 85
[root@localhost named]# dig -t NS itxingzhe.com @192.168.2.198 //测试NS记录,注意这里的域名是不带www的
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.23.rc1.el6_5.1 <<>> -t NS itxingzhe.com @192.168.2.198
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 35904
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; QUESTION SECTION:
;itxingzhe.com. INNS
;; ANSWER SECTION:
itxingzhe.com. 86400IN NS ns1.itxingzhe.com.
;; ADDITIONAL SECTION:
ns1.itxingzhe.com. 86400IN A 192.168.2.198
;; Query time: 3 msec
;; SERVER: 192.168.2.198#53(192.168.2.198)
;; WHEN: Wed Jun 25 11:25:01 2014
;; MSG SIZE rcvd: 65
[root@localhost named]# dig -x 192.168.2.198 //反向解析结果
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.23.rc1.el6_5.1 <<>> -x 192.168.2.198
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 65411
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 1, ADDITIONAL: 1
;; QUESTION SECTION:
;198.2.168.192.in-addr.arpa. INPTR
;; ANSWER SECTION:
198.2.168.192.in-addr.arpa. 86400 IN PTR ns1.itxingzhe.com.
198.2.168.192.in-addr.arpa. 86400 IN PTR www.itxingzhe.com.
;; AUTHORITY SECTION:
2.168.192.in-addr.arpa. 86400IN NS ns1.itxingzhe.com.
;; ADDITIONAL SECTION:
ns1.itxingzhe.com. 86400IN A 192.168.2.198
;; Query time: 5 msec
;; SERVER: 192.168.2.198#53(192.168.2.198)
;; WHEN: Wed Jun 25 11:26:12 2014
;; MSG SIZE rcvd: 123
四、DNS从服务器配置,假设从服务器IP是192.168.2.199
1.安装bind软件。
2.配置localhost的zone配置(或者直接copy主DNS服务器上的localhost配置文件)。参考(二、配置DNS缓存服务器);
3.配置vim /etc/named.rfc1912.zones添加如下内容:
zone "itxingzhe.com" IN { //正向解析从服务器
type slave;
master {192.168.2.198;};
file "slaves/named.itxingzhe.com.zone";
};
zone "2.168.192.in-addr-arpa" IN { //反向解析从服务器
type slave;
master {192.168.2.198;};
file "slaves/named.2.168.192.arpa";
};
配置文件会自动从主DNS服务器同步过来,不用手动配置。
4.重启named服务;
5.ll slaves/查看数据是否同步过来。
注意:selinux会影响从服务器传输,请先关闭selinux。命令setenforce 0
环境:
系统版本:VBOX虚拟机centos6.0。
本机内网IP 192.168.2.198。
一、安装软件bind。
1.显示bind相关的软件包。
[root@localhost ~]# yum list bind*
bind.i686
bind-chroot.i686
bind-devel.i686
bind-dyndb-ldap.i686
bind-libs.i686
bind-sdb.i686
bind-utils.i686
2.安装必要包。主要安装三个软件包,其他的目前没有必要安装。bind安装成功后服务器是named。
[root@service ~]# yum install bind bind-libs bind-utils -y
3.查看bind安装产生的文件。主要用到两个文件。如下:
[root@localhost ~]# rpm -ql bind | less
/etc/NetworkManager/dispatcher.d/13-named
/etc/logrotate.d/named
/etc/named
/etc/named.conf----------------主配置文件
/etc/named.iscdlv.key
/etc/named.rfc1912.zones-------zone配置文件,include到主配置文件
/etc/named.root.key
/etc/portreserve/named
/etc/rc.d/init.d/named
/etc/rndc.conf
/etc/rndc.key
/etc/sysconfig/named
....很多行....
二、配置DNS缓存服务器
1.打开/etc/named.conf文件配置修改options配置块内以下选项:
listen-on port 53 { 127.0.0.1; }; 改为 listen-on port 53 { 127.0.0.1; 192.168.2.198;}; //192.168.2.198是我的内网IP,根据自己情况修改。
#listen-on-v6 port 53 { ::1; }; //注释掉,如果不用的话。
allow-query { localhost; }; 改为 allow-query { any; };
保存退出;
2.打开配置/etc/named.rfc1912.zones, 即主配置文件named.conf底部include进来的zone文件。
注释掉bind自动生成的除以下zone块,也就是除了以下两块意外的都注释掉:
zone "localhost" IN { //正向解析配置
type master;
file "named.localhost"; //文件相对于/var/named/目录
allow-update { none; };
};
zone "1.0.0.127.in-addr.arpa" IN { //反向解析配置
type master;
file "named.loopback"; //文件相对于/var/named/目录
allow-update { none; };
};
3.配置正向解析文件
[root@localhost named]# vim /var/named/named.localhost
填写以下内容:
$TTL 1D
@ IN SOA localhost. root.localhost. (
201406251006 ; serial //序列号,随便写我一般写成单签日期时间
1D ; refresh //命令slave多久进行一次主动更新。
1H ; retry //如果到了refresh的时间,但是slave却无法连接master时,那么多久之后,slave会再次的主动尝试与主机连线。
1W ; expire //如果slave一直无法与master连接上,那么经过多久的时间后,则命令slave不要在连接master了。
3H ) ; minimum //没有指定生存期的数据,可以保存在数据库中的时间,及TTL
IN NS localhost.
IN A 127.0.0.1
4.配置反向解析文件,实际上就是把正向解析的配置文件复制一份,然后把里面的A记录反过来写“A”写成“PTR”
[root@localhost named]# vim /var/named/named.loopback
填写如下内容:
$TTL 1D
@ IN SOA localhost. root.localhost. (
201406251006 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
IN NS localhost.
IN PTR localhost.
5.修改named的相关文件属组为named
[root@localhost named]# chown :named /var/named/named*
6.检查配置文件,相关命令named-checkconf、named-checkzone
[root@localhost named]# named-checkconf [/etc/named.conf] //检查主配置文件,如果没有输出错误信息表示正常。
[root@localhost named]# named-checkzone "localhost" /var/named/named.localhost //检查正向解析配置
zone localhost/IN: loaded serial 20140625
OK
[root@localhost named]# named-checkzone "1.0.0.127.in-addr.arpa" /var/named/named.loopback //检查反向解析配置
zone 1.0.0.127.in-addr.arpa/IN: loaded serial 20140625
OK
7.启动named服务
[root@localhost named]# service named start //或者用/etc/init.d/named start启动
启动 named: [确定]
[root@localhost named]# service named status //查看服务运行状态
version: 9.8.2rc1-RedHat-9.8.2-0.23.rc1.el6_5.1
CPUs found: 1
worker threads: 1
number of zones: 18
debug level: 0
xfers running: 0
xfers deferred: 0
soa queries in progress: 0
query logging is OFF
recursive clients: 0/0/1000
tcp clients: 0/100
server is up and running
named (pid 2144) 正在运行...
8.测试NDS
a.使用命令dig测试
[root@localhost named]# dig -t A localhost @127.0.0.1 //后面@127.0.0.1表示用本机解析,如果不想每次都写修改/etc/resolv.conf文件,添加nameserver 127.0.0.1
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.23.rc1.el6_5.1 <<>> -t A localhost @127.0.0.1
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 58945
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0
;; QUESTION SECTION:
;localhost. INA
;; ANSWER SECTION:
localhost. 86400IN A 127.0.0.1
;; AUTHORITY SECTION:
localhost. 86400IN NS localhost.
;; Query time: 3 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Wed Jun 25 10:25:28 2014
;; MSG SIZE rcvd: 57
[root@localhost named]# dig -t NS localhost @127.0.0.1
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.23.rc1.el6_5.1 <<>> -t NS localhost @127.0.0.1
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 36123
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; QUESTION SECTION:
;localhost. INNS
;; ANSWER SECTION:
localhost. 86400IN NS localhost.
;; ADDITIONAL SECTION:
localhost. 86400IN A 127.0.0.1
;; Query time: 2 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Wed Jun 25 10:29:55 2014
;; MSG SIZE rcvd: 57
b.使用nslookup命令测试
[root@localhost named]# nslookup
> server 127.0.0.1
Default server: 127.0.0.1
Address: 127.0.0.1#53
> set q=A
> localhost
Server: 127.0.0.1
Address: 127.0.0.1#53
Name: localhost
Address: 127.0.0.1
> set q=NS
> localhost
Server: 127.0.0.1
Address: 127.0.0.1#53
localhost nameserver = localhost.
>exit
三、配置DNS主域名解析服务器,假设域名是itxingzhe.com
1.打开编辑/etc/named.rfc1912.zones文件,添加如下内容。
[root@localhost etc]# vim /etc/named.rfc1912.zones
zone "itxingzhe.com" IN { //正向解析
type master;
file "named.itxingzhe.com.zone";
allow-update { none; };
};
zone "2.168.192.in-addr.arpa" IN { //反向解析,注意IP写法是反过来的网段。
type master;
file "named.2.168.192.arpa";
allow-update { none; };
};
2.到/var/named目录下创建正/反向解析配置文件。
a.正向解析配置
[root@localhost named]# vim /var/named/named.itxingzhe.com.zone
$TTL 1D
@ IN SOA ns1.itxingzhe.com. root.itxingzhe.com. (
20140625 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
IN NS ns1.itxingzhe.com.
IN A 192.168.2.198
www.itxingzhe.com. IN A 192.168.2.198
ftp.itxingzhe.com. IN A 192.168.2.198
//其他的域名一次类推
b.反向解析配置
[root@localhost named]# vim /var/named/named.2.168.192.arpa
$TTL 1D
@ IN SOA ns1.itxingzhe.com. root.itxingzhe.com. (
20140625 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
IN NS ns1.itxingzhe.com.
198 IN PTR ns1.itxingzhe.com.
198 IN PTR www.itxingzhe.com.
c.修改配置文件属组为named
[root@localhost named]# chown :named /var/named/named.2.168.192.arpa /var/named/named.itxingzhe.com.zone
//这样也可以
[root@localhost named]# chown :named /var/named/named*
3.检查配置文件
参考以上“二、6.检查配置文件”。
[root@localhost named]# named-checkconf
[root@localhost named]# named-checkzone "itxingzhe.com" /var/named/named.itxingzhe.com.zone
zone itxingzhe.com/IN: loaded serial 20140625
OK
[root@localhost named]# named-checkzone "named.2.168.192.arpa" /var/named/named.2.168.192.arpa
zone named.2.168.192.arpa/IN: loaded serial 20140625
OK
4.重启named服务或重新加载配置文件
[root@localhost named]# service named restart
停止 named:. [确定]
启动 named: [确定]
或
[root@localhost named]# /etc/init.d/named reload
重新载入named: [确定]
5.测试DNS
参考以上“二、8.测试DNS”。
[root@localhost named]# dig -t A www.itxingzhe.com @192.168.2.198//测试A记录
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.23.rc1.el6_5.1 <<>> -t A www.itxingzhe.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 62759
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1
;; QUESTION SECTION:
;www.itxingzhe.com. INA
;; ANSWER SECTION:
www.itxingzhe.com. 86400IN A 192.168.2.198
;; AUTHORITY SECTION:
itxingzhe.com. 86400IN NS ns1.itxingzhe.com.
;; ADDITIONAL SECTION:
ns1.itxingzhe.com. 86400IN A 192.168.2.198
;; Query time: 3 msec
;; SERVER: 192.168.2.198#53(192.168.2.198)
;; WHEN: Wed Jun 25 11:24:20 2014
;; MSG SIZE rcvd: 85
[root@localhost named]# dig -t NS itxingzhe.com @192.168.2.198 //测试NS记录,注意这里的域名是不带www的
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.23.rc1.el6_5.1 <<>> -t NS itxingzhe.com @192.168.2.198
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 35904
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; QUESTION SECTION:
;itxingzhe.com. INNS
;; ANSWER SECTION:
itxingzhe.com. 86400IN NS ns1.itxingzhe.com.
;; ADDITIONAL SECTION:
ns1.itxingzhe.com. 86400IN A 192.168.2.198
;; Query time: 3 msec
;; SERVER: 192.168.2.198#53(192.168.2.198)
;; WHEN: Wed Jun 25 11:25:01 2014
;; MSG SIZE rcvd: 65
[root@localhost named]# dig -x 192.168.2.198 //反向解析结果
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.23.rc1.el6_5.1 <<>> -x 192.168.2.198
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 65411
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 1, ADDITIONAL: 1
;; QUESTION SECTION:
;198.2.168.192.in-addr.arpa. INPTR
;; ANSWER SECTION:
198.2.168.192.in-addr.arpa. 86400 IN PTR ns1.itxingzhe.com.
198.2.168.192.in-addr.arpa. 86400 IN PTR www.itxingzhe.com.
;; AUTHORITY SECTION:
2.168.192.in-addr.arpa. 86400IN NS ns1.itxingzhe.com.
;; ADDITIONAL SECTION:
ns1.itxingzhe.com. 86400IN A 192.168.2.198
;; Query time: 5 msec
;; SERVER: 192.168.2.198#53(192.168.2.198)
;; WHEN: Wed Jun 25 11:26:12 2014
;; MSG SIZE rcvd: 123
四、DNS从服务器配置,假设从服务器IP是192.168.2.199
1.安装bind软件。
2.配置localhost的zone配置(或者直接copy主DNS服务器上的localhost配置文件)。参考(二、配置DNS缓存服务器);
3.配置vim /etc/named.rfc1912.zones添加如下内容:
zone "itxingzhe.com" IN { //正向解析从服务器
type slave;
master {192.168.2.198;};
file "slaves/named.itxingzhe.com.zone";
};
zone "2.168.192.in-addr-arpa" IN { //反向解析从服务器
type slave;
master {192.168.2.198;};
file "slaves/named.2.168.192.arpa";
};
配置文件会自动从主DNS服务器同步过来,不用手动配置。
4.重启named服务;
5.ll slaves/查看数据是否同步过来。
注意:selinux会影响从服务器传输,请先关闭selinux。命令setenforce 0
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。