想到局域网上建一个dns服务器,昨天晚上搞了好久都不成,包括今天也发了好多时间也不能通过.最后找到
秋水小筑之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就行,看上面
zone "chenlb.com" IN {
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),内容如下:
$TTL 86400
@ 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目录下建链接
# ch /var/named
# ln -s /var/named/chroot/var/named/chenlb.com.zone chenlb.com.zone
4.启动named
# /etc/init.d/named start
5.测试前添加nds服务地址
# vi /etc/resolv.conf
在加
nameserver 192.168.0.60
search chenlb.com
说明:192.168.0.60是我本机地址
现在本机下可以ping www.chenlb.com了
要在加的机上可以使用DNS服务,要在防火墙里允许
6.修改/etc/sysconfig/iptables添加下面的
-A RH-Firewall-1-INPUT -p udp -m udp --dport 53 -j ACCEPT
-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了. 呵呵
posted on 2008-05-02 20:46
流浪汗 阅读(1008)
评论(0) 编辑 收藏 所属分类:
Linux