author:JevonWei
版权声明:原创作品
构建"." DNS、"com" DNS及"danran.com",用户通过"电信运营商"DNS服务器转发到. DNS,然后分派到danran.com DNS上查询www.danran.com,130为120从DNS
拓扑图如下
192.168.198.120主DNS
-
安装程序包
yum -y install named
systemctl start named
systemctl enable named
iptables -F
setenforce 0 -
vim /etc/named.conf
options {
listen-on port 53 { localhost; };
allow-query { any; }; -
vim /etc/named.rfc1912.zones
zone "danran.com" IN {
type master;
file "danran.zone";
}; -
vim /var/named/danran.zone
$TTL 1D
@ IN SOA ns1.danran.com. dnsadmin.danran.cam. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS ns1.danran.com.
ns1 A 192.168.198.120
www A 192.168.198.150 chgrp named /var/named/danran.zone
-
修改DNS指向的根DNS
vim /var/named/named.ca \ \将DNS的根DNS指向自定义的192.168.198.100
. 3600000 NS A.ROOT-SERVERS.NET.
A.ROOT-SERVERS.NET. 3600000 A 192.168.198.100 systemctl restart named
192.168.198.130 从DNS
-
安装程序包
yum -y install bind
systemctl start named
systemctl enable named
iptables -F
setenforce 0 -
vim /etc/named.conf
options {
listen-on port 53 { localhost; };
allow-query { any; };;
} -
vim /etc/named.rfc1912.zones
从DNS的正向解析文件记录
zone "danran.com" IN {
type slave; \DNS类型为从属DNS
master { 192.168.198.120;}; \主DNS为192.168.198.134
file "slaves/danran.slave"; \从DNS的数据库文件为slaves/danran.slave
}; -
修改DNS指向的根DNS
vim /var/named/named.ca \ \将DNS的根DNS指向自定义的192.168.198.100
. 3600000 NS A.ROOT-SERVERS.NET.
A.ROOT-SERVERS.NET. 3600000 A 192.168.198.100 systemctl restart named
rndc reload
192.168.198.110 com DNS
-
安装程序包
yum -y install bind
systemctl start named
systemctl enable named
iptables -F
setenforce 0 -
vim /etc/named.conf
options {
listen-on port 53 { localhost; };
allow-query { any; };
dnssec-enable no;
dnssec-validation no;
} -
vim /etc/named.rfc1912.zones
zone "com" IN {
type master;
file "com.zone";
}; -
vim /var/named/com.zone
$TTL 1D
@ IN SOA ns1.com. dnsadmin.cam. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS ns1.com.
ns1 A 192.168.198.110danran NS ns2
ns2 A 192.168.198.120 \\子域委派
danran NS ns3
ns3 A 192.168.198.130 chgrp named /var/named/com.zone
-
修改DNS指向的根DNS
vim /var/named/named.ca \ \将DNS的根DNS指向自定义的192.168.198.100
. 3600000 NS A.ROOT-SERVERS.NET.
A.ROOT-SERVERS.NET. 3600000 A 192.168.198.100 systemctl restart named
192.168.198.100 .根 DNS
-
安装程序包
yum -y install bind
systemctl start named
systemctl enable named
iptables -F
setenforce 0 -
vim /etc/named.conf
options {
listen-on port 53 { localhost; };
allow-query { any; };
dnssec-enable no;
dnssec-validation no;
} -
将vim /etc/named.conf配置文件中的.DNS的zone类型修改为master
zone "." IN {
type master;
file "root.zone"; \. 根文件名修改为root.zone
}; -
修改.根文件对应的zone文件
vim /etc/named.rfc1912.zones
zone "." IN {
type master;
file "root.zone"; \. 根文件名修改为root.zone
};
3.4 二选一
-
vim /var/named/root.zone
$TTL 1D
@ IN SOA ns1. dnsadmin (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS ns1
ns1 A 192.168.198.100com NS ns2
ns2 A 192.168.198.110 \\子域委派为com域 chgrp named /var/named/com.zone
systemctl restart named
192.168.198.200 电信 DNS
-
安装程序包
yum -y install bind
systemctl start named
systemctl enable named
iptables -F
setenforce 0 -
vim /etc/named.conf
options {
listen-on port 53 { localhost; };
allow-query { any; };
dnssec-enable no;
dnssec-validation no;
} -
修改DNS指向的根DNS
vim /var/named/named.ca \ \将DNS的根DNS指向自定义的192.168.198.100
. 3600000 NS A.ROOT-SERVERS.NET.
A.ROOT-SERVERS.NET. 3600000 A 192.168.198.100 systemctl restart named
192.168.198.10 访问测试
dig www.danran.com @192.168.198.200
DNS的相关内容点击链接
创建子域及view
http://119.23.52.191/创建dns子域及view/