秋水小築之Blog
http://blog.chinaunix.net/u/5302/showart_238337.html的博客, 幫了大忙,網上的很多文章都試過了都沒有很好的結果.
我安裝的centos是單CD的服務版本.安裝後已經有bind了
1.配置文件在/etc/named.conf
// named.conf for Red Hat caching-nameserver
//
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;
};
//
// a caching only nameserver config
//
controls {
inet 127.0.0.1 allow { localhost; } keys { rndckey; };
};
zone "." IN {
type hint;
file "named.ca";
};
zone "localdomain" IN {
type master;
file "localdomain.zone";
allow-update { none; };
};
zone "localhost" IN {
type master;
file "localhost.zone";
allow-update { none; };
};
zone "chenlb.com" IN {
type master;
file "chenlb.com.zone";
allow-query { any; };
allow-transfer { any; };
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";
只要添加一個zone就行,看上面
type master;
file "chenlb.com.zone";
allow-query { any; };
allow-transfer { any; };
allow-update { none; };
};
2.在/var/named/chroot/var/named/目錄裏建個chenlb.com.zone(上面的file),內容如下:
@ IN SOA chenlb.com. root.chenlb.com.(
2008050201 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS chenlb.com.
IN MX 10 mail.chenlb.com.
@ IN A 192.168.0.60
www IN A 192.168.0.60
ftp IN A 192.168.0.60
mail IN A 192.168.0.60
3.在/var/named目錄下建鏈接
# ln -s /var/named/chroot/var/named/chenlb.com.zone chenlb.com.zone
4.啓動named
5.測試前添加nds服務地址
在加
search chenlb.com
現在本機下可以ping www.chenlb.com了
要在加的機上可以使用DNS服務,要在防火牆裏允許
6.修改/etc/sysconfig/iptables添加下面的
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 53 -j ACCEPT
OK,現在在win裏添加dns地址192.168.0.60就在ping www.chenlb.com了. 呵呵