1.DNS规划
test1.k3k5.com 192.168.56.201 A
test2.k3k5.com 192.168.56.202 A
testc.k3k5.com test2.k3k5.com CNAME
2.安装 bind
yum install -y bind bind-utils
3. 编辑主配置文件
vim /etc/named.conf
listen- on port 53 { any; };
allow- query { any; };
4.配置区域文件
vim /etc/named.rfc1912.zones
zone "k3k5.com" IN {
type master;
file "k3k5.com.zone";
};
zone "56.168.192.in-addr.arpa" IN {
type master;
file "56.168.192.zone";
};
5.配置正向解析文件
cp -p /var/named/named.localhost /var/named/k3k5.com.zone
vim /var/named/k3k5.com.zone
$TTL 1D
@ IN SOA k3k5.com. root.k3k5.com. (
1 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS dns.k3k5.com.
dns A 192.168.56.XXX
test1 A 192.168.56.201
test2 A 192.168.56.202
testc CNAME test1
6.配置反向解析文件
cp -p /var/named/named.empty /var/named/56.168.192.zone
vim /var/named/56.168.192.zone
$TTL 3H
@ IN SOA k3k5.com. root.k3k5.com. (
1 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS dns.k3k5.com.
201 PTR test1.k3k5.com.
202 PTR test2.k3k5.com.
202 PTR testc.k3k5.com.
7.测试机设置dns
vim /etc/resolv.conf
nameserver 192.168.56.xxx
8.放行端口
firewall-cmd --permanent --add-port=53/tcp --zone=public
firewall-cmd --permanent --add-port=53/udp --zone=public
firewall-cmd --reload
9.启动named,并测试
systemctl restart named
nslookup测试