Centos7安装BindDNS解析服务
Bind服务下载
#yum下载安装bing服务
yum -y install bind bind-utils
named.conf配置修改
#备份修改named.conf文件
cp /etc/named.conf /etc/named.conf.bak
vi /etc/named.conf
- listen-on port 53 :修改127为本机IP
- allow-query:修改为any
options {
listen-on port 53 { 10.0.3.62; };
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; };
named.rfc1912.zones配置文件内容及修改
##编辑named.rfc1912.zones,添加正向解析
vi /etc/named.rfc1912.zones
- 添加下方一组配置
- hwhttc.com.:为要用的域名(注意末尾的点".")
- hwhttc.com.zone:为正向配置文件
zone "hwhttc.com." IN {
type master;
file "hwhttc.com.zone";
allow-update { none; };
};
创建正向配置文件及修改
##创建正向配置文件
cd /var/named/
cp named.localhost hwhttc.com.zone ####正向文件名称要和named.rfc1912.zones里面配置的一致
###编辑正向配置文件
vi hwhttc.com.zone
- 修改rname.invalid.为自己的域名(注意末尾的点".")
- 最下面添加一行www IN A 10.0.3.191(10.0.3.191为要解析后的地址)
$TTL 1D
@ IN SOA @ hwhttc.com. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS @
A 127.0.0.1
AAAA ::1
www IN A 10.0.3.191
###给hwhttc.com.zone文件授权
chmod 777 hwhttc.com.zone
关闭防火墙
systemctl stop firewalld
启动Bind服务
systemctl start named