所有文件不清楚含义的,请先看 最基础的dns实现 juejin.cn/post/684490…
正向主服务器实现及优化 juejin.cn/post/684490…
主从服务器实现及其安全 juejin.cn/post/684490…
1.主dns服务器搭建
1.yum install bind -y
2.vim /etc/named.conf
options {
//listen-on port 53 { 127.0.0.1; };
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";
recursing-file "/var/named/data/named.recursing";
secroots-file "/var/named/data/named.secroots";
//allow-query { localhost; };
allow-transfer {10.0.0.3;};
3. vim /etc/named.rfc1912.zones
zone "wyjn.icu" IN {
type master;
file "wyjn.icu.zone";
allow-uodate {none;}; 不允许远程修改
};
4. vim /var/named/wyjn.icu.zone
$TTL 1D
@ IN SOA master 3555409634.qq.com. ( 20200318 1D 10M 3D 2H )
NS master
NS slave
master A 10.0.0.8
slave A 10.0.0.3
websrv A 10.0.0.3
www CNAME websrv
app A 47.92.200.163
@ A 10.0.0.8
* CNAME www
5.systemctl enable --now named.service
2.从服务器搭建
1.yum install bind -y
2.vim /etc/named.conf
options {
//listen-on port 53 { 127.0.0.1; };
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";
recursing-file "/var/named/data/named.recursing";
secroots-file "/var/named/data/named.secroots";
//allow-query { localhost; };
allow-transfer {none;};
3.vim /etc/named.rfc1912.zones
zone "wyjn.icu" IN {
type slave;
masters {10.0.0.8;};
file "slaves/wyjn.icu.slave.zone";
allow-update {none;};
};
4.systemctl enable --now named.service