目录
[7、双网卡的话记得注释以下内容、注释完不能ifdown ens33否则会刷新文件取消注释](#7、双网卡的话记得注释以下内容、注释完不能ifdown ens33否则会刷新文件取消注释)
一、所有主机初始化
bash
[root@localhost ~] systemctl stop firewalld
[root@localhost ~] setenforce 0
[root@localhost ~] iptables -F
二、135、136服务器,部署DNS调度服务器
1、更改主机主从DNS服务器的主机名称
bash
[root@ansible ~]# hostnamectl set-hostname DNS1
[root@ansible ~]# bash
[root@dns1 ~]#
[root@agent ~]# hostnamectl set-hostname DNS2
[root@agent ~]# bash
[root@dns2 ~]#
2、安装bind软件、修改主配置文件
bash
[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、修改区域配置文件
bash
[root@dns1 ~]# vim /etc/named.rfc1912.zones
zone "skl.com" IN {
type master;
file "skl.localhost";
allow-update { none; };
};
4、修改数据文件
bash
[root@dns1 named]# vim skl.localhost
$TTL 1D
@ IN SOA skl.com. rname.invalid. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS dns.skl.com.
dns A 192.168.147.135
www A 192.168.147.254
www A 192.168.147.253
5、启动named服务、修改网卡信息
bash
[root@dns1 named]# systemctl start named
[root@dns1 named]# vim /etc/sysconfig/network-scripts/ifcfg-ens33
[root@dns1 named]# ifdown ens33&&ifup ens33
6、解析
bash
[root@DNS1 ~]# nslookup
> www.skl.com
Server: 192.168.147.135
Address: 192.168.147.135#53
Name: www.skl.com
Address: 192.168.147.254
Name: www.skl.com
Address: 192.168.147.253
7、双网卡的话记得注释以下内容、注释完不能ifdown ens33否则会刷新文件取消注释
bash
[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、从服务器配置
bash
[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#53
Name: www.skl.com
Address: 192.168.147.253
Name: www.skl.com
Address: 192.168.147.254