--dns配置详解
http://space.itpub.net/?uid-9094533-action-viewspace-itemid-73572
---启动dns named失败
[root@rhel5 named]# service named start
Starting named: [FAILED]
---查看系统日志
[root@rhel5 log]# tail -50 /var/log/messages
May 6 11:01:39 rhel5 named[5497]: could not configure root hints from 'named.root': file not found
---进入如下目录
[root@rhel5 etc]# cd /var/named
--复制一个提示找不到的文件
[root@rhel5 named]# cp -a named.local named.root
--启动成功
[root@rhel5 named]# service named start
Starting named: [ OK ]
[root@rhel5 named]# ps -ef|grep name
named 5539 1 0 11:05 ? 00:00:00 /usr/sbin/named -u named
root 5550 5447 0 11:05 pts/1 00:00:00 grep name
dns正向解析配置如下
----------------------------------------------------
[root@rhel5 named]# more /etc/named.conf
// Red Hat BIND Configuration Tool
//
// Default initial "Caching Only" name server configuration
//
//options为一个节,指定dns全局配置信息
options {
directory "/var/named"; //directory指定域配置文件所在的目录
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
/*
* If there is a firewall between you and nameservers you want
* to talk to, you might need to uncomment the query-source
* directive below. Previous versions of BIND always asked
* questions using port 53, but BIND 8.1 uses an unprivileged
* port by default.
*/
// query-source address * port 53;
};
//zone为专门的域配置文件的节,指定具体的域配置文件名称相关信息
zone "." IN {
type hint;
file "named.root";--file指定域配置文件名称,如无此文件dns named会失败
};
zone "localdomain." IN {
type master;
file "localdomain.zone";
allow-update { none; };
};
zone "sina.com" IN { //sina.com为测试的域
type master;
file "sina.com.zone";//域配置文件名称
allow-update { none; };
};
zone "localhost." IN {
type master;
file "localhost.zone";
allow-update { none; };
};
zone "0.0.127.in-addr.arpa." IN {
type master;
file "named.local";
allow-update { none; };
};
zone "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa." IN {
type master;
file "named.ip6.local";
allow-update { none; };
};
zone "255.in-addr.arpa." IN {
type master;
file "named.broadcast";
allow-update { none; };
};
zone "0.in-addr.arpa." IN {
type master;
file "named.zero";
allow-update { none; };
};
include "/etc/rndc.key";
//如下为具体的域配置文件
[root@rhel5 named]# more /var/named/sina.com.zone
$TTL 86400
@ IN SOA ns.sina.com root.sina.com (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
IN NS ns.sina.com
ns IN A 192.168.1.1
www IN CNAME ns.sina.com
mail IN CNAME ns.sina.com
localhost IN A 127.0.0.1
[root@rhel5 named]# clear
[root@rhel5 named]# more /etc/named.conf
// Red Hat BIND Configuration Tool
//
// Default initial "Caching Only" name server configuration
//
options {
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
/*
* If there is a firewall between you and nameservers you want
* to talk to, you might need to uncomment the query-source
* directive below. Previous versions of BIND always asked
* questions using port 53, but BIND 8.1 uses an unprivileged
* port by default.
*/
// query-source address * port 53;
};
zone "." IN {
type hint;
file "named.root";
};
zone "localdomain." IN {
type master;
file "localdomain.zone";
allow-update { none; };
};
zone "sina.com" IN {
type master;
file "sina.com.zone";
allow-update { none; };
};
zone "localhost." IN {
type master;
file "localhost.zone";
allow-update { none; };
};
zone "0.0.127.in-addr.arpa." IN {
type master;
file "named.local";
allow-update { none; };
};
zone "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa." IN {
type master;
file "named.ip6.local";
allow-update { none; };
};
zone "255.in-addr.arpa." IN {
type master;
file "named.broadcast";
allow-update { none; };
};
zone "0.in-addr.arpa." IN {
type master;
file "named.zero";
allow-update { none; };
};
include "/etc/rndc.key";
[root@rhel5 named]#
[root@rhel5 named]# more /var/named/sina.com.zone
$TTL 86400
@ IN SOA ns.sina.com root.sina.com (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
IN NS ns.sina.com
ns IN A 192.168.1.1
www IN CNAME ns.sina.com
mail IN CNAME ns.sina.com
localhost IN A 127.0.0.1
[root@rhel5 named]# nslookup ns.sina.com
Server: 192.168.1.1
Address: 192.168.1.1#53
Name: ns.sina.com
Address: 192.168.1.1
[root@rhel5 named]#
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/9240380/viewspace-759864/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/9240380/viewspace-759864/