DNS (一)
DNS (Domain Name Server)
DNS的作用:把域名解析成ip地址,供客户端访问
在早期使用 /etc/hosts 代替DNS,优先级高于DNS_Server
分类: 主 master 从 slave 转发 forward============================================================
具体配置:
(1)安装:
[root@dyh1 ~]# yum install -y bind bind-chroot
[root@dyh1 ~]# rpm -ql bind bind-chroot (几个重要的文件)/etc/logrotate.d/named
/etc/rc.d/init.d/named/usr/sbin/dns-keygen/usr/sbin/named-checkconf/usr/sbin/named-checkzone/usr/share/doc/bind-9.3.6/sample/var/named/chroot
(2)配置
[root@dyh1 ~]# cd /var/named/chroot/etc/
[root@dyh1 etc]# vim named.conf (模板:/usr/share/doc/bind-9.3.6/sample/etc/named.conf)
主配置文件写完了。
区域配置文件:
[root@dyh1 etc]# cd /var/named/chroot/var/named/
/usr/share/doc/bind-9.3.6/sample/var/named/localhost.zone (模板)
[root@dyh1 named]# cp /usr/share/doc/bind-9.3.6/sample/var/named/localhost.zone /var/named/chroot/var/named/uu.com.zone
[root@dyh1 named]# vim uu.com.zone
主配置文件和区域配置文件要保证named用户能读
[root@dyh1 named]# grep named /etc/passwd
named:x:25:25:Named:/var/named:/sbin/nologin(3)服务启动
[root@dyh1 named]# /etc/init.d/named start
(4)客户端测试
[root@dyh2 ~]# vim /etc/resolv.conf
nameserver 172.16.56.1 //DNS服务器的ip
======================== 测试证明是成功的 ==========================
配置反向解析:
[root@dyh1 etc]# vim /var/named/chroot/etc/named.conf
[root@dyh1 etc]# cd /var/named/chroot/var/named/
反向区域配置文件的模板:/usr/share/doc/bind-9.3.6/sample/var/named/named.local
[root@dyh1 named]# cp /usr/share/doc/bind-9.3.6/sample/var/named/named.local 172.16.56.zone
[root@dyh1 named]# vim 172.16.56.zone
[root@dyh1 named]# /etc/init.d/named restart
* 客户端测试 *
======================================
下篇DNS将讲述 :主从同步、事务签名、子域授权、视图、DNS轮询、别名、泛解析、转发DNS