named:域名服务器部署及配置

1、安装bind

yum -y install bind

2、修改/etc/named.conf

//
// named.conf
//
// Provided by Red Hat bind 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.
//

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     { localhost;192.168.21.45; };
};
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";
    zone "aa.com" IN {
        type master;
        file "aa.com.zone";
        allow-update { none; };
    };
    zone "bb.com" IN {
        type master;
        file "bb.com.zone";
        allow-update { none; };
        };
    zone "cc.com" IN {
        type master;
        file "cc.com.zone";
        allow-update { none; };
        };

};

 

3、增加zone信息

/var/named/aa.com.zone

$TTL    5
@       IN SOA  @       root (
                                      1997022700 ; Serial
                                      8      ; Refresh
                                      16     ; Retry
                                      24    ; Expire
                                      36 )    ; Minimum
;            IN NS       @
;            IN NS       @
@           IN NS       aaa.
aaa         IN A        127.0.0.11
www         IN A        127.0.0.11

 

/var/named/bb.com.zone

$TTL    5
@       IN SOA  @       root (
                                      1997022700 ; Serial
                                      8      ; Refresh
                                      16     ; Retry
                                      24    ; Expire
                                      36 )    ; Minimum
;            IN NS       @
;            IN NS       @
@           IN NS       bbb.
bbb         IN A        127.0.0.12
www         IN A        127.0.0.12

 

/var/named/cc.com.zone

$TTL    5
@       IN SOA  @       root (
                                      1997022700 ; Serial
                                      8      ; Refresh
                                      16     ; Retry
                                      24    ; Expire
                                      36 )    ; Minimum
;            IN NS       @
;            IN NS       @
@           IN NS       ccc.
ccc         IN A        127.0.0.13
www         IN A        127.0.0.13

 

4、修改文件权限

chown root:named /var/named/*.com.zone;

 

5、重启服务

service named restart

 

 

验证:

dig www.bb.com @127.0.0.1 +short
127.0.0.12

posted on 2019-06-10 14:31  channy14 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/channy14/p/10997499.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值