要安装的bind* 、caching-nameserver 包
1、/var/named/chroot/etc/named.conf
这个文件需要自己创建
options {
listen-on port 53 { 192.168.0.9; };
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 { 192.168.0.0/24; };
};
zone "." IN {
type hint;
file "named.ca";
};
zone "test.com" IN {
type master;
file "test.com.zone";
};
zone "0.168.192.in-addr.arpa" IN {
type master;
file "0.168.192.in-addr.arpa.zone";
};
检验:
named-checkconf /var/named/chroot/etc/named.conf
2、/var/named/chroot/var/named/test.com.zone
正向解析
$TTL 86400
@ IN SOA mail.test.com. root.test.com. (
2009060500 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
@ IN NS mail.test.com.
mail IN A 192.168.0.9
@ IN MX 5 mail.test.com.
mail IN A 192.168.0.9
www IN A 192.168.0.99
检验:
named-checkzone test.com /var/named/chroot/var/named/test.com.zone
3、/var/named/chroot/var/named/0.168.192.in-addr.arpa.zone
反向解析
$TTL 86400
@ IN SOA mail.test.com. root.test.com. (
2009060500 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
@ IN NS mail.test.com.
9 IN PTR mail.test.com.
@ IN MX 5 mail.test.com.
9 IN PTR mail.test.com.
99 IN PTR .
named-checkzone test.com /var/named/chroot/var/named/0.168.192.in-addr.arpa.zone
4、主意文件的权限是644
/var/named/chroot/var/named/
-rw-r--r-- 1 root root 306 Jul 15 04:08 0.168.192.in-addr.arpa.zone
-rw-r--r-- 1 root root 300 Jul 15 03:57 test.com.zone
/var/named/chroot/etc/
-rw-r--r-- 1 root root 486 Jul 15 03:27 named.conf
5、更改你的/etc/resolv.conf
nameserver 192.168.0.9
6、测试
dig -t soa test.com
dig -t mx michael.com
dig mail.michael.com
dig -x 192.168.0.9
nslookup
********************************************************************
辅助DNS
1、在主的DNS named.conf 加一条 allow-transfer {192.168.0.8;}; 意思是允许8这台机器复制主DNS文件
2、8这台机named.conf的配置
options {
directory "/var/named";
};
zone "test.com" IN {
type slave;
file "slaves/test.com.zone";
masters { 192.168.0.9; };
};
zone "0.168.192.in-addr.arpa" IN {
type slave;
file "slaves/0.168.192.in-addr.arpa.zone";
masters { 192.168.0.9; };
};
3、重启named服务后,如果成功的话在 /var/named/chroot/ver/named/slaver 下会出现两个文件,是从主DNS那里复杂过来的。如果不成功,有可能是iptables的问题。
-rw-r--r-- 1 named named 464 03-09 19:21 0.168.192.in-addr.arpa.zone
-rw-r--r-- 1 named named 427 03-09 19:20 test.com.zone
4、修改 /etc/resolv.conf ,改变成 nameserver 127.0.0.1
5、然后测试下,没问题就是成功了!
********************************************************************
添加多条网段DNS
options {
listen-on port 53 { 192.168.0.9; };
directory "/var/named";
allow-transfer {192.168.0.8;};
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 { 192.168.0.0/24; };
};
zone "." IN {
type hint;
file "named.ca";
};
zone "test.com" IN {
type master;
file "test.com.zone";
};
zone "0.168.192.in-addr.arpa" IN {
type master;
file "0.168.192.in-addr.arpa.zone";
};
zone "dony.boob" IN {
type master;
file "dony.boob.zone";
};
zone "1.168.192.in-addr.arpa" IN {
type master;
file "1.168.192.in-addr.arpa.zone";
};
zone "yoyo.boob" IN {
type master;
file "yoyo.boob.zone";
};
zone "2.168.192.in-addr.arpa" IN {
type master;
file "2.168.192.in-addr.arpa.zone";
};
添加相应的正反向文件,
-rw-r--r-- 1 root root 399 Jul 18 06:05 0.168.192.in-addr.arpa.zone
-rw-r--r-- 1 root root 321 Jul 18 06:48 1.168.192.in-addr.arpa.zone
-rw-r--r-- 1 root root 228 Jul 18 07:18 2.168.192.in-addr.arpa.zone
drwxrwx--- 2 named named 4096 Jul 15 04:14 data
-rw-r--r-- 1 root root 224 Jul 18 06:57 dony.boob.zone
-rw-r----- 1 root named 198 Jul 19 2007 localdomain.zone
-rw-r----- 1 root named 195 Jul 19 2007 localhost.zone
-rw-r----- 1 root named 427 Jul 19 2007 named.broadcast
-rw-r----- 1 root named 2518 Jul 19 2007 named.ca
-rw-r----- 1 root named 424 Jul 19 2007 named.ip6.local
-rw-r----- 1 root named 426 Jul 19 2007 named.local
-rw-r----- 1 root named 427 Jul 19 2007 named.zero
drwxrwx--- 2 named named 4096 Jul 27 2004 slaves
-rw-r--r-- 1 root root 365 Jul 18 06:06 test.com.zone
-rw-r--r-- 1 root root 225 Jul 18 07:17 yoyo.boob.zone
阅读(592) | 评论(0) | 转发(0) |