配置文件 /etc/named.conf
日志文件 /var/log/messages
准备两台虚拟机(server (IP 192.168.56.2) , client (IP 192.168.56.3))
在server上安装DNS服务
关闭防火墙
#systemctl stop firewalld
查看DNS是否安装
#yum info named
Step1:下载服务
# yum install named bind bind-chroot bind-utils //正式安装
Step2:配置named.conf文件
# vi /etc/named.conf
listen-on port 53 { 127.0.0.1; } //127.0.0.1;改成any;
allow-query { localhost; } //localhost;改成any;
在底部插入文本
zone "mysite.com" IN {
type master;
file "mysite.com.zone";
allow-update { none; };
};
Step3:增加自定义域名解析文件及反向解析
# cd /var/named
Step4:拷贝服务到域名
#cp /usr/share/doc/bind-9.9.4/sample/var/named/named.localhost\
./mysite.com.zone
Step5:添加A数据
#vi mysite.com.zone
www<Tab>IN A<Tab>192.168.1.100
Step6:配置服务
#systemctl start named
Step7:在client上配置resolv.conf
#vi /etc/resolv.conf
nameserver 192.168.56.2 //nameserver 221.228.255.1前加“#”
Step8:测试DNS服务
#ping www.mysite.com
PING www.mysite.com (192.168.1.100) 56(84) bytes of data.
From 10.20.1.1 icmp_seq=1 Time to live exceeded
From 10.20.1.1 icmp_seq=2 Time to live exceeded
From 10.20.1.1 icmp_seq=3 Time to live exceeded
网友评论