CentOS 7中构建分离解析域名服务器详解(2)

CentOS 7中构建分离解析域名服务器详解

CentOS 7中构建分离解析域名服务器详解

CentOS 7中构建分离解析域名服务器详解

CentOS 7中构建分离解析域名服务器详解

在CentOS 7中配置DNS服务

1、进入DNS服务主配置文件,配置主配置文件信息。

[root@localhost network-scripts]# cd ~ [root@localhost ~]# vim /etc/named.conf //进入比编辑主配置文件 // See the BIND Administrator's Reference Manual (ARM) for details about the // configuration located in /usr/share/doc/bind-{version}/Bv9ARM.html ...//省略部分内容... options { listen-on port 53 { 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"; recursing-file "/var/named/data/named.recursing"; secroots-file "/var/named/data/named.secroots"; allow-query { any; }; //更改为所有地址,这样所有网段就都可以使用DNS服务 /* - If you are building an AUTHORITATIVE DNS server, do NOT enable recursion. - If you are building a RECURSIVE (caching) DNS server, you need to enable recursion. ...//省略部分内容... :wq //保存退出

2、更改DNS服务区域配置文件

root@localhost ~]# vim /etc/named.rfc1912.zones // named.rfc1912.zones: // // Provided by Red Hat caching-nameserver package // // ISC BIND named zone configuration for zones recommended by // RFC 1912 section 4.1 : localhost TLDs and address zones // and // (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; }; ...//省略部分内容... // // Provided by Red Hat caching-nameserver package // // ISC BIND named zone configuration for zones recommended by // RFC 1912 section 4.1 : localhost TLDs and address zones // and // (c)2007 R W Franks // // See /usr/share/doc/bind*/sample/ for example named configuration files. // view "lan" { //设置对内局域网用户的区域结构 match-{ 192.168.100.0/24; }; //匹配条目来自局域网的客户端IP地址 zone "linuxmi.com" IN { //设置域名信息 type master; //区域类型为主区域 file "linuxmi.com.lan"; // 区域数据文件为“linuxmi.com.lan” }; zone "." IN { //配置根域名解析(可以从主配置文件named.conf中复制即可) type hint; file "named.ca"; }; }; view "wan" { //设置面向广域网用户的区域结构 match-clients { 12.0.0.0/24; }; //匹配条目来自广域网的客户端IP地址 zone "linuxmi.com" IN { type master; file "linuxmi.com.wan"; // 区域数据文件为“linuxmi.com.wan” }; }; ~ ~ ~ :wq //保存退出

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/4ba715a96d23861441a259477bd01a50.html