随笔-49  评论-67  文章-27  trackbacks-0
最近两天需要配置DNS服务,所以在网上看了一些资料。可是按照上面写的去做,没有一个能成功的。最后,在FC6中的rpm包中找到了一个sample,里面有配置的文件。经过简单更改,正确了。
所以贴出来,以备下次需要。
/etc/resolv.conf
domain mci.uestc.edu.cn
nameserver 
127.0.0.1
nameserver 
202.112.14.151
nameserver 
202.112.14.161
/etc/named.conf
options
{
        query
-source    port 53;
        query
-source-v6 port 53;

        
// Put files that named is allowed to write in the data/ directory:
        directory "/var/named"// the default
        dump-file               "data/cache_dump.db";
        statistics
-file         "data/named_stats.txt";

};

logging 
{
        channel default_debug {
                file 
"data/named.run";
                severity dynamic;
        };
};

zone 
"." IN {
        type hint;
        file 
"named.root";
};

zone 
"localdomain" IN {
        type master;
        file 
"localdomain.zone";
        allow
-update { none; };
};

zone 
"localhost" IN {
        type master;
        file 
"localhost.zone";
        allow
-update { none; };
};

zone 
"0.0.127.in-addr.arpa" IN {
        type master;
        file 
"named.local";
        allow
-update { none; };
};

zone 
"mci.uestc.edu.cn" IN { 
        type master;
        file 
"mci.uestc.edu.cn.zone";
};

zone 
"1.168.192.in-addr.arpa" IN {
        type master;
        file 
"named.192.168.1";
        allow
-update { none; };
};

include 
"/etc/rndc.key";

/var/named/named.root
;       This file holds the information on root name servers needed to
;       initialize cache of Internet domain name servers
;       (e.g. reference 
this file in the "cache  .  <file>"
;       configuration file of BIND domain name servers).
;
;       This file is made available by InterNIC 
;       under anonymous FTP as
;           file                
/domain/named.cache
;           on server           FTP.INTERNIC.NET
;       
-OR-                    RS.INTERNIC.NET
;
;       last update:    Jan 
292004
;       related version of root zone:   
2004012900
;
;
; formerly NS.INTERNIC.NET
;
.                        
3600000  IN  NS    A.ROOT-SERVERS.NET.
A.ROOT
-SERVERS.NET.      3600000      A     198.41.0.4
;
; formerly NS1.ISI.EDU
;
.                        
3600000      NS    B.ROOT-SERVERS.NET.
B.ROOT
-SERVERS.NET.      3600000      A     192.228.79.201
;
; formerly C.PSI.NET
;
.                        
3600000      NS    C.ROOT-SERVERS.NET.
C.ROOT
-SERVERS.NET.      3600000      A     192.33.4.12
;
; formerly TERP.UMD.EDU
;
.                        
3600000      NS    D.ROOT-SERVERS.NET.
D.ROOT
-SERVERS.NET.      3600000      A     128.8.10.90
;
; formerly NS.NASA.GOV
;
.                        
3600000      NS    E.ROOT-SERVERS.NET.
E.ROOT
-SERVERS.NET.      3600000      A     192.203.230.10
;
; formerly NS.ISC.ORG
;
.                        
3600000      NS    F.ROOT-SERVERS.NET.
F.ROOT
-SERVERS.NET.      3600000      A     192.5.5.241
;
; formerly NS.NIC.DDN.MIL
;
.                        
3600000      NS    G.ROOT-SERVERS.NET.
G.ROOT
-SERVERS.NET.      3600000      A     192.112.36.4
;
; formerly AOS.ARL.ARMY.MIL
;
.                        
3600000      NS    H.ROOT-SERVERS.NET.
H.ROOT
-SERVERS.NET.      3600000      A     128.63.2.53
;
; formerly NIC.NORDU.NET
;
.                        
3600000      NS    I.ROOT-SERVERS.NET.
I.ROOT
-SERVERS.NET.      3600000      A     192.36.148.17
;
; operated by VeriSign, Inc.
;
.                        
3600000      NS    J.ROOT-SERVERS.NET.
J.ROOT
-SERVERS.NET.      3600000      A     192.58.128.30
;
; operated by RIPE NCC
;
.                        
3600000      NS    K.ROOT-SERVERS.NET.
K.ROOT
-SERVERS.NET.      3600000      A     193.0.14.129 
;
; operated by ICANN
;
.                        
3600000      NS    L.ROOT-SERVERS.NET.
L.ROOT
-SERVERS.NET.      3600000      A     198.32.64.12
;
; operated by WIDE
;
.                        
3600000      NS    M.ROOT-SERVERS.NET.
M.ROOT
-SERVERS.NET.      3600000      A     202.12.27.33
; End of File

/var/named/localdomain.zone
$TTL    86400
@               IN SOA  localhost root (
                                        
42              ; serial (d. adams)
                                        3H              ; refresh
                                        15M             ; retry
                                        1W              ; expiry
                                        1D )            ; minimum
                IN NS           localhost
localhost       IN A            
127.0.0.1

/var/named/localhost.zone
$TTL    86400
@               IN SOA  @       root (
                                        
42              ; serial (d. adams)
                                        3H              ; refresh
                                        15M             ; retry
                                        1W              ; expiry
                                        1D )            ; minimum

                IN NS           @
                IN A            
127.0.0.1
                IN AAAA         ::
1

/var/named/named.local
$TTL    86400
@       IN      SOA     localhost. root.localhost.  (
                                      
1997022700 ; Serial
                                      
28800      ; Refresh
                                      
14400      ; Retry
                                      
3600000    ; Expire
                                      
86400 )    ; Minimum
        IN      NS      localhost.
1       IN      PTR     localhost.

/var/named/mci.uestc.edu.cn.zone
$TTL    86400
@               IN SOA  @       root (
                                        
42              ; serial (d. adams)
                                        3H              ; refresh
                                        15M             ; retry
                                        1W              ; expiry
                                        1D )            ; minimum

                IN NS           @
                IN A            
192.168.1.129
wtj             IN A            
192.168.1.147

/var/named/named.192.168.1
$TTL    86400
@       IN      SOA     mci.uestc.edu.cn. root.mci.uestc.edu.cn.  (
                                      
1997022700 ; Serial
                                      
28800      ; Refresh
                                      
14400      ; Retry
                                      
3600000    ; Expire
                                      
86400 )    ; Minimum
        IN      NS      mci.uestc.edu.cn.
129     IN      PTR     mci.uestc.edu.cn.
147     IN      PTR     wtj.mci.uestc.edu.cn.


配置完成后重启DNS服务,
service named restart
接下来,测试配置结果
nslookup localhost
Server:         127.0.0.1
Address:        127.0.0.1#53

Name:   localhost
Address: 127.0.0.1

nslookup mci.uestc.edu.cn
Server:         127.0.0.1
Address:        127.0.0.1#53

Name:   mci.uestc.edu.cn
Address: 192.168.1.129

nslookup wtj.mci.uestc.edu.cn
Server:         127.0.0.1
Address:        127.0.0.1#53

Name:   wtj.mci.uestc.edu.cn
Address: 192.168.1.147

posted on 2006-12-28 20:05 思考 阅读(445) 评论(0)  编辑  收藏 所属分类: Linux技术

只有注册用户登录后才能发表评论。


网站导航: