DNS服务搭建

一、下载安装bind    bind-utils
yum -y install bind bind-utils
 
二、编辑/etc/named.conf文件
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";
        allow-query     { any; };
        recursion yes;
 
view www {
        match-clients { 106.54.201.0/24; };
zone "." IN {
        type hint;
        file "named.ca";
};
 
include "/etc/named.www.zones";
include "/etc/named.root.key";
};
 
三、将/etc/named.rfc1912.zones重命名为named.www.zones并编辑named.www.zones文件
cd /etc
mv named.rfc1912.zones named.www.zones
vim /etc/named.www.zomes
zone "liujuan520.com.cn" IN {
        type master;
        file "named.localhost";
        allow-update { none; };
};
 
四、将/var/named/named.localhost 改名为www.localhost,并进行编辑
cd /var/named/
cp named.localhost www.localhost
vim /var/named/www.localhost
$TTL 1D
@       IN SOA  liujuan520.com.cn. rname.invalid. (
                                        0       ; serial
                                        1D      ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum
        NS      dns.liujuan520.com.cn.
dns     A       127.0.0.1
www     A       106.54.201.234
 
五、启用named服务
service named start
 
六、用nslookup测试
nslookup www.liujuan520.com.cn
 
 
 
 
 
 
 
 
posted @ 2020-03-25 00:03  向云而生(陈云)  阅读(180)  评论(0编辑  收藏  举报