centos 6.3 bind

DNS

实验一:转发,泛解析,负载均衡,主从服务器

主服务器的配置(10.10.10.10

[root@server1 ~]# yum  -y install bind*( centos 6.3  bind-9.8.2-0.10.rc1.el6_3.4.i686)

[root@server1 ~]# vi /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";

        allow-query     { any; };

        recursion yes;

include "/etc/named.rfc1912.zones";(名字不能更改)

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

[root@server1 etc]# vim /etc/named.rfc1912.zones

zone "xiao.com" IN {

       type master;

       file "/var/named/xiao.com";

       allow-update { none; };

};

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

       type master;

       file "/var/named/xiao.rev";

       allow-update { none; };

};

 

[root@server1 log]# cd /var/named

[root@server1 named]# cp named.localhost xiao.com

[root@server1 named]# vim xiao.com

$TTL 1D

@       IN SOA  dns.xiao.com. root.xiao.com. (

                                        0       ; serial

                                        1D      ; refresh

                                        1H      ; retry

                                        1W      ; expire

                                        3H )    ; minimum

 

        IN NS dns.xiao.com.

dns  IN A 10.10.10.10

mail  IN A 10.10.10.12

www  IN A 10.10.10.12

xiao1 IN CNAME www.xiao.com.

[root@server1 named]# cp xiao.com.zone xiao.rev

[root@server1 named]# vim xiao.rev

$TTL 1D

@       IN SOA dns.xiao.com.  root.xiao.com. (

                                        0       ; serial

                                        1D      ; refresh

                                        1H      ; retry

                                        1W      ; expire

                                        3H )    ; minimum

 

        IN NS dns.xiao.com.

10 IN PTR dns.xiao.com.

12 IN PTR www.xiao.com.

[root@server1 named]# chown root:named xiao.com

[root@server1 named]# chown root:named xiao.rev

 [root@server1 etc]# named-checkconf /etc/named.conf (检验配置文件有没有错误,没有提正常)

[root@server1 etc]# named-checkconf -t /var/named/chroot/

示没有rndc.key,主要原因还是在RHEL6上没有caching-named这个包了,EL5上是把key包含在里面的。所以我们http://www.linuxidc.com要手动创建key

 

1)创建key

[root@server named]# rndc-confgen -r /dev/urandom -a

wrote key file "/etc/rndc.key"

2)更改权限

[root@server named]# rndc status

rndc: connect failed: 127.0.0.1#953: connection refused

 

[root@server named]# cat /etc/rndc.key

key "rndc-key" {

    algorithm hmac-md5;

    secret "MEARtiTMJzFfRwBKlY5lpQ==";

};

 

[root@server named]# ls -l /etc/rndc.key

-rw------- 1 root root 77 May  1 06:57 /etc/rndc.key

 

[root@server named]# chown root:named /etc/rndc.key

[root@server named]# chmod 644 /etc/rndc.key

[root@server named]# rndc status

rndc: connect failed: 127.0.0.1#953: connection refused

 

重启named服务!

3)验证

[root@server named]# /etc/init.d/named restart

Stopping named: .                                          [  OK  ]

Starting named:                                            [  OK  ]

 

[root@server named]# /etc/init.d/named status

version: 9.7.3-P3-RedHat-9.7.3-8.P3.el6

CPUs found: 1

worker threads: 1

number of zones: 21

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  4224) is running...

 

[root@server named]# rndc status

version: 9.7.3-P3-RedHat-9.7.3-8.P3.el6

CPUs found: 1

worker threads: 1

number of zones: 21

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

 

 

 

 

你可能感兴趣的:(dns)