1.安装bind
#安装bind
yum install -y bind bind-chroot bind-utils
2.主配置文件
vi /etc/named.conf
#修改监听为本机IP
listen-on port 53 { 172.18.0.227; };
#允许所有人访问
allow-query { any; };
3.添加域配置
vi /etc/named.rfc1912.zones
#域名配置 : 正向解析配置
zone "wanmagroup.com" IN {
type master;
file "named.wanmagroup.com.zone";
allow-update { none; };
}; #反向解析配置
zone "0.18.172.in-addr.arpa" IN {
type master;
file "named.0.18.172.in.zone";
allow-update { none; };
};
#正向配置解析文件 /var/named/named.wanmagroup.com.zone
$TTL 86400
@ IN SOA @ root. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
IN NS @
IN A 172.18.0.227
* IN A 172.18.0.227
#反向配置解析文件 /var/named/named.0.18.172.in.zone
$TTL 1D
@ IN SOA @ root. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS @
A 172.18.0.227
4.检查配置
#检查主配置文件
named-checkconf #检查正向配置文件
named-checkzone wanmagroup.com named.wanmagroup.com.zone #检查反向配置文件
named-checkzone wanmagroup.com named.0.18.172.in.zone
5.启动服务器
#重启服务
systemctl restart named.service #检查服务状态
systemctl status named.service -l