DNS

1.[root@localhost ~]# sh yum.sh

yum已完成

关闭防火墙

关闭selinux

2. rpm -qa |grep bin    ====>查看有没有安装软件包

3. [root@localhost ~]# yum -y install bind bind-chroot   ==>安装软件

4. [root@localhost ~]# rpm -qa |grep -w bind ==》检查所需要的安装包

bind-chroot-9.8.2-0.17.rc1.el6_4.6.x86_64

bind-libs-9.8.2-0.17.rc1.el6_4.6.x86_64

bind-utils-9.8.2-0.17.rc1.el6_4.6.x86_64

bind-9.8.2-0.17.rc1.el6_4.6.x86_64

5. [root@localhost etc]# cd /etc/

6. [root@localhost etc]# cp named.conf named.conf.$(date +%Y%m%d)

7. 配置文件

   root@localhost etc]# vim named.conf

   Options {

        listen-on port 53 { 192.168.1.66; };

//      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; };

        forwarders      {202.106.0.20;};

        recursion yes;

8. 语法验证

  [root@localhost ~]# named-checkconf /etc/named

  [root@localhost ~]# /etc/init.d/named start

  [root@localhost ~]# /etc/init.d/named start

Generating /etc/rndc.key:          

                                               [确定]

启动 named:                                  [确定]

9. 区域数据文件

 [root@localhost ~]# ls /var/named/

chroot  dynamic   named.empty      named.loopback

data    named.ca  named.localhost  slaves

[root@localhost ~]# ls /var/named/chroot/

dev  etc  usr  var

[root@www etc]# vim /var/named/named.localhost

 

10区域数据文件修改后检查

  [root@www ~]# named-checkzone  www /var/named/named.localhost

zone www/IN: loaded serial 0

OK

  配置案例 北京网通

[root@www ~]# vim /etc/named.conf

 

语法验证

[root@www ~]# named-checkconf /etc/named.conf

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

停止 named.                                           [确定]

启动 named:                                            [确定]

客户机设置DNS

[root@www ~]# vim /etc/resolv.conf

[root@www ~]# nslookup www.baidu.com

Server: 192.168.1.66

Address: 192.168.1.66#53

 

Non-authoritative answer:

www.baidu.com canonical name = www.a.shifen.com.

Name: www.a.shifen.com

Address: 61.135.169.125

Name: www.a.shifen.com

Address: 61.135.169.121

10. 根域解析

//

 

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; };

        forwarders      {202.106.0.20;};

recursion yes;

 

// dnssec-enable no;

// dnssec-validation no;

// dnssec-lookaside auto;

 

/* Path to ISC DLV key */

bindkeys-file "/etc/named.iscdlv.key";

 

managed-keys-directory "/var/named/dynamic";

};

 

logging {

        channel default_debug {

                file "data/named.run";

                severity dynamic;

        };

};

 

//zone "." IN {

// type hint;

// file "named.ca";

//};

 

//include "/etc/named.rfc1912.zones";

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

验证

[root@www ~]# nslookup www.baidu.com

Server: 192.168.1.66

Address: 192.168.1.66#53

Non-authoritative answer:

www.baidu.com canonical name = www.a.shifen.com.

Name: www.a.shifen.com

Address: 61.135.169.125

Name: www.a.shifen.com

11. 模拟误删除的文件内容

 

拍错语法

1.[root@www ~]# named-checkconf /etc/named.conf

/etc/named.conf:15: missing ';' before 'statistics-file

2. [root@www ~]# tail -f /var/log/messages ==》动态日志

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

停止 named:                                               [确定]

启动 named

Error in named configuration:

/etc/named.conf:15: missing ';' before 'statistics-file'

                                                           [失败]

你可能感兴趣的:(DNS)