1.[root@michael ~]# rpm -qa | grep bind

bind-chroot-9.2.4-16.EL4

bind-libs-9.2.4-16.EL4

bind-9.2.4-16.EL4

ypbind-1.17.2-8

bind-utils-9.2.4-16.EL4

2.[root@michael ~]# rpm -e bind-chroot

[root@michael ~]# rpm -qa | grep bind

bind-libs-9.2.4-16.EL4

bind-9.2.4-16.EL4

ypbind-1.17.2-8

bind-utils-9.2.4-16.EL4

3.[root@michael ~]# cat /etc/named.conf

//

// named.conf for Red Hat caching-nameserver

//

options {

directory "/var/named"; (domain name file save the lord directory”)

dump-file "/var/named/data/cache_dump.db"; (缓存file save the lord directory”)

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 "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";

4. [root@michael ~]# service named restart

Stopping named: [ OK ]

Starting named: [ OK ]

[root@michael ~]# chkconfig --list named

named 0:off 1:off 2:off 3:off 4:off 5:off 6:off

[root@michael ~]# chkconfig --level 35 named on

[root@michael ~]# chkconfig --level 35 named on

[root@michael ~]# chkconfig --list named

named 0:off 1:off 2:off 3:on 4:off 5:on 6:off

5. [root@michael RPMS]# rpm -ivh caching-nameserver-7.3-3.noarch.rpm --force

warning: caching-nameserver-7.3-3.noarch.rpm: V3 DSA signature: NOKEY, key ID db42a60e

Preparing... ########################################### [100%]

1:caching-nameserver ########################################### [100%]

注意caching-nameserver 软件包是对named.conf 的内容进行更改,此软件包是用来配置缓存域名SERVER

6.[root@michael ~]# grep -v '^;' /var/named/named.ca

. 3600000 IN NS A.ROOT-SERVERS.NET.

A.ROOT-SERVERS.NET. 3600000 A 198.41.0.4

. 3600000 NS B.ROOT-SERVERS.NET.

B.ROOT-SERVERS.NET. 3600000 A 192.228.79.201

. 3600000 NS C.ROOT-SERVERS.NET.

C.ROOT-SERVERS.NET. 3600000 A 192.33.4.12

. 3600000 NS D.ROOT-SERVERS.NET.

D.ROOT-SERVERS.NET. 3600000 A 128.8.10.90

. 3600000 NS E.ROOT-SERVERS.NET.

E.ROOT-SERVERS.NET. 3600000 A 192.203.230.10

. 3600000 NS F.ROOT-SERVERS.NET.

F.ROOT-SERVERS.NET. 3600000 A 192.5.5.241

. 3600000 NS G.ROOT-SERVERS.NET.

G.ROOT-SERVERS.NET. 3600000 A 192.112.36.4

. 3600000 NS H.ROOT-SERVERS.NET.

H.ROOT-SERVERS.NET. 3600000 A 128.63.2.53

. 3600000 NS I.ROOT-SERVERS.NET.

I.ROOT-SERVERS.NET. 3600000 A 192.36.148.17

. 3600000 NS J.ROOT-SERVERS.NET.

J.ROOT-SERVERS.NET. 3600000 A 192.58.128.30

. 3600000 NS K.ROOT-SERVERS.NET.

K.ROOT-SERVERS.NET. 3600000 A 193.0.14.129

. 3600000 NS L.ROOT-SERVERS.NET.

L.ROOT-SERVERS.NET. 3600000 A 198.32.64.12

. 3600000 NS M.ROOT-SERVERS.NET.

M.ROOT-SERVERS.NET. 3600000 A 202.12.27.33

注意:”/var/named/named.ca” in save a 13 根区域文件。

7.[root@michael ~]# 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

//

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 "0.0.127.in-addr.arpa" IN {

type master;

file "named.local";

allow-update { none; };

};

zone "fung.com" IN {

type master;

file "fung.com.zone";

allow-update { none; };

};

zone "5.168.192.in-addr.arpa" {

type master;

file "192.168.5.rev";

allow-update { none; };

};

"/etc/named.conf" 77L, 1551C written

8.[root@michael ~]# named-checkconf

[root@michael ~]#

9.[root@michael ~]# vi /var/named/fung.com.zone

$TTL 86400

@ IN SQA michael.fung.com. root.fung.com. (

2009080301

28800

14400

3600000

86400 )

 

@ IN NS michael.fung.com.

 

 

michael IN A 192.168.5.1

www IN A 192.168.5.1

mail IN A 192.168.5.2

 

 

 

ftp IN CNAME michael

 

@ IN MX 10 mail.fung.com.

~

~

~

"/var/named/fung.com.zone" [New] 20L, 433C written

10.[root@michael ~]# named-checkzone fung.com /var/named/fung.com.zone

zone fung.com/IN: loaded serial 2009080301

OK

11.[root@michael ~]# vi /var/named/192.168.5.rev

 

$TTL 86400

@ IN SOA michael.fung.com. root.fung.com. (

2009080301

28800

14400

3600000

86400 )

 

@ IN NS michael.fung.com.

 

 

1 IN PTR michael.fung.com.

1 IN PTR www.fung.com.

2 IN PTR mail.fung.com.

 

"/var/named/192.168.5.rev" [New] 15L, 370C written

[root@michael ~]# named-checkzone fung.com /var/named/192.168.5.rev

zone fung.com/IN: loaded serial 2009080301

OK

[root@michael ~]#

12.[root@michael ~]# service named restart

Stopping named: [ OK ]

Starting named: [ OK ]

[root@michael ~]# service named restart

Stopping named: [ OK ]

Starting named: [ OK ]

13.[root@michael ~]# nslookup

> server 192.168.5.1

Default server: 192.168.5.1

Address: 192.168.5.1#53

> set type=a

> www.fung.com

Server: 192.168.5.1

Address: 192.168.5.1#53

 

Name: www.fung.com

Address: 192.168.5.1

> ftp.fung.com

Server: 192.168.5.1

Address: 192.168.5.1#53

 

ftp.fung.com canonical name = michael.fung.com.

Name: michael.fung.com

Address: 192.168.5.1

> mail.fung.com

Server: 192.168.5.1

Address: 192.168.5.1#53

 

Name: mail.fung.com

Address: 192.168.5.2

> set type=mx

> fung.com

Server: 192.168.5.1

Address: 192.168.5.1#53

 

fung.com mail exchanger = 10 mail.fung.com.

>

13

Linux4.0 DNS SERVER relevant config_relevant

Linux4.0 DNS SERVER relevant config_config_02

14.[root@michael ~]# vi /etc/named/named.conf

[root@michael ~]# vi /etc/named.conf

 

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; };

};

zone "fung.com" IN {

type master;

file "fung.com.zone";

allow-update { none; };

};

zone "5.168.192.in-addr.arpa" {

type master;

file "192.168.5.rev";

allow-update { none; };

};

zone "abc.com" IN { (构建从域名SERVER

type slave;

file "slaves/abc.com";

masters { 192.168.5.197; };

};

"/etc/named.conf" 83L, 1665C written

[root@michael ~]# service named restart

Stopping named: [ OK ]

Starting named: [ OK ]

[root@michael ~]# named-checkconf

[root@michael ~]# ls /var/named/slaves/ (这是个固定的路径)

abc.com

[root@michael ~]# vi /var/named/slaves/abc.com

 

$ORIGIN .

$TTL 3600 ; 1 hour

abc.com IN SOA vs4. hostmaster. (

2 ; serial

900 ; refresh (15 minutes)

600 ; retry (10 minutes)

86400 ; expire (1 day)

3600 ; minimum (1 hour)

)

NS vs4.

$ORIGIN abc.com.

host A 192.168.5.197

~"/var/named/slaves/abc.com" 12L, 286C

14.[root@michael ~]# nslookup

> server 192.168.5.1

Default server: 192.168.5.1

Address: 192.168.5.1#53

> host.abc.com

Server: 192.168.5.1

Address: 192.168.5.1#53

 

Name: host.abc.com

Address: 192.168.5.197

>

15.Test ok !