实验:正向主DNS实现
实验:反向解析DNS
实验:从DNS服务器实现
在主服务器
vim /etc/named.conf
allow-transfer { slaveip;}; 加此行
从服务器
vim /etc/named.conf
allow-transfer { none;}; 加此行
vim /etc/named.rfc1912.zones
zone “magedu.com” IN {
type slave;
masters { masterip; };
file “slaves/magedu.com.zone.slave”;
};
www.bj.magedu.com.
ftp.bj.magedu.com
www.zz.magedu.com.
实验:实现子域
1 当成记录
2 子域,本机独立域
3 委派给另一台主机维护子域
在父域DNS
vim /etc/named.conf
dnssec-enable no;
dnssec-validation no;
vim /var/named/magedu.com.zone
vim magedu.com.zone
$TTL 86400
@ IN SOA dns1.magedu.com. admin.magedu.com. (
2018060125 ; serial
86400 ; refresh (1 day)
3600 ; retry (1 hour)
259200 ; expire (3 days)
3600 ; minimum (1 hour)
)
NS dns1.magedu.com.
bj NS dns2.magedu.com. ##
dns1 A 192.168.30.7
dns2 A 192.168.30.17 ##
在子域服务器建bj.magedu.com即可
实验:forward 转发
实验:实现智能DNS
1 vim /etc/named.conf
acl beijingnet {
192.168.30.0/24;
};
acl shanghainet {
172.20.0.0/16;
};
acl othernet {
any;
};
options {
listen-on port 53 { localhost; };
listen-on-v6 port 53 { ::1; };
directory “/var/named”;
dump-file “/var/named/data/cache_dump.db”;
statistics-file “/var/named/data/named_stats.txt”;
memstatistics-file “/var/named/data/named_mem_stats.txt”;
allow-query { any; };
allow-transfer { 192.168.30.17;192.168.30.27;};
recursion yes;
dnssec-enable no;
dnssec-validation no;
/* Path to ISC DLV key */
bindkeys-file “/etc/named.iscdlv.key”;
managed-keys-directory “/var/named/dynamic”;
pid-file “/run/named/named.pid”;
session-keyfile “/run/named/session.key”;
};
logging {
channel default_debug {
file “data/named.run”;
severity dynamic;
};
};
view beijingview {
match-clients {beijingnet;};
include “/etc/named.rfc1912.zones.bj”;
};
view shanghaiview {
match-clients {shanghainet;};
zone “magedu.com” {
type master;
file “magedu.com.zone.sh”;
};
};
view otherview {
match-clients {othernet;};
include “/etc/named.rfc1912.zones”;
};
include “/etc/named.root.key”;
cat /etc/named.rfc1912.zones
zone “.” IN {
type hint;
file “named.ca”;
};
zone “magedu.com” IN {
type master;
file “magedu.com.zone”;
allow-transfer { 192.168.30.17;};
};
cat /etc/named.rfc1912.zones.bj
zone “.” IN {
type hint;
file “named.ca”;
};
zone “magedu.com” IN {
type master;
file “magedu.com.zone.bj”;
};
cat /var/named/magedu.com.zone.bj
$TTL 86400
@ IN SOA dns1.magedu.com. admin.magedu.com. (
2018060125 ; serial
86400 ; refresh (1 day)
3600 ; retry (1 hour)
259200 ; expire (3 days)
3600 ; minimum (1 hour)
)
NS dns1.magedu.com.
bj NS dns2.magedu.com.
dns1 A 192.168.30.7
dns2 A 192.168.30.17
websrv A 192.168.30.1
dbsrv A 192.168.30.27
mailsrv A 6.6.6.6
appsrv A 5.5.5.5
www CNAME websrv
[root@centos7 named]#cat /var/named/magedu.com.zone.sh
$TTL 86400
@ IN SOA dns1.magedu.com. admin.magedu.com. (
2018060125 ; serial
86400 ; refresh (1 day)
3600 ; retry (1 hour)
259200 ; expire (3 days)
3600 ; minimum (1 hour)
)
NS dns1.magedu.com.
bj NS dns2.magedu.com.
dns1 A 192.168.30.7
dns2 A 192.168.30.17
websrv A 192.168.30.2
dbsrv A 192.168.30.27
mailsrv A 6.6.6.6
appsrv A 5.5.5.5
www CNAME websrv
[root@centos7 named]#cat /var/named/magedu.com.zone
$TTL 86400
@ IN SOA dns1.magedu.com. admin.magedu.com. (
2018060125 ; serial
86400 ; refresh (1 day)
3600 ; retry (1 hour)
259200 ; expire (3 days)
3600 ; minimum (1 hour)
)
NS dns1.magedu.com.
bj NS dns2.magedu.com.
dns1 A 192.168.30.7
dns2 A 192.168.30.17
websrv A 192.168.30.3
dbsrv A 192.168.30.27
mailsrv A 6.6.6.6
appsrv A 5.5.5.5
www CNAME websrv
本文来自投稿,不代表Linux运维部落立场,如若转载,请注明出处:http://www.178linux.com/99970