First, the environment preparation.
centos6.5 x64.
1. Yum-y Install bind #安装DNS服务器
2, vim/etc/named.conf
Options {
Listen-on Port: (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";
allow-query {any;}; # Modify
recursion Yes;
#include "/etc/named.root.key"; #注释改行.
3, service named restart #启动服务
Chkconfig--level named on #开机启动.
4, Vim/etc/named.rfc1912.zones
Zone "Wspjing.com" in {
Type master;
File "Wspjing.com.zone"; #创建该文件
};
Zone "2.37.10.in-addr.arpa" in {
Type master;
File "10.37.2.zone"; #创建该文件
};
Zone "Leo.com" in {
Type master;
File "Leo.com.zone"; #创建该文件
};
5, Vim/var/named/wspjing.com.zone
$TTL 86400
@ in SOA dns.wspjing.com. Root.wspjing.com. (
2011091200; Serial #
3H; Refresh #
1H; Retry #
1W; Expire #
0); Minimum #
@ in NS dns.wspjing.com. # Primary DNS
DNS in A 10.37.2.16
www in A 10.37.2.16
Leo in A 10.37.2.12 #leo. Domain name wspjing.com. equals level two domain name.
6, Vim/var/named/leo.com.zone
$TTL 86400
@ in SOA dns.wspjing.com. Root.wspjing.com. (
2011091200; Serial #
3H; Refresh #
1H; Retry #
1W; Expire #
0); Minimum #
@ in NS dns.wspjing.com.
www in A 10.37.2.226 #两个域名指向一个IP地址.
www in A 10.37.2.210
7, Vim/var/named/10.37.2.zone
$TTL 86400
@ in SOA dns.wspjing.com. Root.wspjing.com. (
2011091200; Serial
3H; Refresh
1H; Retry
1W; Expire
0); Minimum
@ in NS dns.wspjing.com.
16.2.37.10.in-addr.arpa. In PTR dns.wspjing.com. #不要忘记域名后面的.
In PTR www.wspjing.com.
226.2.37.10.in-addr.arpa. In PTR www.leo.com.
In PTR www.leo.com.
8, service named restart
Stopping named: [OK]
Starting named: [OK]
9, Nslookup
> dns.wspjing.com
server:10.37.2.16
address:10.37.2.16#53
Name:dns.wspjing.com
address:10.37.2.16
> 10.37.2.16
server:10.37.2.16
address:10.37.2.16#53
16.2.37.10.in-addr.arpa name = www.wspjing.com.
16.2.37.10.in-addr.arpa name = dns.wspjing.com.
> dns.wspjing.com
server:10.37.2.16
address:10.37.2.16#53
Name:dns.wspjing.com
address:10.37.2.16
> www.leo.com
server:10.37.2.16
address:10.37.2.16#53
Name:www.leo.com
address:10.37.2.226
Name:www.leo.com
address:10.37.2.210
> 10.37.2.226
server:10.37.2.16
address:10.37.2.16#53
226.2.37.10.in-addr.arpa name = www.leo.com.
> 10.37.2.210
server:10.37.2.16
address:10.37.2.16#53
210.2.37.10.in-addr.arpa name = www.leo.com.
>
This article from "Flying Screaming to" blog, please be sure to keep this source http://065432.blog.51cto.com/3079397/1723245
DNS Server Setup