linux下的dns服务器

i.am第四弹
使用BIND构建DNS服务器
 
一 安装域名服务
rpm -qa | grep bind
 
rpm -ivh bind-9.2.4-2.i386.rpm bind服务器软件包 (4)
rpm -ivh bind-chroot-9.2.4 (4)
rpm -ivh caching-nameserver-7.3-3.noarch.rpm 缓寸域名服务器软件包 (1)
 
小提示:安装chroot后 配置文件位于 /var/named/chroot/etc/named.conf
工作目录位于 /var/named/chroot/var/named
 
二 bind服务器的停止和启动
 
service named start / stop / restart /status
 
三 配置/var/named/chroot/etcnamed.conf(主域的ip为 192.168.1.2)
ex:
zone"wincto.com" IN {
       type master;
       file "chly.com.zone";
};
正向解析
zone "1.168.192.in-addr.arpa" IN {
       type master;
       file "192.168.1.rev" 
};
反向解析
 
配置区域文件
/var/named/chroot/var/named
vi    wincto.com.zone
$TTL   86400
@                       IN   SOA        @                  root (
                                                                         20050519    ;serial (d. adams
                                                                           3h                ;refresh
                                                                           15m             ; retry
                                                                           1w               ; expiry
                                                                           1D)              ; minimum
@                       IN NS                                        @                
www                  IN A                                             192.168.1.11
ftp                      IN A                                             192.168.1.12
mail                    IN A                                             192.168.1.13
www1                IN                CNAME                        www               
@                       IN MX                  5                                 mail.chly.com
 
 

vi  192.168.1.rev
上面相同 主要写下面的
 
@                           IN NS                                   [url]www.wincto.com[/url].
11                           IN PTR                               www .wincto.com.
12                           IN PTR                                ftp.wincto.com.
13                          IN PTR                                 mail.wincto.com
 
四    配置文件和区域文件的测试
1,named-checkconf     (测试配置文件)
2,named-checkzone      wincto.com /var/named/chroot/var/named/wincto.con.zone (测试区域文件)
named-checkzone 1.168.192.in-addr.arpa /var/named/chroot/var/named/192.168.1.rev(测试区域文件)
 
五     named的启动
service named start / stop / restart /status
 
构建从域名服务器
 
本ip为 192.168.1.3 
主域 ip为 192.168.1.2
 
 
从域只需要安装两个软件包
bind-9.2.4-2.i386.rpm
caching-nameserver-7.3-3.noarch.rpm
设置named.conf文件
zone"wincto.com" {
       type slave;
       file "slaves/wincto.com.zone";
       master { 192.168.1.2  ;  };
};
zone "1.168.192.in-addr.arpa" {
              type slave;
              file " slavex/192.168.1.rev";
                masters { 192.168.1.2 ;   };
};
从域的区域文件保存在 /var/named/slaves/
 
 
DNS测试原理
nslookup
server 192.168.1.2
测试从域名服务器
server 192.168.1.3
 
dig @ 192.168.1.2  [url]www.wincto.com[/url]
使用dig命令在DNS服务器192.168.1.2 中查询域名 [url]www.wincto.com[/url]的信息

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