安装包
dnf install bind bind-utils -y
systemctl stop firewalld.service 关闭防火墙
setenforce 0 关闭selinux
vim /etc/named.conf
配置内容
options {
listen-on port 53 { 192.168.182.129; };
directory “/var/named”;
allow-query { any; };
};
zone “qq.com” IN {
type master;
file “named.qq.com”;
};
zone “182.168.192.in-addr.arpa” IN {
type master;
file “192.168.182.zone”;
};
正向解析
vim /var/named/named.qq.com
配置内容
$TTL 1D
@ IN SOA @ admin.qq.com. (2022090100 1D 1H 3D 1D)
@ IN NS dns.qq.com.
dns IN A 192.168.182.129
www IN A 192.168.182.10
en IN A 192.168.182.20
ftp IN A 192.168.182.30
fff IN CNAME ftp
反向解析
vim /var/named/192.168.182.zone
配置内容
$TTL 1D
@ IN SOA @ admin.qq.com. (2022090100 1D 1H 3D 1D)
@ IN NS dns.qq.com.
129 IN PTR dns.qq.com.
129 IN PTR www.qq.com
重启服务
systemctl restart named
测试
vim /etc/resolv.conf
修改nameserver为服务端IP地址
nslookup www.qq.com
nslookup 192.168.182.129