DNS详解及DNS主从配置

DNS 全称domain name system域名系统的缩写,它是一种将IP地址转换成对应的主机名或者将主机名转换成对应的IP的一种服务机制。其中通过域名解析出IP叫做正向解析,通过IP解析出域名叫做反向解析。DNS使用TCP和UDP协议,端口号都是53,但它主要使用UDP,服务器之间备份使用TCP。全世界只有13台“根”服务器,一个主根服务器放在美国,其他12台为辅根服务器,DNS服务器根据角色可分为:主DNS,从DNS,缓存DNS服务器,DNS转发服务器。

首先来看看域名的结构组成,我们平时访问网站的时候,都会用一个域名去请求,比如www.baidu.com,其实.com后面还有一个点,这个点叫做根域。下图是一个域名的树状结构,根域下面会有.com,.cn,.net等顶级域,顶级域下面又有二级域名,比如baidu.com或者.com.cn等,而www.baidu.com则为子域,我们经常用子域来做网站的域名。

早期的域名到IP的映射是保存在hosts文件中的:

[[email protected] ~]# cat /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4

::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

DNS解析过程:先在本地/etc/hosts文件中查找解析,如果找到直接使用;如果找不到,则进行下图所示的解析过程:

查看DNS配置文件的内容:

[[email protected] ~]# cat /etc/resolv.conf

; generated by /sbin/dhclient-script

search localdomain

nameserver 192.168.147.2

我们使用bind来搭建DNS服务,

首先安装bind:

[[email protected] ~]# yum install -y bind

配置文件说明:

主配置文件:/etc/named.conf

(监听的端口53,IP127.0.0.1)

域服务器配置文件:/var/named/named.ca

本地主机配置文件:/var/named/named.localhost

反解析配置文件:/var/named/named.loopback

启动DNS服务named:

[[email protected] ~]# /etc/init.d/named start

Generating /etc/rndc.key:                                  [确定]

启动 named:                                               [确定]

测试1:正向解析

测试使用@127.0.0.1解析localhost:

[[email protected] ~]# dig @127.0.0.1 localhost

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.47.rc1.el6_8.4 <<>> @127.0.0.1 localhost

; (1 server found)

;; global options: +cmd

;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 11354

;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1

;; QUESTION SECTION:

;localhost.                     IN      A

;; ANSWER SECTION:

localhost.              86400   IN      A       127.0.0.1

;; AUTHORITY SECTION:

localhost.              86400   IN      NS      localhost.

;; ADDITIONAL SECTION:

localhost.              86400   IN      AAAA    ::1

;; Query time: 0 msec

;; SERVER: 127.0.0.1#53(127.0.0.1)

;; WHEN: Mon Mar 13 22:31:29 2017

;; MSG SIZE  rcvd: 85

测试使用@127.0.0.1解析localhost.localdomain:

[[email protected] ~]# dig @127.0.0.1 localhost.localdomain

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.47.rc1.el6_8.4 <<>> @127.0.0.1 localhost.localdomain

; (1 server found)

;; global options: +cmd

;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 26777

;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1

;; QUESTION SECTION:

;localhost.localdomain.         IN      A

;; ANSWER SECTION:

localhost.localdomain.  86400   IN      A       127.0.0.1

;; AUTHORITY SECTION:

localhost.localdomain.  86400   IN      NS      localhost.localdomain.

;; ADDITIONAL SECTION:

localhost.localdomain.  86400   IN      AAAA    ::1

;; Query time: 0 msec

;; SERVER: 127.0.0.1#53(127.0.0.1)

;; WHEN: Mon Mar 13 22:32:30 2017

;; MSG SIZE  rcvd: 97

测试结果发现,将localhost和localhost.localdomain都解析到了127.0.0.1。

测试2:反向解析

反解析配置文件:/var/named/named.loopback

测试使用@127.0.0.1反解析127.0.0.1:

[[email protected] ~]# dig @127.0.0.1 -x 127.0.0.1

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.47.rc1.el6_8.4 <<>> @127.0.0.1 -x 127.0.0.1

; (1 server found)

;; global options: +cmd

;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 25857

;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 2

;; QUESTION SECTION:

;1.0.0.127.in-addr.arpa.                IN      PTR

;; ANSWER SECTION:

1.0.0.127.in-addr.arpa. 86400   IN      PTR     localhost.

;; AUTHORITY SECTION:

1.0.0.127.in-addr.arpa. 86400   IN      NS      1.0.0.127.in-addr.arpa.

;; ADDITIONAL SECTION:

1.0.0.127.in-addr.arpa. 86400   IN      A       127.0.0.1

1.0.0.127.in-addr.arpa. 86400   IN      AAAA    ::1

;; Query time: 0 msec

;; SERVER: 127.0.0.1#53(127.0.0.1)

;; WHEN: Mon Mar 13 22:33:43 2017

;; MSG SIZE  rcvd: 121

测试结果发现,将127.0.0.1反解析到了localhost。

配置一个正向解析的域:123.com

编辑主配置文件:

[[email protected] ~]# vim /etc/named.conf

在最后面添加一个域“123.com”,格式参照zone "."格式:

zone "123.com" IN {

type master;

file "123.com.zone";

};

检查主配置文件是否有错:

[[email protected] ~]# named-checkconf

编辑123.com.zone文件:

[[email protected] ~]# vim /var/named/123.com.zone

内容如下,格式参考/var/named/named.localhost:

$TTL 1D

@       IN SOA  @ admin.123.com. (

2015010901       ; serial

1D      ; refresh

1H      ; retry

1W      ; expire

3H )    ; minimum

IN      NS      ns.123.com.

IN      MX      5       mail.123.com.

mail    IN      A       192.168.134.129

ns      IN      A       192.168.134.128

www     IN      A       11.11.11.11

bbs     IN      CNAME   www

检查域配置文件是否有错:

[[email protected] ~]# named-checkzone "123.com" /var/named/123.com.zone

zone 123.com/IN: loaded serial 2015010901

OK

再次编辑主配置文件,

[[email protected] ~]# vim /etc/named.conf

加入监听DNS的IP192.168.147.137

listen-on port 53 { 127.0.0.1;192.168.147.137; };

重启:

[[email protected] ~]# /etc/init.d/named restart

停止 named:.                                              [确定]

启动 named:                                               [确定]

测试1:解析www.123.com:

[[email protected] ~]# dig @192.168.147.137 www.123.com

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.47.rc1.el6_8.4 <<>> @192.168.147.137 www.123.com

; (1 server found)

;; global options: +cmd

;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 31526

;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1

;; QUESTION SECTION:

;www.123.com.                   IN      A

;; ANSWER SECTION:

www.123.com.            86400   IN      A       11.11.11.11

;; AUTHORITY SECTION:

123.com.                86400   IN      NS      ns.123.com.

;; ADDITIONAL SECTION:

ns.123.com.             86400   IN      A       192.168.134.128

;; Query time: 15 msec

;; SERVER: 192.168.147.137#53(192.168.147.137)

;; WHEN: Mon Mar 13 23:37:22 2017

;; MSG SIZE  rcvd: 78

测试2:解析bbs.123.com:

[[email protected] ~]# dig @192.168.147.137 bbs.123.com

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.47.rc1.el6_8.4 <<>> @192.168.147.137 bbs.123.com

; (1 server found)

;; global options: +cmd

;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 9966

;; flags: qr aa rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 1, ADDITIONAL: 1

;; QUESTION SECTION:

;bbs.123.com.                   IN      A

;; ANSWER SECTION:

bbs.123.com.            86400   IN      CNAME   www.123.com.

www.123.com.            86400   IN      A       11.11.11.11

;; AUTHORITY SECTION:

123.com.                86400   IN      NS      ns.123.com.

;; ADDITIONAL SECTION:

ns.123.com.             86400   IN      A       192.168.134.128

;; Query time: 1 msec

;; SERVER: 192.168.147.137#53(192.168.147.137)

;; WHEN: Mon Mar 13 23:38:53 2017

;; MSG SIZE  rcvd: 96

测试3:mail.123.com:

[[email protected] ~]# dig @192.168.147.137 mail.123.com

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.47.rc1.el6_8.4 <<>> @192.168.147.137 mail.123.com

; (1 server found)

;; global options: +cmd

;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 41160

;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1

;; QUESTION SECTION:

;mail.123.com.                  IN      A

;; ANSWER SECTION:

mail.123.com.           86400   IN      A       192.168.134.129

;; AUTHORITY SECTION:

123.com.                86400   IN      NS      ns.123.com.

;; ADDITIONAL SECTION:

ns.123.com.             86400   IN      A       192.168.134.128

;; Query time: 0 msec

;; SERVER: 192.168.147.137#53(192.168.147.137)

;; WHEN: Mon Mar 13 23:39:42 2017

;; MSG SIZE  rcvd: 79

测试4:没有配置的mail2解析失败

[[email protected] ~]# dig @192.168.147.137 mail2.123.com

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.47.rc1.el6_8.4 <<>> @192.168.147.137 mail2.123.com

; (1 server found)

;; global options: +cmd

;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 47121

;; flags: qr aa rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:

;mail2.123.com.                 IN      A

;; AUTHORITY SECTION:

123.com.                10800   IN      SOA     123.com. admin.123.com. 2015010901 86400 3600 604800 10800

;; Query time: 9 msec

;; SERVER: 192.168.147.137#53(192.168.147.137)

;; WHEN: Mon Mar 13 23:40:34 2017

;; MSG SIZE  rcvd: 73

配置一个反向解析的域:147.168.192.zone

(反解析一般用于企业的邮件服务器,能够反解析出我的域名的IP我才给你发邮件)

编辑主配置文件:

[[email protected] ~]# vim /etc/named.conf

在最后面添加一个域:

zone "147.168.192.in-addr.arpa" IN {

type master;

file "147.168.192.zone";

};

检查主配置文件是否有错:

[[email protected] ~]# named-checkconf

编辑对应的zone文件:

[[email protected] ~]# vim /var/named/147.168.192.zone

$TTL 1D

@       IN SOA  @ admin.123.com. (

2015010901       ; serial

1D      ; refresh

1H      ; retry

1W      ; expire

3H )    ; minimum

IN      NS      ns.123.com.

137     IN      PTR     ns.123.com.

138     IN      PTR     mail.123.com.

检查域配置文件是否有错:

[[email protected] ~]# named-checkzone "147.168.192" /var/named/147.168.192.zone

zone 147.168.192/IN: loaded serial 2015010901

OK

重启:

[[email protected] ~]# /etc/init.d/named restart

停止 named:.                                              [确定]

启动 named:                                               [确定]

测试1:DNS服务器自身IP反解析成功

[[email protected] ~]# dig @192.168.147.137 -x 192.168.147.137

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.47.rc1.el6_8.4 <<>> @192.168.147.137 -x 192.168.147.137

; (1 server found)

;; global options: +cmd

;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 38679

;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1

;; QUESTION SECTION:

;137.147.168.192.in-addr.arpa.  IN      PTR

;; ANSWER SECTION:

137.147.168.192.in-addr.arpa. 86400 IN  PTR     ns.123.com.

;; AUTHORITY SECTION:

147.168.192.in-addr.arpa. 86400 IN      NS      ns.123.com.

;; ADDITIONAL SECTION:

ns.123.com.             86400   IN      A       192.168.134.128

;; Query time: 0 msec

;; SERVER: 192.168.147.137#53(192.168.147.137)

;; WHEN: Tue Mar 14 00:00:02 2017

;; MSG SIZE  rcvd: 100

测试2:域192.168.147内的任意主机都能反解析成功

[[email protected] ~]# dig @192.168.147.137 -x 192.168.147.138

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.47.rc1.el6_8.4 <<>> @192.168.147.137 -x 192.168.147.138

; (1 server found)

;; global options: +cmd

;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 50957

;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1

;; QUESTION SECTION:

;138.147.168.192.in-addr.arpa.  IN      PTR

;; ANSWER SECTION:

138.147.168.192.in-addr.arpa. 86400 IN  PTR     mail.123.com.

;; AUTHORITY SECTION:

147.168.192.in-addr.arpa. 86400 IN      NS      ns.123.com.

;; ADDITIONAL SECTION:

ns.123.com.             86400   IN      A       192.168.134.128

;; Query time: 0 msec

;; SERVER: 192.168.147.137#53(192.168.147.137)

;; WHEN: Tue Mar 14 00:01:31 2017

;; MSG SIZE  rcvd: 105

测试3:不在域192.168.147内的IP反解析失败:

[[email protected] ~]# dig @192.168.147.137 -x 192.168.123.138

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.47.rc1.el6_8.4 <<>> @192.168.147.137 -x 192.168.123.138

; (1 server found)

;; global options: +cmd

;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 37175

;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:

;138.123.168.192.in-addr.arpa.  IN      PTR

;; Query time: 1240 msec

;; SERVER: 192.168.147.137#53(192.168.147.137)

;; WHEN: Tue Mar 14 00:01:58 2017

;; MSG SIZE  rcvd: 46

dns服务器主从配置:

主DNS服务器:192.168.147.137

从DNS服务器:192.168.147.138

在从DNS服务器上192.168.147.138:

安装DNS:

[[email protected] ~]# yum install -y bind

编辑主配置:

[[email protected] ~]# vim /etc/named.conf

注释掉以下两行,表示监听所有IP

//      listen-on port 53 { 127.0.0.1; };

//      listen-on-v6 port 53 { ::1; };

在最后面添加与主DNS一样的域配置,稍作修改如下:

zone "123.com" IN {

type slave;

file "slaves/123.com.zone";

masters { 192.168.147.137; };

};

zone "147.168.192.in-addr.arpa" IN {

type slave;

file "slaves/147.168.192.zone";

masters { 192.168.147.137; };

};

检查主配置文件是否有错:

[[email protected] ~]# named-checkconf

启动:

[[email protected] ~]# /etc/init.d/named start

Generating /etc/rndc.key:                                  [确定]

启动 named:                                               [确定]

查看生成的文件:

[[email protected] ~]# ls /var/named/slaves/

123.com.zone  147.168.192.zone

查看123.com.zone内容(可以看到在主DNS上的配置被同步到从DNS上):

[[email protected] ~]# cat /var/named/slaves/123.com.zone

$ORIGIN .

$TTL 86400      ; 1 day

123.com                 IN SOA  123.com. admin.123.com. (

2015010901 ; serial

86400      ; refresh (1 day)

3600       ; retry (1 hour)

604800     ; expire (1 week)

10800      ; minimum (3 hours)

)

NS      ns.123.com.

MX      5 mail.123.com.

$ORIGIN 123.com.

bbs                     CNAME   www

mail                    A       192.168.134.129

ns                      A       192.168.134.128

www                     A       11.11.11.11

测试从DNS解析www.123.com:

[[email protected] ~]# dig @192.168.147.138 www.123.com

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.47.rc1.el6_8.4 <<>> @192.168.147.138 www.123.com

; (1 server found)

;; global options: +cmd

;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 38327

;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1

;; QUESTION SECTION:

;www.123.com.                   IN      A

;; ANSWER SECTION:

www.123.com.            86400   IN      A       11.11.11.11

;; AUTHORITY SECTION:

123.com.                86400   IN      NS      ns.123.com.

;; ADDITIONAL SECTION:

ns.123.com.             86400   IN      A       192.168.134.128

;; Query time: 1 msec

;; SERVER: 192.168.147.138#53(192.168.147.138)

;; WHEN: Tue Mar 14 00:34:43 2017

;; MSG SIZE  rcvd: 78

测试从DNSbbs:

[[email protected] ~]# dig @192.168.147.138 bbs.123.com

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.47.rc1.el6_8.4 <<>> @192.168.147.138 bbs.123.com

; (1 server found)

;; global options: +cmd

;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 36960

;; flags: qr aa rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 1, ADDITIONAL: 1

;; QUESTION SECTION:

;bbs.123.com.                   IN      A

;; ANSWER SECTION:

bbs.123.com.            86400   IN      CNAME   www.123.com.

www.123.com.            86400   IN      A       11.11.11.11

;; AUTHORITY SECTION:

123.com.                86400   IN      NS      ns.123.com.

;; ADDITIONAL SECTION:

ns.123.com.             86400   IN      A       192.168.134.128

;; Query time: 0 msec

;; SERVER: 192.168.147.138#53(192.168.147.138)

;; WHEN: Tue Mar 14 00:46:35 2017

;; MSG SIZE  rcvd: 96

测试反解析:

[[email protected] ~]# dig @192.168.147.138 -x 192.168.147.137

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.47.rc1.el6_8.4 <<>> @192.168.147.138 -x 192.168.147.137

; (1 server found)

;; global options: +cmd

;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 5809

;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1

;; QUESTION SECTION:

;137.147.168.192.in-addr.arpa.  IN      PTR

;; ANSWER SECTION:

137.147.168.192.in-addr.arpa. 86400 IN  PTR     ns.123.com.

;; AUTHORITY SECTION:

147.168.192.in-addr.arpa. 86400 IN      NS      ns.123.com.

;; ADDITIONAL SECTION:

ns.123.com.             86400   IN      A       192.168.134.128

;; Query time: 0 msec

;; SERVER: 192.168.147.138#53(192.168.147.138)

;; WHEN: Tue Mar 14 00:48:28 2017

;; MSG SIZE  rcvd: 100

测试结果发现,从DNS服务器正常工作。

在主上增加一条记录:

[[email protected] ~]# vim /var/named/123.com.zone

$TTL 1D

@       IN SOA  @ admin.123.com. (

2015010902       ; serial

1D      ; refresh

1H      ; retry

1W      ; expire

3H )    ; minimum

IN      NS      ns.123.com.

IN      MX      5       mail.123.com.

mail    IN      A       192.168.147.137

ns      IN      A       192.168.147.138

www     IN      A       11.11.11.11

bbs     IN      CNAME   www

test    IN      A       111.111.111.111

重启:

[[email protected] ~]# /etc/init.d/named restart

停止 named:.                                              [确定]

启动 named:                                               [确定]

测试解析新加入的记录 test.123.com:

[[email protected] ~]# dig @192.168.147.137 test.123.com

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.47.rc1.el6_8.4 <<>> @192.168.147.137 test.123.com

; (1 server found)

;; global options: +cmd

;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 2695

;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1

;; QUESTION SECTION:

;test.123.com.                  IN      A

;; ANSWER SECTION:

test.123.com.           86400   IN      A       111.111.111.111

;; AUTHORITY SECTION:

123.com.                86400   IN      NS      ns.123.com.

;; ADDITIONAL SECTION:

ns.123.com.             86400   IN      A       192.168.147.138

;; Query time: 0 msec

;; SERVER: 192.168.147.137#53(192.168.147.137)

;; WHEN: Tue Mar 14 00:53:47 2017

;; MSG SIZE  rcvd: 79

1天刷新一次不方便测试,我们想只要主发生更改,从立即跟着更改:

在主上编辑配置文件:加入向从发送通知的配置

zone "123.com" IN {

type master;

file "123.com.zone";

notify yes;

also-notify { 192.168.147.138; };

};

zone "147.168.192.in-addr.arpa" IN {

type master;

file "147.168.192.zone";

notify yes;

also-notify { 192.168.147.138; };

};

检查配置:

[[email protected] ~]# named-checkconf

重启:[[email protected] ~]# /etc/init.d/named restart

停止 named:.                                              [确定]

启动 named:                                               [确定]

在从上测试:

发现从DNS上配置文件123.com.zone也自动更新:

[[email protected] ~]# cat /var/named/slaves/123.com.zone

$ORIGIN .

$TTL 86400      ; 1 day

123.com                 IN SOA  123.com. admin.123.com. (

2015010902 ; serial

86400      ; refresh (1 day)

3600       ; retry (1 hour)

604800     ; expire (1 week)

10800      ; minimum (3 hours)

)

NS      ns.123.com.

MX      5 mail.123.com.

$ORIGIN 123.com.

bbs                     CNAME   www

mail                    A       192.168.147.137

ns                      A       192.168.147.138

test                    A       111.111.111.111

www                     A       11.11.11.11

测试解析 test.123.com:

[[email protected] ~]# dig @192.168.147.138 test.123.com

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.47.rc1.el6_8.4 <<>> @192.168.147.138 test.123.com

; (1 server found)

;; global options: +cmd

;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 57454

;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1

;; QUESTION SECTION:

;test.123.com.                  IN      A

;; ANSWER SECTION:

test.123.com.           86400   IN      A       111.111.111.111

;; AUTHORITY SECTION:

123.com.                86400   IN      NS      ns.123.com.

;; ADDITIONAL SECTION:

ns.123.com.             86400   IN      A       192.168.147.138

;; Query time: 0 msec

;; SERVER: 192.168.147.138#53(192.168.147.138)

;; WHEN: Tue Mar 14 00:58:05 2017

;; MSG SIZE  rcvd: 79

时间: 2024-10-18 04:02:07

DNS详解及DNS主从配置的相关文章

DNS(二)--正反解析及主从配置

实验题目: 1.DNS的正反向解析 2.DNS的主从同步 实验环境: 1.VMware虚拟机 2.两台以上linux子机 3.XP测试机 实验过程: 一.DNS的正反向解析 实验拓扑:     说明:其实这里面不需要指定网关,只是为了好看就设定了吧.服务器的DNS指向自己.要不然用ping的时候ping不通. 目的就是要让客户端用域名解析到IP或用IP解析到域名.这里只是为了测试,实际情况下,反解风险很大,慎用! 1.服务器端: 安装DNS服务器(bind),挂载光盘镜像 安装bind服务和bi

Centos 6.5 DNS详解

Centos 6.5  DNS详解 为什么会出现DNS?为了让你上网浏览网页时不必直接输入IP地址而是输入更易记忆和理解的主机名字 主机间通信依靠IP地址.计算机诞生之初是没有DNS概念的,当时的主机数量寥寥无几,主机通信依靠的是写在host文件中的主机名到IP地址的对应关系来查询IP地址,然后使用IP进行通信.但是随着时间的推移,主机数量急剧增长,host文件的弊端显露无疑.此时急需一种高效方便的解决方案.DNS应时而生.是的DNS就是用于主机名到IP的解析的. 下面结合下图分析dns解析过程

05-Linux中DNS详解(二)

接"04-Linux中DNS详解(一)" 六.在Linux上测试域名解析1.先检查DNS是否设置正确 cat /etc/resolv.conf [resolv.conf] # Generated by NetworkManager nameserver 192.168.80.100 2.使用nslookup来测试域名解析a.常规解析法 nslookup wwww.zhangyujia.cn ----- Server: 192.168.80.100 Address: 192.168.80

redis配置文件详解及实现主从同步切换

redis配置文件详解及实现主从同步切换 redis复制 Redis复制很简单易用,它通过配置允许slave Redis Servers或者Master Servers的复制品.接下来有几个关于redis复制的非常重要特性: 一个Master可以有多个Slaves. Slaves能过接口其他slave的链接,除了可以接受同一个master下面slaves的链接以外,还可以接受同一个结构图中的其他slaves的链接. redis复制是在master段是非阻塞的,这就意味着master在同一个或多个

centos7.0 安装日志--图文详解-python开发环境配置

centos7.0发布之后,就下载了everthing的DVD镜像,今天有时间,所以决定在vbox底下体验一番--- 上图: 默认是体验安装,作为一个忠实粉丝,我决定选择直接安装! 这个界面是这次新版本更新后改的,它把以前要下一步.上一步可以修改的操作全部集中到一个页面来,默认选择是下图这样,比如你想修改软件安装选项只要点击相应选项就可以了. 每次你更改安装选项之后,它都会自动从新计算安装源,如果你的选择的资源本地没有,还可以通过网络来安装,默认网络是不启用的,所以我们需要自己手工设置一下网络.

SpringMVC配置web.xml文件详解(列举常用的配置)

常用的web.xml的配置 1.Spring 框架解决字符串编码问题:过滤器 CharacterEncodingFilter(filter-name) 2.在web.xml配置监听器ContextLoaderListener(listener-class) ContextLoaderListener的作用就是启动Web容器时,自动装配ApplicationContext的配置信息.因为它实现了ServletContextListener这个接口,在web.xml配置这个监听器,启动容器时,就会默

Android Google Map v2详解之:开发环境配置

Android Google Map v2详解之:开发环境配置                                       --转载请注明出处:coder-pig 说在前面: 说到地图定位,现在越来越多的社交app都加入了地图和定位的功能模块,用户很多的时候 也会用到这些东东,比如,到外面吃饭,次次吃饭前都要拍下照片发到朋友圈,定个位,然后发条说说, 炫耀一下自己今天吃了什么高大上的东东,炫耀和攀比心理我懂,不过,一次下班去吃饭,看到一妹子 吃饭,拍照+发朋友圈,足足用了大概20

dpkg命令详解及apt源配置

dpkg命令详解及apt源配置 一:dpkg命令 dpkg 是"Debian Packager "的简写, 是Debian Linux系统用来安装.创建和管理软件包的实用工具. 1.语法 dpkg --help Usage: dpkg [<option> ...] <command> 常用选项有-i , -s , -l , -L , -c , -r , -P 等 2.实例 本文是提前手动下载的tcl8.5_8.5.11-2_amd64.deb为例. 安装软件包

【详解】DNS服务工作原理、正反向解析和主从同步

目录: 一.理论部分 二.实验部分 ******************************理论部分*************************************** 正文: 一.什么是DNS服务. DNS服务是互联网的基础性服务之一.全称为Domain Name System(域名系统).DNS是因特网上作为域名和IP地址相互映射的一个分布式数据库,提供将域名转换成对应IP地址的信息条目,能够使用户更方便的通过域名(如baidu.com)去访问互联网,而不用去记住能够被机器直接