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

每天努力一点,每天学习一点。 Keep Moving...
原文地址:https://www.cnblogs.com/channy14/p/10997499.html