免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1409 | 回复: 5
打印 上一主题 下一主题

配置DNS for Redhat linux 9 实例 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2004-12-30 14:24 |只看该作者 |倒序浏览
常受到在Redhat linux 9 上配置DNS困扰的朋友,请参考:
20041230  config the new DNS for step.com in linux9

Domain step.com
nameserver 192.168.192.8
search step.com

bind 9.2.1



[root@localhost named]# pwd
/var/named
[root@localhost named]# ls
192.168.192.in-addr.arpa  named.ca     named.pid
localhost.zone            named.local  step.com
[root@localhost named]# more /etc/named.conf
// generated by named-bootconf.pl

options {
        directory "/var/named";
        pid-file "/var/named/named.pid";
        /*
         * 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 "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 "192.168.192.in-addr.arpa" IN {
        type master;
        file "192.168.192.in-addr.arpa";
};
zone "step.com" {
        type master;
        file "step.com";
};

include "/etc/rndc.key";
[root@localhost named]# more 192.168.192.in-addr.arpa
$ORIGIN 192.168.192.in-addr.arpa.
$TTL    86400
@       IN      SOA     jimw.step.com.  root.step.com. (
                                        2004123000
                                        10800
                                        3600
                                        604800
                                        3600
)
@       IN      NS      step.com.
18      IN      PTR     step.com.
18      IN      PTR     jimw.step.com.
[root@localhost named]# more step.com
$ORIGIN step.com.
$TTL 86400
@       IN      SOA     jimw.step.com.  root.step.com. (
                                        2004123000
                                        10800
                                        36000
                                        604800
                                        3600
)
@       IN      NS      step.com.
jimw    IN      A       192.168.192.18
step.com.       IN      A       192.168.192.18
jimw.step.com.  IN      A       192.168.192.18

[root@localhost named]# more named.ca
;       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
;
;       last update:    Nov 5, 2002
;       related version of root zone:   2002110501
;
;
; 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     128.9.0.107
;
; 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
;
; housed in LINX, operated by RIPE NCC
;
.                        3600000      NS    K.ROOT-SERVERS.NET.
K.ROOT-SERVERS.NET.      3600000      A     193.0.14.129
;
; operated by IANA
;
.                        3600000      NS    L.ROOT-SERVERS.NET.
L.ROOT-SERVERS.NET.      3600000      A     198.32.64.12
;
; housed in Japan, operated by WIDE
;
.                        3600000      NS    M.ROOT-SERVERS.NET.
M.ROOT-SERVERS.NET.      3600000      A     202.12.27.33
; End of File
[root@localhost named]# more named.local
$TTL    86400
@       IN      SOA     jimw.step.com. root.step.com.  (
                                      2004123000 ; Serial
                                      28800      ; Refresh
                                      14400      ; Retry
                                      3600000    ; Expire
                                      86400 )    ; Minimum
@              IN      NS      step.com.

1               IN      PTR     localhost.
[root@localhost named]# more localhost.zone
$TTL    86400
$ORIGIN localhost.
@                       1D IN SOA       @ root (
                                        42              ; serial (d. adams)
                                        3H              ; refresh
                                        15M             ; retry
                                        1W              ; expiry
                                        1D )            ; minimum

                        1D IN NS        @
                        1D IN A         127.0.0.1
[root@localhost named]# more named.pid
2151
[root@localhost named]# ls
192.168.192.in-addr.arpa  named.ca     named.pid
localhost.zone            named.local  step.com
[root@localhost named]# more /etc/nsswitch.conf
#
# /etc/nsswitch.conf
#
# An example Name Service Switch config file. This file should be
# sorted with the most-used services at the beginning.
#
# The entry '[NOTFOUND=return]' means that the search for an
# entry should stop if the search in the previous entry turned
# up nothing. Note that if the search failed due to some other reason
# (like no NIS server responding) then the search continues with the
# next entry.
#
# Legal entries are:
#
#       nisplus or nis+         Use NIS+ (NIS version 3)
#       nis or yp               Use NIS (NIS version 2), also called YP
#       dns                     Use DNS (Domain Name Service)
#       files                   Use the local files
#       db                      Use the local database (.db) files
#       compat                  Use NIS on compat mode
#       hesiod                  Use Hesiod for user lookups
#       [NOTFOUND=return]       Stop searching if not found so far
#

# To use db, put the "db" in front of "files" for entries you want to be
# looked up first in the databases
#
# Example:
#passwd:    db files nisplus nis
#shadow:    db files nisplus nis
#group:     db files nisplus nis

passwd:     files
shadow:     files
group:      files

#hosts:     db files nisplus nis dns
hosts:      files dns

# Example - obey only what nisplus tells us...
#services:   nisplus [NOTFOUND=return] files
#networks:   nisplus [NOTFOUND=return] files
#protocols:  nisplus [NOTFOUND=return] files
#rpc:        nisplus [NOTFOUND=return] files
#ethers:     nisplus [NOTFOUND=return] files
#netmasks:   nisplus [NOTFOUND=return] files     

bootparams: nisplus [NOTFOUND=return] files

ethers:     files
netmasks:   files
networks:   files
protocols:  files
rpc:        files
services:   files

netgroup:   files

publickey:  nisplus

automount:  files
aliases:    files nisplus

[root@localhost named]# more /etc/resolv.conf
nameserver 192.168.192.18
search step.com
[root@localhost named]# pwd
/var/named
[root@localhost named]# ls
192.168.192.in-addr.arpa  named.ca     named.pid
localhost.zone            named.local  step.com
[root@localhost named]# more /etc/named.conf
// generated by named-bootconf.pl

options {
        directory "/var/named";
        pid-file "/var/named/named.pid";
        /*
         * 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 "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 "192.168.192.in-addr.arpa" IN {
        type master;
        file "192.168.192.in-addr.arpa";
};
zone "step.com" {
        type master;
        file "step.com";
};

include "/etc/rndc.key";
[root@localhost named]# more 192.168.192.in-addr.arpa
$ORIGIN 192.168.192.in-addr.arpa.
$TTL    86400
@       IN      SOA     jimw.step.com.  root.step.com. (
                                        2004123000
                                        10800
                                        3600
                                        604800
                                        3600
)
@       IN      NS      step.com.
18      IN      PTR     step.com.
18      IN      PTR     jimw.step.com.
[root@localhost named]# more step.com
$ORIGIN step.com.
$TTL 86400
@       IN      SOA     jimw.step.com.  root.step.com. (
                                        2004123000
                                        10800
                                        36000
                                        604800
                                        3600
)
@       IN      NS      step.com.
jimw    IN      A       192.168.192.18
step.com.       IN      A       192.168.192.18
jimw.step.com.  IN      A       192.168.192.18

[root@localhost named]# more named.ca
;       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
;
;       last update:    Nov 5, 2002
;       related version of root zone:   2002110501
;
;
; 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     128.9.0.107
;
; 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
;
; housed in LINX, operated by RIPE NCC
;
.                        3600000      NS    K.ROOT-SERVERS.NET.
K.ROOT-SERVERS.NET.      3600000      A     193.0.14.129
;
; operated by IANA
;
.                        3600000      NS    L.ROOT-SERVERS.NET.
L.ROOT-SERVERS.NET.      3600000      A     198.32.64.12
;
; housed in Japan, operated by WIDE
;
.                        3600000      NS    M.ROOT-SERVERS.NET.
M.ROOT-SERVERS.NET.      3600000      A     202.12.27.33
; End of File
[root@localhost named]# more named.local
$TTL    86400
@       IN      SOA     jimw.step.com. root.step.com.  (
                                      2004123000 ; Serial
                                      28800      ; Refresh
                                      14400      ; Retry
                                      3600000    ; Expire
                                      86400 )    ; Minimum
@              IN      NS      step.com.

1               IN      PTR     localhost.
[root@localhost named]# more localhost.zone
$TTL    86400
$ORIGIN localhost.
@                       1D IN SOA       @ root (
                                        42              ; serial (d. adams)
                                        3H              ; refresh
                                        15M             ; retry
                                        1W              ; expiry
                                        1D )            ; minimum

                        1D IN NS        @
                        1D IN A         127.0.0.1
[root@localhost named]# more named.pid
2151
[root@localhost named]# ls
192.168.192.in-addr.arpa  named.ca     named.pid
localhost.zone            named.local  step.com
[root@localhost named]# more /etc/nsswitch.conf
#
# /etc/nsswitch.conf
#
# An example Name Service Switch config file. This file should be
# sorted with the most-used services at the beginning.
#
# The entry '[NOTFOUND=return]' means that the search for an
# entry should stop if the search in the previous entry turned
# up nothing. Note that if the search failed due to some other reason
# (like no NIS server responding) then the search continues with the
# next entry.
#
# Legal entries are:
#
#       nisplus or nis+         Use NIS+ (NIS version 3)
#       nis or yp               Use NIS (NIS version 2), also called YP
#       dns                     Use DNS (Domain Name Service)
#       files                   Use the local files
#       db                      Use the local database (.db) files
#       compat                  Use NIS on compat mode
#       hesiod                  Use Hesiod for user lookups
#       [NOTFOUND=return]       Stop searching if not found so far
#

# To use db, put the "db" in front of "files" for entries you want to be
# looked up first in the databases
#
# Example:
#passwd:    db files nisplus nis
#shadow:    db files nisplus nis
#group:     db files nisplus nis

passwd:     files
shadow:     files
group:      files

#hosts:     db files nisplus nis dns
hosts:      files dns

# Example - obey only what nisplus tells us...
#services:   nisplus [NOTFOUND=return] files
#networks:   nisplus [NOTFOUND=return] files
#protocols:  nisplus [NOTFOUND=return] files
#rpc:        nisplus [NOTFOUND=return] files
#ethers:     nisplus [NOTFOUND=return] files
#netmasks:   nisplus [NOTFOUND=return] files     

bootparams: nisplus [NOTFOUND=return] files

ethers:     files
netmasks:   files
networks:   files
protocols:  files
rpc:        files
services:   files

netgroup:   files

publickey:  nisplus

automount:  files
aliases:    files nisplus

[root@localhost named]# more /etc/resolv.conf
nameserver 192.168.192.18
search step.com
>;
~[root@localhost named]# named
[root@localhost named]# tail -f /var/log/messages

Jan  8 22:32:56 localhost named[2187]: starting BIND 9.2.1
Jan  8 22:32:56 localhost named[2187]: using 1 CPU
Jan  8 22:32:56 localhost named[2187]: loading configuration from '/etc/named.conf'
Jan  8 22:32:57 localhost named[2187]: no IPv6 interfaces found
Jan  8 22:32:57 localhost named[2187]: listening on IPv4 interface lo, 127.0.0.1#53
Jan  8 22:32:57 localhost named[2187]: binding TCP socket: address in use
Jan  8 22:32:57 localhost named[2187]: listening on IPv4 interface eth0, 192.168.192.18#53
Jan  8 22:32:57 localhost named[2187]: binding TCP socket: address in use
Jan  8 22:32:57 localhost named[2187]: /etc/named.conf:20: couldn't add command channel 127.0.0.1#9e
Jan  8 22:32:57 localhost named[2187]: zone 0.0.127.in-addr.arpa/IN: loaded serial 2004123000
Jan  8 22:32:57 localhost named[2187]: zone 192.168.192.in-addr.arpa/IN: loaded serial 2004123000
Jan  8 22:32:57 localhost named[2187]: zone step.com/IN: loaded serial 2004123000
Jan  8 22:32:57 localhost named[2187]: zone localhost/IN: loaded serial 42
Jan  8 22:32:57 localhost named[2187]: running
Jan  8 22:32:57 localhost named[2187]: zone 0.0.127.in-addr.arpa/IN: sending notifies (serial 20041)
Jan  8 22:32:57 localhost named[2187]: zone step.com/IN: sending notifies (serial 2004123000)
Jan  8 22:32:57 localhost named[2187]: zone 192.168.192.in-addr.arpa/IN: sending notifies (serial 2)


[root@localhost named]# service named restart
Stopping named:
named: already running[root@localhost named]#

named: already running[root@localhost named]# named -v
BIND 9.2.1
[root@localhost named]# hostname
jimw
[root@localhost named]# nslookup -sil jimw.step.com
Server:         192.168.192.18
Address:        192.168.192.18#53

Name:   jimw.step.com
Address: 192.168.192.18

[root@localhost named]# nslookup -sil 192.168.192.18
Server:         192.168.192.18
Address:        192.168.192.18#53

18.192.168.192.in-addr.arpa     name = step.com.
18.192.168.192.in-addr.arpa     name = jimw.step.com.

[root@localhost named]#

注:
1).couldn't open pid file '/var/run/named/named.pid': Permissiod
   把/etc/named.conf pid-file 配置改为pid-file "/etc/named/named.pid";
2).用tail -f /var/log/messages调试runing情况。

论坛徽章:
0
2 [报告]
发表于 2004-12-30 14:40 |只看该作者

配置DNS for Redhat linux 9 实例

有必要这么麻烦么,弄得乱七八糟的

论坛徽章:
0
3 [报告]
发表于 2004-12-30 16:02 |只看该作者

配置DNS for Redhat linux 9 实例

我日!没什么参考性!

论坛徽章:
0
4 [报告]
发表于 2004-12-30 17:18 |只看该作者

配置DNS for Redhat linux 9 实例

上面的配置由于时间关系没有仔细说明,不过在配置DNS过程中有问题的朋友我相信会从中找到相应的参考,这是我综合许多配置文档的反复配置成功实例,我想比一般的说教要实际;
但不管怎样,贴出来是让真正有需要的朋友有些帮助,难道有些人只会谩骂吗? 可否出点好贴?
我希望cu能有些素质,多做对大家有益的事情.

论坛徽章:
1
荣誉版主
日期:2011-11-23 16:44:17
5 [报告]
发表于 2004-12-30 17:24 |只看该作者

配置DNS for Redhat linux 9 实例

原帖由 "wsb587" 发表:
上面的配置由于时间关系没有仔细说明,不过在配置DNS过程中有问题的朋友我相信会从中找到相应的参考,这是我综合许多配置文档的反复配置成功实例,我想比一般的说教要实际;
但不管怎样,贴出来是让真正有需要的朋?.........


谢谢楼主的奉献,还希望楼主对某些不礼貌的人不要介意……

论坛徽章:
0
6 [报告]
发表于 2005-01-04 12:16 |只看该作者

配置DNS for Redhat linux 9 实例

很不错的帖子  对我这样的菜鸟帮助很大!

多谢楼主  望 多发好贴!
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP