Centos bind解析转发

Centos 6.10解析转发访问外网

通过本机安装的bind服务的转发功能可以让本机通过转发解析包给目标ip代为解析,而目标地址机器只需要能正常访问外网,而不用安装bind服务
yum install bind bind-libs bind-utils #使用yum安装bind服务
vim /etc/named.conf #编辑主服务配置文件
[root@slave ~]# 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; }; #此处为设置监听的ip地址与端口注释掉的话默认为“0.0.0.0:53”
//      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     { any; }; #此处为指定查询范围‘any’表示所有
        recursion yes;
        forward first; #添加转发功能
        forwarders { 192.168.67.163; }; #添加目标ip地址

        dnssec-enable yes; #这里要把yes改成no否则解析失败(后期补充)
        dnssec-validation yes; #同上
        /* 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";
service named restart

2019-11-07

16:19

你可能感兴趣的:(Centos bind解析转发)