【www.gdgbn.com--js教程】

bind 9的配置方法

/etc/named.conf

options {
        directory "/var/named";

};

# named.root is available at ftp://ftp.internic.net/domain/named.root

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

# here is zone for domain ustrem.org

zone "ustrem.org" in {
        type master;
        file "ustrem.org";
        allow-transfer { none; };
        allow-update { none; };

};

# here is reverse zone zone for net 192.168.2.0/255.255.255.0

zone "2.168.192.in-addr.arpa" {
        type master;
        file "loc";
        allow-update { none; };
};

----------------------------------------------------

here is ustrem.org"s zone file

-----------------------------

/var/named/ustrem.org

$origin .
$ttl 86400      ; 1 day
ustrem.org              in soa  pns.ustrem.org. onzi.ustrem.org. (

# onzi.ustrem.org is email for contacts (onzi_at_ustrem_dot_org)


                                2006083102 ; serial

# this is stamp for date and time and number of day change


                                3600      ; refresh (8 hours)
                                1800      ; retry (4 hours)
                                86400    ; expire (5 weeks 6 days 16 hours)
                                3600      ; minimum (1 day)
                                )
                        ns      pns.ustrem.org.
                        ns      ns1.xname.org.

# ns records for domain


                        a       213.240.243.12

# this line shows "ustrem.org" is with ip 213.240.243.12


                        mx      10 mail.ustrem.org.

# here is smtp server which received mails for ustrem.org


                        txt     "v=spf1 mx a:mail.b-trust.org a:mailrelay.bsbg.net -all"

# this is text record for prevent from spammers and spoofers. here is smtp-s which sends emails from ustrem.org

$origin ustrem.org.

*                       a       213.240.243.12

# some-does-not-described.ustrem.org is with ip 213.240.243.12


bobi                    a       213.240.227.125
pns                     a       213.240.243.12

*.bobi                  cname   bobi.ustrem.org.

boiko                   a       84.238.128.65
george                  a       213.240.242.107

 

laptoper4e              a       192.168.2.18
mitkosipc               a       192.168.2.4
pi-server               a       192.168.2.15
pz                      a       217.10.245.249
router                  a       192.168.2.24

----------------------------------------------------------------------------------

here is reverse resolv

---------------------------------------------

/var/named/loc

$origin .
$ttl 86400      ; 1 day
2.168.192.in-addr.arpa  in soa  pns.ustrem.org. onzi.ustrem.org. (
                                2006080302 ; serial
                                28800      ; refresh (8 hours)
                                14400      ; retry (4 hours)
                                3600000    ; expire (5 weeks 6 days 16 hours)
                                86400      ; minimum (1 day)
                                )
                        ns      pns.ustrem.org.
                        ns      sns.ustrem.org.

$origin 2.168.192.in-addr.arpa.
4       ptr     mitkosipc.ustrem.org.
18      ptr     laptoper4e.ustrem.org.
15      ptr     pi-server.ustrem.org.
24      ptr     router.ustrem.org.


 

---------------------------------------------

this is enougt for bind9 to work.

now you can start and test it....

# dig ustrem.org @127.0.0.1

;; question section:
;ustrem.org.                    in      a

;; answer section:
ustrem.org.             86400   in      a       213.240.243.12

# dig ustrem.org @127.0.0.1 mx

;; question section:
;ustrem.org.                    in      mx

;; answer section:
ustrem.org.             86400   in      mx      10 mail.ustrem.org.

# dig -x 192.168.2.4 @127.0.0.1

;; question section:
;4.2.168.192.in-addr.arpa.      in      ptr

;; answer section:
4.2.168.192.in-addr.arpa. 86400 in      ptr     mitkosipc.ustrem.org.

本文来源:http://www.gdgbn.com/wangyezhizuo/27736/