- 论坛徽章:
- 0
|
常受到在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情况。 |
|