首页 > 代码库 > CenOS 6 DNS服务器简要配置
CenOS 6 DNS服务器简要配置
yum install bind*
一、修改下面配置文件
vi /etc/named.conf
options {
listen-on port 53 { 192.168.100.210; };
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";
allow-query { any; };
recursion yes;
vi /etc/named.rfc1912.zones
zone "huqiang.com" IN {
type master;
file "huqiang.com.zone";
allow-update { none; };
};
zone "100.168.192.in-addr.arpa" IN {
type master;
file "192.168.100.arpa";
allow-update { none; };
};
cd /var/named/
cp -p named.localhost huqiang.com.zone
cp -p named.loopback 192.168.100.arpa
//一定要加-p这个参数,否则发现不能解析反向文件,-p是复制后不更改文件的权限。
vi huqiang.com.zone
$TTL 1D
@ IN SOA huqiang.com. root.huqiang.com. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS www.huqiang.com.
www IN A 192.168.100.210
ftp IN A 192.168.100.211
AAAA ::1
vi 192.168.100.arpa
$TTL 1D
@ IN SOA huqiang.com. root.huqiang.com. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
IN NS www.huqiang.com.
A 127.0.0.1
AAAA ::1
210 IN PTR www.huqiang.com.
211 IN PTR ftp.huqiang.com.
service named restart
重启DNS出现 Generating /etc/rndc.key:
解决方法: rndc-confgen -r /dev/urandom -a
测试是否成功:
nslookup
www.huqiang.com
本文出自 “不变的时光” 博客,请务必保留此出处http://shansongxian.blog.51cto.com/5040181/1413473