Blog信息 |
blog名称: 日志总数:1304 评论数量:2242 留言数量:5 访问次数:7593324 建立时间:2006年5月29日 |

| |
[网络与系统管理]测试bind view 软件技术
lhwork 发表于 2007/1/8 10:17:20 |
测试系统:CentOs4
Bind软件:bind-9.2.4-2caching-nameserver-7.3-3
测试机器IP情况:A机器:域名服务器 IP: 192.168.1.242B机器:普通客户端:192.168.1.247
测试时间:2005年06月01日(国际儿童节哦:))
为什么要进行这个测试?因为考虑到做大型网站构架的流量将是非常大,所以考虑到让DNS来做分流!
一、安装yum -y install caching-nameserver会自动安装所需依赖包
二、配置配置dns有一般要主要2个文件:1是/etc/named.conf,这个view的内容都是在这个文件里面2是bixuan.com(测试域名)这个是域名的具体记录信息,包括A、NS等记录信息
1.修改/etc/named.conf文件如下内容:vi /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//view “telcom” { // This should match our internal networks. match-clients { 192.168.1.247;}; // Provide recursive service to internal clients only. recursion yes; zone “.” { type hint; file “named.ca”; }; zone “0.0.127.IN-ADDR.ARPA” { type master; file “named.local”; }; // Provide a complete view of the mydomain.com zone // including addresses of internal hosts. zone “bixuan.com” { type master; file “data/telcom/bixuan.com”; };}; view “netcom” { // 这里建立一个叫netcom的view,其实这个netcom是可以自己定义,随便写的,下面也是一样的 // This should match our internal networks. match-clients { 192.168.1.242; }; // 这里是定义哪些IP或者网络过来的是用哪个配置。这里如果:192.168.1.242;改成:192.168.1.242;192.168.1.243;也是可以的,当然改成IP段也是可以,下同 // Provide recursive service to internal clients only. recursion yes; zone “.” { type hint; file “named.ca”; }; zone “0.0.127.IN-ADDR.ARPA” { type master; file “named.local”; }; // Provide a complete view of the mydomain.com zone // including addresses of internal hosts. // 特别要注意的还有这个地方: zone “bixuan.com” { // 这里的bixuan.com必须是域名名称,下同 type master; // 这里表示是主DNS,如果改成辅助的:type slave就是这样,下同 file “data/netcom/bixuan.com”; // 这里表示配置文件的相对地址,下同 };};view “external” { match-clients { any; }; // Refuse recursive service to external clients. recursion no; // Provide a restricted view of the mydomain.com zone // containing only publicly accessible hosts. zone “bixuan.com” { type master; file “data/external/bixuan.com”; };};
include “/etc/rndc.key”;2.建立bixuan.com配置文件mkdir -p /var/named/data/telcommkdir -p /var/named/data/netcommkdir -p /var/named/data/external下面是telcom下的bixuan.com文件:cat /var/named/data/telcom/bixuan.com$TTL 43200@ IN SOA ns1.bixuan.com. root.test.com. ( 1022351740 ;serial 3H ;refresh after 3 hours 3600 ;retry after 1 hour 604800 ;expire after 1 week 86400 ) ;minimum TTL of 1 day;; Nameservers; Put your nameservers here! IN NS ns1.test.com. IN NS ns2.test.com.;; Domain Mail Handlers;; IN MX 0 mail
;;; hosts in order;;cachemcc IN A 211.140.138.17;cachecnc IN A 221.6.145.41ns1 IN A 192.168.1.242ns2 IN A 192.168.1.248@ IN A 192.168.1.242www IN A 192.168.1.242
;pop IN CNAME mail;ftp IN A 61.153.35.238;; end
三、启动/etc/init.d/named start如果是修改了配置文件后,必须restart或者reload(一般采用reload)
四、测试下面进行简单的测试,看配置是否有错
A机器首先把A机器上的DNS改成:192.168.1.242,即:cat /etc/resolv.confnameserver 192.168.1.242
接着:# nslookup> bixuan.comServer: 192.168.1.242Address: 192.168.1.242#53
Name: bixuan.comAddress: 192.168.1.243
B机器:先把B机器上的DNS修改成只有:192.168.1.242
接着执行:C:\>nslookupDNS request timed out. timeout was 2 seconds.*** Can’t find server name for address 192.168.1.242: Timed out*** Default servers are not availableDefault Server: UnKnownAddress: 192.168.1.242
> bixuan.comServer: UnKnownAddress: 192.168.1.242
Name: bixuan.comAddress: 192.168.1.242
注意粉红色的IP,是不是不同了?
相关文章:http://sysadmin.oreilly.com/news/views_0501.html
附录:教育网的IP段分布:#######################加入来自CERNET的DNS请求转发规则,将其转发到本地54端口,CERNET地址列表可从#www.nic.edu.cn/RS/ipstat/获得162.105.0.0/16166.111.0.0/16202.4.128.0/19202.112.0.0/15202.38.96.0/19202.204.0.0/14210.25.0.0/16210.31.0.0/16211.68.0.0/16211.71.0.0/16
202.200.0.0/15210.26.0.0/15
202.115.0.0/16202.202.0.0/16210.40.0.0/15202.203.0.0/16
202.116.0.0/16202.192.0.0/15210.36.0.0/14202.38.192.0/18211.66.0.0/16
202.114.0.0/16202.196.0.0/15210.42.0.0/15211.69.0.0/16211.67.0.0/16
202.38.64.0/19202.119.0.0/16202.194.0.0/15210.44.0.0/15202.38.64.0/19210.28.0.0/15211.64.0.0/15211.70.0.0/16
202.120.0.0/15210.32.0.0/14211.80.0.0/16
202.118.0.0/16210.46.0.0/15210.30.0.0/16######################## |
|
|