知识屋:更实用的电脑技术知识网站
所在位置:首页 > 操作系统 > linux

Linux DNS服务实验报告

发布时间:2014-09-05 16:48:18作者:知识屋

DNS实验报告
--杨冬
1.     实验的环境
 
服务器:Red Hat Enterprise Linux 5.3 (ip:192.168.0.20)
        Red Hat Enterprise Linux 5.3 (ip:192.168.0.30)
客户端:Windows XP (ip:192.168.0.1)
 
2.     实验前期准备
 
注:主、副都要安装以下软件包。
yum install –y bind caching-nameserver
rpm -ihv /media/Server/bind-9.3.4-10.P1.el5.i386.rpm
rpm -ihv /media/Server/caching-nameserver-9.3.4-10.P1.el5.i386.rpm
 
3. 实验目标一:实现简单的正、反DNS解析.
 
配置正向解析与反向解析.
     vim /etc/named.caching-nameserver.conf
修改1:listen-on port 53 { 192.168.0.20; };//侦听端口的本机ip地址
修改2://listen-on-v6 port 53 { ::1; };
修改3://allow-query      { localhost; }; //永许哪些客户端访问DNS服务
修改4://match-clients     { localhost; };
修改5://match-destinations { localhost; };
 
     vim /etc/named.rfc1912.zones
在结尾处添加:
 zone "yangdong.com" IN {
        type master;
        file "yangdong.zone";
//      allow-update { none; };
};
 
zone "0.168.192.in-addr.arpa" IN {
        type master;
        file "yangdong.local";
//      allow-update { none; };
};
 
      cd /var/named
cp -rf localhost.zone yangdong.zone
cp -rf named.local yangdong.local
chown named:named yangdong.local yangdong.zone
 
      配置正向配置文件:
     vim yangdong.zone
     配置文件内容:
      $TTL    86400
@               IN SOA yangdong.com.       root (
                                        42              ; serial (d. adams)
                                        3H              ; refresh
                                        15M             ; retry
                                        1W              ; expiry
                                        1D )            ; minimum
 
                IN NS           yangdong.com.
                IN A            192.168.0.20
www            IN A            192.168.0.21
wap             IN A            192.168.0.22
 
     配置反向配置文件:
vim yangdong.local
配置文件内容:
$TTL    86400
@       IN      SOA     yangdong.com. root.yangdong.com. (
                                      1997022700 ; Serial
                                      28800      ; Refresh
                                      14400      ; Retry
                                      3600000    ; Expire
                                      86400 )    ; Minimum
        IN      NS      yangdong.com.
20      IN      PTR     yangdong.com.
21      IN      PTR     www.yangdong.com.
22      IN      PTR     wap.yangdong.com.
 
     vim /etc/resolv.conf
nameserver 192.168.0.20
service network restart
 
     service named restart
     [root@hello named]# host www.yangdong.com
     www.yangdong.com has address 192.168.0.21
     [root@hello named]# host 192.168.0.22
22.0.168.192.in-addr.arpa domain name pointer wap.yangdong.com.
[root@hello named]# host wap.yangdong.com
wap.yangdong.com has address 192.168.0.22
[root@hello named]# host 192.168.0.20
20.0.168.192.in-addr.arpa domain name pointer yangdong.com.                                             
  
4.      实验目标二:配置主DNS和辅助DNS.
 主DNS:192.168.0.20
 副DNS:192.168.0.30
 
主DNS的配置:
        vim /etc/named.rfc1912.zones
zone "yangdong.com" IN {
        type master;
        file "yangdong.zone";
//      allow-update { none; };
};
 
zone "0.168.192.in-addr.arpa" IN {
        type master;
        file "yangdong.local";
//      allow-update { none; };
};
 
        辅助DNS的配置.
vim /etc/named.caching-nameserver.conf
修改1:listen-on port 53 { 192.168.0.30; };//侦听端口的本机ip地址
修改2://listen-on-v6 port 53 { ::1; };
修改3://allow-query      { localhost; }; //永许哪些客户端访问DNS服务
修改4://match-clients     { localhost; };
修改5://match-destinations { localhost; };
 
        vim /etc/named.rfc1912.zones
在结尾处添加:
zone "yangdong.com" IN {
        type slave;
        file "slaves/yangdong.zone";
//      allow-update { none; };
        masters { 192.168.0.20; };
};
 
zone "0.168.192.in-addr.arpa" IN {
        type slave;
        file "slaves/yangdong.local";
//      allow-update { none; };
        masters { 192.168.0.20; };
};
  
          vim /etc/resolv.conf 
         nameserver 192.168.0.30
        service network restart
          Service named restart
       [root@dong ~]# ls /var/named/slaves/
yangdong.local yangdong.zone
       [root@dong ~]# host www.yangdong.com
       www.yangdong.com has address 192.168.0.21
       [root@dong ~]# host 192.168.0.22
       22.0.168.192.in-addr.arpa domain name pointer wap.yangdong.com.
[root@dong ~]# host wap.yangdong.com
wap.yangdong.com has address 192.168.0.22
 
5.      实验目标三:实现DNS智能双线服务
DNS server:192.168.0.20
① vim /etc/named.caching-nameserver.conf
配置文件最后修改内容:
logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};
        acl "dianxin" { 192.168.0.1/32; };
        acl "wangtong" {192.168.0.2/32; };
view dianxin {
        match-clients      { dianxin; };
//      match-destinations { localhost; };
        recursion yes;
//      include "/etc/named.rfc1912.zones";
        zone "yangdong.com" IN {
        type master;
        file "dianxin.zone";
};
};
view wangtong {
        match-clients      { wangtong; };
//      match-destinations { localhost; };
        recursion yes;
//      include "/etc/named.rfc1912.zones";
        zone "yangdong.com" IN {
        type master;
        file "wangtong.zone";
};
};
view localhost_resolver {
//      match-clients      { localhost; };
//      match-destinations { localhost; };
        recursion yes;
        include "/etc/named.rfc1912.zones";
};
 
② cd /var/named
cp –rf yangdong.zone dianxin.zone
cp –rf yangdong.zone wangtong.zone
chown named:named dianxin.zone wangtong.zone
 
C:/Documents and Settings/Administrator>nslookup
Default Server: d.center-dns.jsinfo.net
Address: 61.147.37.1
 
> server 192.168.0.20
Default Server: [192.168.0.20]
Address: 192.168.0.20
 
> www.yangdong.com
Server: [192.168.0.20]
Address: 192.168.0.20
 
Name:    www.yangdong.com
Address: 192.168.1.11
 
 
测试完成。
 
 
以下为补充内容:
------------------------------------------------------------------------------------/
环境:
DNS IP 10.0.0.11 Client1 ip 10.0.0.8   Client2 ip 10.0.0.9   Client3 ip 10.0.0.10
一、安装
 Yum install bind caching-nameserver
二、创建配置文件并进行配置
1) cp –p /etc/named.caching-nameserver.conf /etc/named.conf
vim /etc/named.conf
 listen-on port 53 { any; };
 allow-query { any; };
       match-clients { any; };
       match-destinations { any; };
 2) cp –p /etc/named.rfc1912.zones /etc/named.rfc1912.zones.back
       Vim /etc/named.rfc1912.zones
        Zone “tech.org” IN {
           Type master;
            File “tech.org.zone”
        };
         Zone “0.0.10.in-addr.arpa” IN {
             Type master;
              File “tech.org.local”;
        };
3) cp –p /var/named/localhost.zone /var/named/tech.org.zone
      Vim /var/named/tech.org.zone
                IN A       10.0.0.11
      Client1    IN A       10.0.0.8
      Client1    IN A       10.0.0.9
Client1    IN A       10.0.0.10
     4) cp –p /var/named/named.local /var/named/tech.org.local
           Vim /var/named/tech.org.local
              8     IN    PTR    client1.tech.org.
9     IN    PTR    client2.tech.org.
10    IN    PTR    client3.tech.org.
三、启动服务
   Service named start
 
 

/

一、安装
 Yum install bind caching-nameserver
二、创建配置文件并进行配置
2) cp –p /etc/named.caching-nameserver.conf /etc/named.conf
vim /etc/named.conf
 listen-on port 53 { 192.168.31.134; };        制定DNS监听的端口号和IP地址
 forward only;
 forwarders { 61.37.147.1; };                DNS转发功能
 allow-query { any; };
       match-clients { any; };                
       match-destinations { any; };
 2) cp –p /etc/named.rfc1912.zones /etc/named.rfc1912.zones.back
       Vim /etc/named.rfc1912.zones
        Zone “tech.boobooke” IN {
           Type master;
            File “ech.boobooke.zone”
        };
         Zone “31.168.192.in-addr.arpa” IN {
             Type master;
              File “tech.boobooke.local”;
        };
          Zone “mart.boobooke” IN {
           Type master;
            File “mart.boobooke.zone”
        };
         Zone “32.168.192.in-addr.arpa” IN {
             Type master;
              File “mart.boobooke.local”;
        };
          Zone “freedom.boobooke” IN {
           Type master;
            File “freedom.boobooke.zone”
        };
         Zone “33.168.192.in-addr.arpa” IN {
             Type master;
              File “freedom.boobooke.local”;
        };
 
3) cp –p /var/named/localhost.zone /var/named/tech.boobooke.zone
 cp –p /var/named/localhost.zone /var/named/mart.boobooke.zone
 cp –p /var/named/localhost.zone /var/named/freedom.boobooke.zone
 
      Vim /var/named/tech.boobooke.zone
                IN A       192.168.31.134
      Client1    IN A       192.168.31.1
      Client2    IN A       192.168.31.2
Client3    IN A       192.168.31.3
….
Cloent100    IN A      192.168.31.100
 
Vim /var/named/mart.boobooke.zone
                IN A       192.168.31.134
      Client1    IN A       192.168.32.1
      Client2    IN A       192.168.32.2
Client3    IN A       192.168.32.3
….
Cloent100    IN A      192.168.32.100
 
Vim /var/named/freedom.boobooke.zone
                IN A       192.168.31.134
      Client1    IN A       192.168.33.1
      Client2    IN A       192.168.33.2
Client3    IN A       192.168.33..3
….
Cloent50   IN A      192.168.33.50
 
     4) cp –p /var/named/named.local /var/named/tech.boobooke.local
       cp –p /var/named/named.local /var/named/mart.boobooke.local
       cp –p /var/named/named.local /var/named/freedom..boobooke.local
            Vim /var/named/tech.boobooke.local
              8     IN    PTR    client1.tech.boobooke.
9     IN    PTR    client2.tech.boobooke.
10    IN    PTR    client3.tech.boobooke.
              ….
              100     IN    PRT    client100.tech.boobooke.
 
Vim /var/named/mart.boobooke.local
              8     IN    PTR    client1.mart.boobooke.
9     IN    PTR    client2.mart.boobooke.
10    IN    PTR    client3.mart.boobooke.
              ….
              100     IN    PRT    client100.mart.boobooke.
 
Vim /var/named/freedom.boobooke.local
              8     IN    PTR    client1.freedom.boobooke.
9     IN    PTR    client2.freedom.boobooke.
10    IN    PTR    client3.freedom.boobooke.
              ….
              50     IN    PRT    client50.freedom.boobooke.
 
三、启动服务
   Service named start
 
 

/ 

vim /etc/named.conf

forward only;

forwarders { 202.100.138.68; 202.100.128.68 }; 
 
 
/
环境:
DNS ip:192.168.31.132
一、安装
 Yum install bind caching-nameserver
二、创建配置文件并进行配置
3) cp –p /etc/named.caching-nameserver.conf /etc/named.conf
vim /etc/named.conf
 listen-on port 53 { 192.168.31.132; };
version “9.3.4”;
 allow-query { any; };
       match-clients { any; };
       allow-transfer { 192.168.31.134; };
       match-destinations { any; };
 2) cp –p /etc/named.rfc1912.zones /etc/named.rfc1912.zones.back
       Vim /etc/named.rfc1912.zones
        Zone “xyz.org” IN {
           Type master;
            File “xyz.org.zone”
        };
         Zone “31.168.192.in-addr.arpa” IN {
             Type master;
              File “xyz.org.local”;
        };
3) cp –p /var/named/localhost.zone /var/named/xyz.org.zone
      Vim /var/named/xyz.org.zone
             IN A       192.168.31.132
      Dns    IN A       192.168.31.1
      www   IN A       192.168.31.2
mail    IN A       192.168.31.3
bbs     IN CNAME    www
xyz.org.    IN MX 10 mail.xyz.org.
     4) cp –p /var/named/named.local /var/named/xyz.org.local
            Vim /var/named/xyz.org.local
              @    IN    PTR    dns.xyz.org.
              1     IN    PTR    dns.xyz.org.
2     IN    PTR    www.xyz.org.
3     IN    PTR    mail.xyz.org.
三、启动服务
   Service named start
 

/

 
一、安装
 Yum install bind caching-nameserver
二、创建配置文件并进行配置
4) cp –p /etc/named.caching-nameserver.conf /etc/named.conf
vim /etc/named.conf
 listen-on port 53 { any; };
 allow-query { any; };
       match-clients { any; };
       match-destinations { any; };
 2) cp –p /etc/named.rfc1912.zones /etc/named.rfc1912.zones.back
       Vim /etc/named.rfc1912.zones
        Zone “xyz.org” IN {
           Type slave;
            File “slave/xyz.org.zone”
            Master { 192.168.31.132; };
        };
         Zone “31.168.192.in-addr.arpa” IN {
             Type slave;
              File “slave/xyz.org.local”;
              Master { 192.168.31.132; };
        };
三、启动服务
   Service named start
 
 
 
  本文出自 “杨冬的博客”
(免责声明:文章内容如涉及作品内容、版权和其它问题,请及时与我们联系,我们将在第一时间删除内容,文章内容仅供参考)
收藏
  • 人气文章
  • 最新文章
  • 下载排行榜
  • 热门排行榜