标签:dns named
yum安装dns软件:
[root@leslie ~]# yum -y instal bind bind-chroot
配置:
1:主配置文件:(文件内声明正向解析与反向解析和区域文件)
[root@leslie ~]# cd /var/named/chroot/etc/ [root@leslie etc]# vim named.conf [root@leslie etc]# cat named.conf options { directory "/var/named"; }; zone "lesliecheung.com." IN { type master; file "lesliecheung.com.zone"; }; zone "100.168.192.in-addr.arpa" IN { type master; file "192.168.100.arpa"; };
2:区域文件:
[root@leslie ~]# cd /var/named/chroot/var/named/
[root@leslie named]# vim leslie.com.zone ##添加正向解析 [root@leslie named]# cat leslie.com.zone $TTL 86400 @ IN SOA lesliecheung.com. root.lesliecheung.com. ( 20150630 1H 2M 3W 1D ) @ IN NS ns.lesliecheung.com. mail IN MX 10 mail.lesliecheung.com. @ IN A 192.168.100.100 mail IN A 192.168.100.100 ns IN A 192.168.100.100 ftp IN A 192.168.100.100 ntp IN CNAME ns www IN A 192.168.100.150
##添加反向解析: [root@leslie named]# cat 192.168.100.arpa $TTL 86400 @INSOAlesliecheung.com.root.lesliecheung.com. ( 20150630 1H 2M 3W 1D ) @INNSns.lesliecheung.com. mailINMX 10mail.lesliecheung.com. 100INPTRns.lesliecheung.com. 100INPTRntp.lesliecheung.com. 100INPTRftp.lesliecheung.com. 150INPTRwww.lesliecheung.com.
修改dns软件named的所属:
[root@leslie ~]# [root@leslie ~]# cd /var/named/chroot/ [root@leslie chroot]# chown named.named etc/named.conf var/named/leslie.com.zone var/named/192.168.100.arpa [root@leslie chroot]# ll etc/named.conf var/named/leslie.com.zone var/named/192.168.100.arpa -rw-r--r-- 1 named named 196 10月 10 19:48 etc/named.conf -rw-r--r-- 1 named named 293 10月 10 19:54 var/named/192.168.100.arpa -rw-r--r-- 1 named named 287 10月 10 19:52 var/named/leslie.com.zone
启动dns:
[root@leslie ~]# /etc/init.d/named start 启动 named: [确定]
测试:
[root@leslie ~]# nslookup > server 192.168.100.100 Default server: 192.168.100.100 Address: 192.168.100.100#53 > www.lesliecheung.com Server:192.168.100.100 Address:192.168.100.100#53 Name:www.lesliecheung.com Address: 192.168.100.150 > 192.168.100.150 Server:192.168.100.100 Address:192.168.100.100#53 150.100.168.192.in-addr.arpaname = www.lesliecheung.com. > 192.168.100.100 Server:192.168.100.100 Address:192.168.100.100#53 100.100.168.192.in-addr.arpaname = ftp.lesliecheung.com. 100.100.168.192.in-addr.arpaname = ns.lesliecheung.com. 100.100.168.192.in-addr.arpaname = ntp.lesliecheung.com.
本文出自 “向往技术的小白” 博客,请务必保留此出处http://lesliecheung.blog.51cto.com/12622169/1971137
标签:dns named
原文地址:http://lesliecheung.blog.51cto.com/12622169/1971137