一键安装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/bashfirwalld_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<<eofzone "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 ;Serial3600 ;Refresh1800 ;Retry604800 ;Expire86400 ;Minimum TTL )@ IN NS admin.wg007.com.admin IN A 172.18.47.110www IN A 172.18.47.110app IN A 172.18.47.110ppp IN A 172.18.47.110ftp IN CNAME www.wg007.comeof}server_restart(){ systemctl restart named}#############################主dns服务器firwalld_stoprpm -qa |grep bindif [ $? -ne 0 ]; then yum_installfised_changecat /etc/named.conf|grep -w "wg007"if [ $? -ne 0 ]; then edit_named_conffiif [ ! -f /var/named/wg007.com.zone ]; then edit_zonefiserver_restart#############################从dns服务器ssh root@172.18.47.112 "yum install bind bind-chroot bind-utils -ysed -i '13s/127.0.0.1/any/' /etc/named.confsed -i '21s/localhost/any/' /etc/named.confcat >>/etc/named.conf<<eofzone "wg007.com" IN { type slave; file "slaves.wg007.com.zone"; masters { 172.18.47.110; };};eofsystemctl restart named" |