Redhat7DNS搭建

搭建环境:

yum install bind*
需要编辑的文件:named.conf 反向解析文件 正向解析文件 DNS配置文件
vim /etc/named.conf #编辑主配置文件

listen-on port 53 { any; }; #修改

allow-query { any; }; #修改

zone " idcyunwei.org " IN { #增加 定义一具域名为idcyunwei.org的正向区域

    type master;

    file "idcyunwei.zx";

};

zone "10.168.192.in-addr.arpa" IN { #增加 定义一个IP为192.168.10..*的反向域区域

    type master;

    file "idcyunwei.fx";

};

cd /var/named/

cp -p named.localhost idcyunwei.zx

vim fenglin.zx #创建正向区域配置文件

$TTL 1D

@ IN SOA ns. idcyunwei.org. root. idcyunwei.org. (

                                    0       ; serial

                                    1D      ; refresh

                                    1H      ; retry

                                    1W      ; expire

                                    3H )    ; minimum

@ IN NS ns. idcyunwei.org.

ns IN A 192.168.10.139

www IN A 192.168.10.139

ftp IN CNAME www.idcyunwei.org

cp -p idcyunwei.zx idcyunwei.fx

vim fenglin.fx #创建反向区域配置文件

$TTL 1D

@ IN SOA ns. idcyunwei.org. root. idcyunwei.org. (

                                    0       ; serial

                                    1D      ; refresh

                                    1H      ; retry

                                    1W      ; expire

                                    3H )    ; minimum

@ IN NS ns. idcyunwei.org.

139 IN PTR ns. idcyunwei.org.

139 IN PTR www.idcyunwei.org.

named-checkzone idcyunwei.zx /var/named/idcyunwei.zx #检查正向区域配置文件

named-checkzone idcyunwei.fx /var/named/idcyunwei.fx #检查反向区域配置文件

systemctl start named #启动DNS服务器
systemctl restart named #重启DNS服务器
systemctl stop named #停止服务器
systemctl enable named #设为开机启动

4、测试DNS服务器

vi /etc/resolv.conf #编辑文件
nameserver 127.0.0.1 #将linux服务器的DNS设置为本身
nameserver 8.8.8.8 #为了能够访问外网需要设置备用DNS
nslookup -type=soa idcyunwei.org #测试起始授权机构SOA资源记录
nslookup -type=a www. idcyunwei.org #测试主机地址A记录资源
nslookup -type=ptr 192.168.10.10 #测试反向解析指针PTR资源记录
nslookup -type=cname ftp.idcyunwei.org #测试别名CNAME资源记录
nslookup -type=ns idcyunwei.org #测试名称服务器NS资源记录
nslookup -type=mx idcyunwei.org #测试邮件交换器MX资源记录
tail /var/log/messages #查看日志
至此,RedHat7.0 DNS服务器配置完成

猜你喜欢

转载自blog.51cto.com/12765384/2280950