A. 192.168.36.6(OS6):test
B. 192.168.36.7(OS7):localdns
C. 192.168.36.17(OS7):rootdns
D. 192.168.36.27(OS7):comdns
E. 192.168.36.37(OS7):master
F. 192.168.36.47(OS7):slave
G. 192.168.36.57(OS7):www
1. 安装http服务器:yum install httpd -y
2. 生成一个index.html主页文件:echo www.haha.com > /var/www/html/index.html
3. 启动httpd服务:systemctl start httpd && systemctl enable httpd
4. test主机测试:curl 192.168.36.57
1. 安装DNS服务器:yum install bind -y
2. 修改DNS主配置文件:vim /etc/named.conf
// listen-on port 53 { 127.0.0.1; };
allow-transfer {192.168.36.47;}; #允许192.168.36.47即slave抓取dns信息
// allow-query { localhost; };
3. 修改zone配置文件:vim /etc/named.rfc1912.zones ,增加域名信息
zone "magedu.com" {
type master;
file "magedu.com.zone";
};
4. 复制zone数据库并保持属性:cp -p /var/named/named.localhost /var/named/magedu.com.zone
5. 修改主DNS数据库内容:vim /var/named/magedu.com.zone
$TTL 1D
@ IN SOA master admin.magedu.com. (
2 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS master
NS slave #先配置上从DNS服务器
master A 192.168.36.37
slave A 192.168.36.47 #从DNS服务器的A记录
www A 192.168.36.57
6. 检查配置文件:named-checkconf
7. 启动named服务:systemctl start named && systemctl enable named
8. test主机测试:dig www.magedu.com @192.168.36.37
1. 安装DNS服务器:yum install bind -y
2. 修改DNS主配置文件:vim /etc/named.conf
// listen-on port 53 { 127.0.0.1; };
allow-transfer {none;}; 禁止抓取dns信息
// allow-query { localhost; };
3. 修改cone配置文件:vim /etc/named.rfc1912.zones 增加指向主DNS信息
zone "magedu.com" {
type slave;
masters {192.168.36.37;};
file "slaves/magedu.com.zone.slave";
};
4. 检查配置文件:named-checkconf
5. 启动named服务:systemctl start named && systemctl enable named
6. 查看ls /var/named/slaves/ 目录中是否有从master同步过来的zone文件
7. test主机测试:dig www.magedu.com @192.168.36.47
1. 安装DNS服务器:yum install bind -y
2. 修改DNS主配置文件:vim /etc/named.conf
// listen-on port 53 { 127.0.0.1; };
// allow-query { localhost; };
3. 修改zone配置文件:vim /etc/named.rfc1912.zones 增加二级域名
zone "com" {
type master;
file "com.zone";
};
4. 复制zone数据库并保持属性:cp -p /var/named/named.localhost /var/named/com.zone
5. 修改数据库内容:vim /var/named/com.zone
$TTL 1D
@ IN SOA master admin.magedu.com. (
1 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS master
magedu NS magedudns1 #子域DNS服务器
magedu NS magedudns2 #子域DNS服务器
master A 192.168.36.27
magedudns1 A 192.168.36.37 #子域DNS服务器的A记录
magedudns2 A 192.168.36.47 #子域DNS服务器的A记录
6. 检查配置文件:named-checkconf
7. 启动named服务:systemctl start named && systemctl enable named
8. test主机测试:dig www.magedu.com @192.168.36.27
1. 安装DNS服务器:yum install bind -y
2. 修改DNS主配置文件:vim /etc/named.conf
// listen-on port 53 { 127.0.0.1; };
// allow-query { localhost; };
#修改根指向自己,如下:
zone "." IN {
type master;
file "root.zone";
};
3. 复制zone数据库并保持属性:cp -p /var/named/named.localhost /var/named/root.zone
4. 修改数据库内容:vim /var/named/com.zone
$TTL 1D
@ IN SOA master admin.magedu.com. (
1 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS master
com NS comdns #子域DNS服务器
master A 192.168.36.17
comdns A 192.168.36.27 #子域DNS服务器的A记录
5. 检查配置文件:named-checkconf
6. 启动named服务:systemctl start named && systemctl enable named
7. test主机测试:dig www.magedu.com @192.168.36.17
1. 安装DNS服务器:yum install bind -y
2. 修改DNS主配置文件:vim /etc/named.conf
// listen-on port 53 { 127.0.0.1; };
// allow-query { localhost; };
#关闭dnssec功能,如下:
dnssec-enable no;
dnssec-validation no;
3. 修改指向的根服务器:vim /var/named/named.ca,只留下面2行内容即可。
. 518400 IN NS a.root-servers.net.
a.root-servers.net. 3600000 IN A 192.168.36.17
4. 检查配置文件:named-checkconf
5. 启动named服务:systemctl start named && systemctl enable named
1. DNS1=192.168.36.7
2. service network restart
3. cat /etc/resolv.conf 检查DNS是否生效
4. test主机测试:dig www.magedu.com @192.168.36.7
1. 使用rndc flush命令清空所有DNS服务器的记录
2. 停止master服务器上的DNS服务:systemctl stop named
3. test主机测试:dig www.magedu.com
转载于:https://blog.51cto.com/13560168/2385448