目录
一、所有主机初始化
二、135、136服务器,部署DNS调度服务器
1、更改主机主从DNS服务器的主机名称
2、安装bind软件、修改主配置文件
3、修改区域配置文件
4、修改数据文件
5、启动named服务、修改网卡信息
6、解析
7、双网卡的话记得注释以下内容、注释完不能ifdown ens33否则会刷新文件取消注释
8、从服务器配置
一、所有主机初始化
[root@localhost ~] systemctl stop firewalld
[root@localhost ~] setenforce 0
[root@localhost ~] iptables -F
二、135、136服务器,部署DNS调度服务器
1、更改主机主从DNS服务器的主机名称
[root@ansible ~]# hostnamectl set-hostname DNS1
[root@ansible ~]# bash
[root@dns1 ~]#
[root@agent ~]# hostnamectl set-hostname DNS2
[root@agent ~]# bash
[root@dns2 ~]#
2、安装bind软件、修改主配置文件
[root@dns1 ~]# yum -y install bind
[root@lb1 ~]# vim /etc/keepalived/keepalived.conf
12 options {13 listen-on port 53 { 192.168.147.135; };14 listen-on-v6 port 53 { ::1; };15 directory "/var/named";16 dump-file "/var/named/data/cache_dump.db";17 statistics-file "/var/named/data/named_stats.txt";18 memstatistics-file "/var/named/data/named_mem_stats.txt";19 recursing-file "/var/named/data/named.recursing";20 secroots-file "/var/named/data/named.secroots";21 allow-query { any; };22 allow-transfer { 192.168.147.136; }
3、修改区域配置文件
[root@dns1 ~]# vim /etc/named.rfc1912.zones
zone "skl.com" IN {type master;file "skl.localhost";allow-update { none; };
};
4、修改数据文件
[root@dns1 named]# vim skl.localhost
$TTL 1D
@ IN SOA skl.com. rname.invalid. (0 ; serial1D ; refresh1H ; retry1W ; expire3H ) ; minimumNS dns.skl.com.
dns A 192.168.147.135
www A 192.168.147.254
www A 192.168.147.253
5、启动named服务、修改网卡信息
[root@dns1 named]# systemctl start named
[root@dns1 named]# vim /etc/sysconfig/network-scripts/ifcfg-ens33
[root@dns1 named]# ifdown ens33&&ifup ens33
6、解析
[root@DNS1 ~]# nslookup
> www.skl.com
Server: 192.168.147.135
Address: 192.168.147.135#53Name: www.skl.com
Address: 192.168.147.254
Name: www.skl.com
Address: 192.168.147.253
7、双网卡的话记得注释以下内容、注释完不能ifdown ens33否则会刷新文件取消注释
[root@DNS1 ~]# vim /etc/resolv.conf
# Generated by NetworkManager
#nameserver 180.76.76.76
#nameserver 223.5.5.5
nameserver 192.168.147.135
8、从服务器配置
[root@AS2 ~]# vim /etc/named.conf
listen-on port 53 { 192.168.147.136; };allow-query { any; };[root@AS2 ~]# vim /etc/named.rfc1912.zones
zone "skl.com" IN {type slave;file "slaves/skl.localhost";allow-update { 192.168.147.135; };[root@DNS2 ~]# vim /etc/sysconfig/network-scripts/ifcfg-ens33
DNS1=192.168.147.135 #末行添加解析服务器地址(从DNS服务器IP)[root@AS2 ~]# nslookup
> www.skl.com
Server: 192.168.147.135
Address: 192.168.147.135#53Name: www.skl.com
Address: 192.168.147.253
Name: www.skl.com
Address: 192.168.147.254