CentOS 6.8 Bind配置与优化

Bind简介
Bind(Berkeley Internet Name Domain)是一款功能强大的DNS服务器软件,它可以将域名解析为IP地址,实现域名与IP地址之间的映射,在CentOS 6.8系统中,Bind主要用于解析域名,为用户提供稳定的网络服务。
Bind安装
检查系统是否已安装Bind
rpm -qa | grep bind
安装Bind
yum install bind bind-utils
启动Bind服务
service named start
设置Bind服务开机自启
chkconfig named on
Bind配置

修改Bind配置文件
vi /etc/named.conf
修改配置文件内容,以下为示例:
options {
directory "/var/named";
listen-on port 53 { any; };
listen-on-v6 port 53 { any; };
allow-query { any; };
};
zone "example.com" IN {
type master;
file "example.com.db";
}; 生成区域文件
named-checkzone example.com /etc/named/example.com.db
创建区域文件
vi /etc/named/example.com.db
添加区域文件内容,以下为示例:
$TTL 604800
@ IN SOA ns.example.com. admin.example.com. (
2021040101 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS ns.example.com.
ns IN A 192.168.1.10
www IN A 192.168.1.10 重启Bind服务
service named restart
Bind优化
修改配置文件,增加缓存

options {
directory "/var/named";
listen-on port 53 { any; };
listen-on-v6 port 53 { any; };
allow-query { any; };
cache-min-ttl 3600;
};
zone "example.com" IN {
type master;
file "example.com.db";
}; 修改配置文件,增加并行处理
options {
directory "/var/named";
listen-on port 53 { any; };
listen-on-v6 port 53 { any; };
allow-query { any; };
cache-min-ttl 3600;
allow-query-cache { any; };
};
zone "example.com" IN {
type master;
file "example.com.db";
}; FAQs
Q1:如何查看Bind服务的状态?
A1:使用以下命令查看Bind服务的状态:
service named status
Q2:如何检查Bind配置文件是否有错误?
A2:使用以下命令检查Bind配置文件是否有错误:
named-checkconf

