CentOS7部署DNS


在DNS服务器上:

1.安装bind:

# yum -y install bind  bind-utils

查看配置文件:

# rpm -ql bind | grep etc

/etc/logrotate.d/named
/etc/named
/etc/named.conf
/etc/named.iscdlv.key
/etc/named.rfc1912.zones
/etc/named.root.key
/etc/rndc.conf
/etc/rndc.key
/etc/rwtab.d/named
/etc/sysconfig/named
/usr/share/doc/bind-9.11.4/sample/etc
/usr/share/doc/bind-9.11.4/sample/etc/named.conf
/usr/share/doc/bind-9.11.4/sample/etc/named.rfc1912.zones

2.修改主配置文件:

# vim /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";
        recursing-file  "/var/named/data/named.recursing";
        secroots-file   "/var/named/data/named.secroots";
        allow-query     { any; };
        recursion yes;

        dnssec-enable no;
        dnssec-validation no;

3.修改etc/named.rfc1912.zones文件:

# vim etc/named.rfc1912.zones
    zone "color.com." IN {
        type master;
        file "color.com.zone";
    };

    zone "13.168.192.in-addr.arpa" IN {
        type master;
        file "13.168.192.zone";
    };

4.添加正向解析文件:

# vim /var/named/color.com.zone
$TTL 1D
@       IN      SOA     @       color.com. (
                                        0       ; serial
                                        1D      ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum
        NS      @
        A       192.168.13.188
doc     IN      A       192.168.13.200
top     IN      A       192.168.13.201
blue    IN      A       192.168.13.202

5.添加反向解析文件:

# vim /var/named/13.168.192.zone
$TTL 1D
@       IN      SOA     diyibox.com.    color.com. (
                                                0       ; serial
                                        1D      ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum

        NS      color.com.
188     IN      PTR     color.com.
200     IN      PTR     doc.color.com.
201     IN      PTR     top.color.com.
202     IN      PTR     blue.color.com.

6.开启dns服务:

# systemctl start named

7.查看进程:

# ps -ef | grep named
named     13356      1  0 15:43 ?        00:00:00 /usr/sbin/named -u named -c /etc/named.conf
root      13397   1088  0 16:05 pts/0    00:00:00 grep --color=auto named

在客户端进行:

1.下载

# yum -y install bind-utils 

2.修改客户端/etc/resolv.conf 文件:

# vim /etc/resolv.conf 
nameserver   192.168.13.188

3.测试dns:

# nslookup color.com  

Server: 192.168.13.188
Address: 192.168.13.188#53

Name: color.com
Address: 192.168.13.188

# nslookup   192.168.13.200 

200.13.168.192.in-addr.arpa name = doc.color.com.

 

posted @ 2020-07-29 16:10  Noleaf  阅读(245)  评论(0编辑  收藏  举报