毕业设计之dns搭建:

[_sever ~]$ sudo yum install -y bind
[_sever ~]$ sudo vim /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; any;};
    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";
    allow-query     { localhost; any;};
    recursion yes;

    dnssec-enable no;
    dnssec-validation no;

    /* Path to ISC DLV key */
    bindkeys-file "/etc/named.iscdlv.key";

    managed-keys-directory "/var/named/dynamic";
};

logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};

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

include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";

注意:上面修改了 加入两个any 

将dnssec 相关的都设置为no

Domain Name System Security Extensions (DNSSEC)DNS安全扩展,是由IETF提供的一系列DNS安全认证的机制

DNSSEC是为解决DNS欺骗和缓存污染而设计的一种安全机制。
由于内网dns,只用于内网的域名解析,所以不用添加

修改子配置文件:

[ ~]$vim /etc/named.rfc1912.zones 

// (c)2007 R W Franks
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//

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

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

zone "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" IN {
        type master;
        file "named.loopback";
        allow-update { none; };
};

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

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


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

编辑详细的dns解析文件:

[ ~]$vim /var/named/quan.bbs.zone 

$TTL 1D
@       IN SOA  @ rname.invalid. (
                                        0       ; serial
                                        1D      ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum
@       NS      dns.quan.bbs.
dns     A       192.168.111.222
lvsA.load      A       192.168.111.131
lvsB.load    A       192.168.111.132
webone  A       192.168.111.141
webtwo  A       192.168.111.142
mysql   A       192.168.111.151
mysql.bkone     A       192.168.111.152
mysql.bktwo     A       192.168.111.153
ansz    A       192.168.111.111
jp      A       192.168.111.122
dnsserver       A       192.168.111.222

解析:

zone 通常具有以下几种标志:

SOA:开始验证 (Start of Authority);
NS:名称服务器 (NameServer),后面记录的数据是 DNS 服务器的意思;
A:地址 (Address),后面记录的是 IP 的对应 (最重要)。

测试:

[ ~]$yum install bind-utils
[ ~]$vim /etc/resolv.conf

; generated by /sbin/dhclient-script
search localdomain one.bbs
nameserver 192.168.111.222
nameserver 8.8.8.8

检测
[ ~]$nslookup webone.quan.bbs
Server:        192.168.111.222
Address:    192.168.111.222#53

Name:    webone.quan.bbs
Address: 192.168.111.141

将其他服务器加上dns服务器即可

注:建议直接再网卡上加dns服务器,按照小范围和大范围设置

dns

相关推荐