分类: LINUX
2013-01-04 14:00:52
虚拟机下DNS的搭建
实验环境:
(1) DNS域: frg.com
(2) DNS服务器主机名:lx.frg.com ,主机IP 地址:192.168.0.211
(3) WWW服务器:www.frg.com , 解析IP 地址:192.168.0.211
(4)主机名与IP地址的定义文件
# Do not remove the following line, or various programs
# that require network functionality will fail.
192.168.0.211 lx.frg.com lx
192.168.0.211 www
(5) 域名解析服务器文件
#; generated by /sbin/dhclient-script
nameserver 192.168.0.211
search lx.frg.com
domain lx.frg.com
实现功能:提供单位信息域名在Internet网络环境中:
l 域名与IP地址的正向解析 l IP地址与域名的反向解析
一、操作步骤:
1、挂载:挂载前需要把connection打钩,再选择镜像,ok,重启机器
2、挂载:mount /dev/cdrom /mnt
3、配好yum,执行 yum makecache
二、配置主配置文件、配置主zone 文件、配置正向和反向文件
1、配置主配置文件:vi /etc/named.caching-nameserver.conf
options {
listen-on port 53 { any; };
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";
// Those options should be used carefully because they disable port
// randomization
// query-source port 53;
// query-source-v6 port 53;
allow-query { any; };
allow-query-cache { any; };
forwarders { 202.106.0.20; };
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
view localhost_resolver {
match-clients { any; };
match-destinations { any; };
recursion yes;
include "/etc/named.rfc1912.zones";
2、配置正反解查询文件: vi /etc/named.rfc1912.zones
在文件最后加入下面俩段内容:
zone "frg.com" IN {
type master;
file "frg.com.zone.db";
};
zone "0.168.192.in-addr.arpa" IN {
type master;
file "192.168.0.in-addr.arpa.local";
};
3、配置正向解析文件,注意文件名和格式:
$TTL 86400
@ IN SOA lx.frg.com. root.lx.frg.com. (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
IN NS lx.frg.com.
www IN A 192.168.0.211
4、配置反向解析文件:
$TTL 86400
@ IN SOA lx.frg.com. root.lx.frg.com. (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
IN NS lx.frg.com.
211 IN PTR .
第二次搭建遇到的主要问题:
原因:主配置文件的反向域解析文件名称写错:
正确的:
zone "0.168.192.in-addr.arpa" IN {
type master;
file "192.168.0.in-addr.arpa.local";
错误的:
zone "0.168.192.in-addr.arp" IN {
type master;
file "192.168.0.in-addr.arp.local";