一键安装dns主从服务器
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
#!/bin/bash firwalld_stop(){ systemctl stop firewalld setenforce 0 } yum_install(){ yum install bind bind-chroot bind-utils -y } sed_change(){ sed -i '13s/127.0.0.1/any/' /etc/named .conf sed -i '21s/localhost/any/' /etc/named .conf } edit_named_conf(){ cat >> /etc/named .conf<<eof zone "wg007.com" IN { type master; file "wg007.com.zone" ; allow-update { none; }; allow-transfer { 172.18.47.112; }; notify yes ; also-notify { 172.18.47.112; }; }; eof } edit_zone(){ cat >> /var/named/wg007 .com.zone<<eof $TTL 86400 @ IN SOA wg007.com. admin.wg007.com. ( 20200107 ;Serial 3600 ;Refresh 1800 ;Retry 604800 ;Expire 86400 ;Minimum TTL ) @ IN NS admin.wg007.com. admin IN A 172.18.47.110 www IN A 172.18.47.110 app IN A 172.18.47.110 ppp IN A 172.18.47.110 ftp IN CNAME www.wg007.com eof } server_restart(){ systemctl restart named } #############################主dns服务器 firwalld_stop rpm -qa | grep bind if [ $? - ne 0 ]; then yum_install fi sed_change cat /etc/named .conf| grep -w "wg007" if [ $? - ne 0 ]; then edit_named_conf fi if [ ! -f /var/named/wg007 .com.zone ]; then edit_zone fi server_restart #############################从dns服务器 ssh root@172.18.47.112 " yum install bind bind-chroot bind-utils -y sed -i '13s/127.0.0.1/any/' /etc/named .conf sed -i '21s/localhost/any/' /etc/named .conf cat >> /etc/named .conf<<eof zone "wg007.com" IN { type slave; file "slaves.wg007.com.zone"; masters { 172.18.47.110; }; }; eof systemctl restart named " |