声明:安装来自视频https://www.bilibili.com/video/BV1PJ411h7Sw?p=13
一、集群规划如图:
所用机器:CentOS7 minial,所有机器均为网卡nat模式
一、安装epel源,关闭防火墙和selinux
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
二、安装必要工具
yum install wget net-tools telnet tree nmap sysstat lrzsz dos2unix bind-utils -y
三、DNS初始化
1.在10.4.7.11主机安装
yum install -y bind
2.配置DNS
主配置文件
vim /etc/named.conf // 修改
listen-on port 53 { 10.4.7.11; };
// listen-on-v6 port 53 { ::1; };
allow-query { any; };
forwarders { 10.4.7.254; }; // 上级DNS,此处指向网关
dnssec-enable no;
dnssec-validation no;
配置区域文件
vim /etc/named.rfc1912.zones // 添加
zone "host.com" IN {
type master;
file "host.com.zone";
allow-update { 10.4.7.11; };
};
zone "xyly.com" IN {
type master;
file "xyly.com.zone";
allow-update { 10.4.7.11; };
};
配置数据文件
cp -a /var/named/named.localhost /var/named/host.com.zone
vim /var/named/host.com.zone
$TTL 600 ; 10 minutes
@ IN SOA dns.host.com. dnsadmin.host.com. (
2020051400 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS dns.host.com.
$TTL 60 ; 1 minute
dns A 10.4.7.11
SX7-11 A 10.4.7.11
SX7-12 A 10.4.7.12
SX7-21 A 10.4.7.21
SX7-22 A 10.4.7.22
SX7-200 A 10.4.7.200
cp -a /var/named/named.localhost /var/named/xyly.com.zone
vim /var/named/xyly.com.zone
$ORIGIN xyly.com.
$TTL 600 ; 10 minutes
@ IN SOA dns.xyly.com. dnsadmin.xyly.com. (
2020051401 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS dns.xyly.com.
$TTL 60 ; 1 minute
dns A 10.4.7.11
启动服务
systemctl start named
3.测试DNS
dig -t A sx7-12.host.com @10.4.7.11 +short
4.配置DNS客户端(所有机器均需修改)
sed -i '/^DNS/s/254/11/' /etc/sysconfig/network-scripts/ifcfg-ens32
systemctl restart network
sed -i '1asearch host.com ' /etc/resolv.conf
测试结果