rhel5 配置简单的局域网dns

 rhel5 配置局域网dns 笔记
    1. 安装bind
    #yum install bind*
    #yum install caching-nameserver
    2.  修改配置文件
    #cd /var/named/chroot/etc
    #vi named.caching-nameserver.conf
    修改内容如下(红色标记):
   
//
// named.caching-nameserver.conf
//
// Provided by Red Hat caching-nameserver package to configure the
// ISC BIND named(
8) DNS server as a caching only nameserver 
// (as a localhost DNS resolver only). 
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
// DO NOT EDIT THIS FILE - use system-config-bind or an editor
// to create named.conf - edits to this file will be lost on 
// caching-nameserver package upgrade.
//
options {
    listen-on port 
53 { 127.0.0.1; };
    listen-on-v6 port 53 { ::1; };
    directory     "/var/named";
    dump-file     "/var/named/data/cache_dump.db";
        statistics-file "/var/named/data/named_stats.txt";
        memstatistics-file "/var/named/data/named_mem_stats.txt";
    query-source    port 53;    
    query-source-v6 port 53;
    allow-query     { any; };
};
logging {
        channel default_debug {
                file 
"data/named.run";
                severity dynamic;
        };
};
//view localhost_resolver {
//    match-clients        { localhost; };
//    match-destinations { localhost; };
//    recursion yes;
//    include "/etc/named.rfc1912.zones";
//}
;
controls {
        inet 127.0.0.1 allow { localhost; } keys { rndckey; };
};

zone "." IN {
        type hint;
        file "named.ca";
};

zone "localhost" IN {
        type master;
        file "localhost.zone";
        allow-update { none; };
};

zone "0.0.127.in-addr.arpa" IN {
        type master;
        file "named.local";
        allow-update { none; };
};

zone "pig.com" IN {
        type master;
        file "db.pig.com";
        allow-update { none;};
};

zone "0.168.192.in-addr.arpa" IN{
        type master;
        file "db.192.168.0";
        allow-update { none;};
};

include "/etc/rndc.key"
;
    检查配置文件
    #named-checkconf named.caching-nameserver.conf  
    3. 创建正向和反向解析的数据库文件
       #cd /var/named/chroot/var/named/
       # uname -n
        rhel-aaron
       #vi db.pig.com
       内容如下,蓝色部分顶格填写, rhel-aaron 文件机器名:
      
$TTL    86400
@    IN SOA rhel-aaron.pig.com. root.pig.com. (
                    
42        ; serial (d. adams)
                    3H        ; refresh
                    15M        ; retry
                    1W        ; expiry
                    1D )        ; minimum

    IN NS rhel-aaron.pig.com.
rhel-aaron IN A 
192.168.0.111
dns IN A 192.168.0.111
www IN A 192.168.0.111
ftp IN A 192.168.0.111
mail IN A 192.168.0.111
web IN CNAME 192.168.0.111

       #vi db.192.168.0
       内容如下,
蓝色部分顶格填写, rhel-aaron 文件机器名,注意点号必须有
      
$TTL    86400
@       IN SOA rhel-aaron.pig.com. root.pig.com.  (
                                      
1997022700 ; Serial
                                      28800      ; Refresh
                                      14400      ; Retry
                                      3600000    ; Expire
                                      86400 )    ; Minimum
    IN NS rhel-aaron.pig.com.
111 IN PTR rhel-aaron.pig.com.
111 IN PTR dns.pig.com.
111 IN PTR www.pig.com.
111 IN PTR ftp.pig.com.
111
IN PTR mail.pig.com.
       检查解析数据库文件是否正确:
       # named-checkzone pig.com db.pig.com
        zone pig.com/IN: loaded serial 42
        OK
       # named-checkzone pig.com db.192.168.0
        zone pig.com/IN: loaded serial 1997022700
        OK
       4. 修改/etc/resolv.conf
          #vi /etc/resolv.conf
      
nameserver 127.0.0.1
search localdomain
       5. 重启所有相关服务
          # service network restart
          # service named start
       6. 测试
          # nslookup www.pig.com
            Server:         127.0.0.1
            Address:        127.0.0.1#53

            Name:   www.pig.com
            Address: 192.168.0.111
          # nslookup 192.168.0.111
            Server:         127.0.0.1
            Address:        127.0.0.1#53

            11.0.168.192.in-addr.arpa      name = www.pig.com.
          测试成功!!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值