1. 更改主机名,写/etc/hosts记录

vim /etc/hosts
47.99.116.202 test.com
0.0.0.0 test.com

关闭防火墙
systemctl disable firewalld

关闭selinux
vim /etc/selinux/config
SELINUX=disabled

  1. 在DNS服务器上安装bind软件

yum -y install bind

  1. 启动DNS服务

systemctl restart named.service
systemctl enable named.service
netstat -anlp | grep named

  1. 域名服务器的配置

修改DNS服务的配置文件
vim /etc/named.conf

options {
        listen-on port 53 { localhost; };    # 将127.0.0.1改为本机IP
        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; };               # 将localhost改为any,表示所有人都能对我的DNS服务进行查询

添加域的信息写在子配置文件
vim /etc/named.rfc1912.zones

zone "test.com" IN {
        type master;
        file "data/test.com.zone";
};

编辑正向解析文件
vim /var/named/data/test.com.zone

$TTL 1D
@       IN SOA  dns.test.com. dns.www.test.com. (
                                         20171224      ; serial 
                                         1D      ; refresh 
                                         1H      ; retry 
                                         1W      ; expire 
                                         3H )    ; minimum 
@                       IN      NS      dns.test.com.
dns.test.com.           IN      A       58.48.186.194
@                       IN      MX 10   mail.www.test.com.
mail.www.test.com.      IN      A       58.48.186.194
www.test.com.           IN      A       58.48.186.194
ftp.test.com.           IN      A       58.48.186.194

重启
systemctl restart named.service

DNS服务器搭建.txt

标签: none

添加新评论