linux-bind

拓扑图
主域名服务器 (192.168.9.150)------------------ 从域名服务器 (192.168.9.160)
 
主域名服务器上挂载光盘 , 并安装软件 , 换光盘
[root@www /]# mount -t smbfs -o username=benet //192.168.9.52/soft /mnt  挂载
安装软件并启动服务
[root@www named]# cd /media/cdrom/RedHat/RPMS
[root@www RPMS]# rpm -ivh caching-nameserver-7.3-3.noarch.rpm
[root@www RPMS]# rpm -ivh bind-9.2.4-16.EL4.i386.rpm
[root@www RPMS]# chkconfig --level 35 named on
 
[root@www RPMS]# service named start
[root@www named]# vi /etc/named.conf           在主配置文件中添加区域
 
zone "test.com" IN {                                        区域名
        type master;
        file "test.com.zone";                            文件存放的位置
        allow-update { 192.168.9.160; };         充许复制的主机的 IP
};
 
zone "9.168.192.in-addr.arpa" IN {                     反向区域
        type master;
        file "192.168.9.rev";                            文件保存的位置
        allow-update { 192.168.9.160; };         充许复制的主机的 IP
};
 
[root@www named]# cd /var/named/chroot/var/named     进入这个目录
[root@www named]# touch test.com.zone                       创建区域文件
[root@www named]# cp /var/named/chroot/var/named/localhost.zone /var/named/chroot/var/named/test.com.zone
 
 
$TTL    86400
test.com .                IN SOA  [url]www.test.com[/url].      root.test.com. (   注意后面都有点
                                        42              ; serial (d. adams )
                                        3H              ; refresh
                                        15M             ; retry
                                        1W              ; expiry
                                        1D )            ; minimum
 
@                IN NS           [url]www.test.com[/url].    有个点
                IN A            127.0.0.1
                IN AAAA         ::1
www             IN A            192.168.9.150
ftp             IN A            192.168.9.151
主机记录 OK
 
[root@www named]# pwd
/var/named/chroot/var/named
[root@www named]# touch 192.168.9.rev         /var/named/chroot/var/named 目录中
[root@www named]# ls
192.168.9.rev     localhost.zone   named.ip6.local  slaves
data              named.broadcast  named.local      test.com.zone
localdomain.zone  named.ca         named.zero
[root@www named]# cp named.local 192.168.9.rev
cp: overwrite `192.168.9.rev'? y
[root@www named]# pwd
/var/named/chroot/var/named
[root@www named]# vi 192.168.9.rev                            /var/named/chroot/var/named 目录中
 
$TTL    86400
@       IN      SOA     [url]www.test.com.[/url] root.test.com.  (
                                      1997022700 ; Serial
                                      28800      ; Refresh
                                      14400      ; Retry
                                      3600000    ; Expire
                                      86400 )    ; Minimum
@              IN      NS      [url]www.test.com.[/url]
 
1       IN      PTR     localhost.
150       IN      PTR     [url]www.test.com.[/url]
151       IN      PTR     ftp.test.com.
 
反向记录 OK
 
[root@www named]# pwd
/var/named/chroot/var/named
[root@www named]# vi test.com.zone
 
$TTL    86400
test.com.               IN SOA  [url]www.test.com.[/url]      root.test.com. (
                                        42              ; serial (d. adams )
                                        3H              ; refresh
                                        15M             ; retry
                                        1W              ; expiry
                                        1D )            ; minimum
 
@               IN NS           [url]www.test.com.[/url]
                IN A            127.0.0.1
                IN AAAA         ::1
www             IN A            192.168.9.150
ftp             IN A            192.168.9.151
 
111             IN      CNAME           www
222             IN      CNAME           ftp        添加这两条别名记录
 
从域名服务器上
[root@http RPMS]# cd /media/cdrom/RedHat/RPMS
[root@http RPMS]# rpm -ivh bind-9.2.4-16.EL4.i386.rpm
[root@http RPMS]# rpm -ivh caching-nameserver-7.3-3.noarch.rpm
 
[root@http named]# vi /etc/named.conf              在主配置文件中的修改
zone "test.com" IN {
        type slave;
        file "slaves/test.com.zone";
        masters { 192.168.9.150; };
};
 
zone "9.168.192.in-addr.arpa" IN {
        type slave;
        file "slaves/192.168.9.rev";
        masters { 192.168.9.150; };
};
 
在从域名服务器上查看
[root@http slaves]# cd /var/named/chroot/var/named/slaves
[root@http slaves]# ls
192.168.9.rev  test.com.zone
从域名服务器 OK
 

你可能感兴趣的:(linux,服务器,dns,域名)