域名服务器


光盘(挂载) - 装bind的rpm包(bind-9.3.6-4.p1.el5_4.2.i386.rpm ,bind-utils-9.3.6-

4.p1.el5_4.2.i386.rpm,bind-chroot-9.3.6-4.p1.el5_4.2.i386.rpm ,caching-nameserver-9.3.6-

4.p1.el5_4.2.i386.rpm)

 

# mount /dev/cdrom /media/cdrom
# cd /media/cdrom/Server
# rpm -ivh bind-9.3.6-4.p1.el5_4.2.i386.rpm
# rpm -ivh bind-utils-9.3.6-4.p1.el5_4.2.i386.rpm
# rpm -ivh bind-chroot-9.3.6-4.p1.el5_4.2.i386.rpm
# rpm -ivh caching-nameserver-9.3.6-4.p1.el5_4.2.i386.rpm


# vi /etc/hosts

192.168.1.2   ns1.benet.com     ns1

# vi /etc/resolv.conf

search benet.com
nameserver      192.168.1.2

# service network restart
# vi /var/named/chroot/etc/named.conf

options {
       directory  "/var/named";

       forwarders {192.168.1.1;};
};

zone "benet.com" IN {
                    type master;
                    file "benet.com.zone";
                    allow-transfer {192.168.1.3;};
};

zone "2.1.168.192.in-addr.arpa" IN {
                     type master;
                     file "192.168.1.2.arpa";
                     allow-transfer {192.168.1.3;};
};


# chown named /var/named/chroot/etc/named.conf
# vi  /var/named/chroot/var/named/benet.com.zone

$TTL 86400
@ IN SOA benet.com.    ns1.benet.com. (
                      2009022001
                      4H
                      30M
                      12H
                      1D
)

@     IN          NS             ns1.benet.com.

      IN          NS             ns2.benet.com.

      IN          NS             192.168.1.2

mail     IN          MX     10      mail.benet.com.

ns1   IN          A              192.168.1.2
 
ns2   IN          A              192.168.1.3

mail  IN          A              192.168.1.2
www   IN          A              192.168.1.2
study  IN         A              192.168.1.2
*      IN         A              192.168.1.2

# chown named /var/named/chroot/var/named/benet.com.zone


# vi /var/named/chroot/var/named/192.168.1.2.arpa

$TTL 86400
@ IN SOA benet.com.   ns1.benet.com. (
                    2009022002
                    4H
                    30M
                    12H
                    1D
)

          IN     NS      ns1.benet.com.

          IN     NS      ns2.benet.com.

          IN     A        192.168.1.2
        IN     PTR     www.benet.com.

2         IN     PTR     study.benet.com.

5         IN     PTR     ns1.benet.com.

6         IN     PTR     ns2.benet.com.

# chown named  /var/named/chroot/var/named/192.168.1.2.arpa

# service named restart
# service iptables stop

 


客户端(windows):

DNS指向192.168.1.2(服务器ip)

cmd - nslookup  study/mail/other.benet.com         (正向解析)

cmd - nslookup   192.168.1.2      (反向解析)

 

 

客户端(linux):


DNS指向192.168.1.2的命令

1、nslookup  - 回车 - server 192.168.1.2
2、vi /etc/resolv.conf

nameserver 192.168.1.2