Centos8下部署DNS服务器

Deploy a DNS server in the CentOS 8 server zone to enable custom intranet domain name mapping for IP access

Posted by 小张同学 on 2019-06-02
Words 206 and Reading Time 1 Minutes
Viewed Times

一,安装bind

1
yum -y install bind*

二,允许所有访问来源IP

修改 /etc/named.conf 配置文件

1
2
listen-on port 53 { any; };
allow-query { any; };

三,配置文件增加区域域名

修改 /etc/named.rfc1912.zones 配置文件

1
2
3
4
5
6
//@为要添加的域名
zone "@" IN {
type master;
file "@.zone";
allow-update { none; };
};

四,带属性复制默认配置named.localhost,

1
2
3
//名字为@.zone(@为要添加的域名)
cd /var/named
cp -p named.localhost @.zone</pre>

五,在区域域名配置文件(/var/named/@.zone)添加解析

1
2
3
// 格式例子:
iot IN A 192.168.110.100
router IN A 192.168.110.1

六,重启服务

1
2
Systemctl star named 
Systemctl restart named

如不能正常解析需要关闭selinux与清空防火墙规则

1
2
setenforce 0
iptables -F

查看端口开启情况 (DNS 服务默认端口 53)

1
2
netstat -anpt | grep 53 
netstat -anpu | grep 53


文章作者: 小张同学-ZHDDOS
联系邮箱:haidong@zhddos.com
版权声明:本博客为非营利性网站,所有文章均自主编辑或采集自网络,如有侵权请联系我删除。