-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstbind.sh
More file actions
executable file
·82 lines (70 loc) · 2.1 KB
/
instbind.sh
File metadata and controls
executable file
·82 lines (70 loc) · 2.1 KB
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
78
79
80
81
82
#!/bin/bash
# should run root user.
TESTDOMAIN="jacobbaek.com"
apt install -y bind9 bind9utils bind9-doc dnsutils
cat << EOF > /etc/bind/named.conf.options
acl internal-network {
192.168.0.0/24;
};
options {
directory "/var/cache/bind";
allow-query { localhost; internal-network; };
allow-transfer { localhost; };
forwarders { 8.8.8.8; };
recursion yes;
dnssec-validation auto;
listen-on-v6 { any; };
};
EOF
cat << EOF > /etc/bind/named.conf.local
zone "$TESTDOMAIN" IN {
type master;
file "/etc/bind/forward.$TESTDOMAIN";
allow-update { none; };
};
zone "0.168.192.in-addr.arpa" IN {
type master;
file "/etc/bind/reverse.$TESTDOMAIN";
allow-update { none; };
};
EOF
cat << EOF > /etc/bind/forward.$TESTDOMAIN
\$TTL 604800
@ IN SOA test.$TESTDOMAIN. root.test.$TESTDOMAIN. (
2022072651 ; Serial
3600 ; Refresh
1800 ; Retry
604800 ; Expire
604600 ) ; Negative Cache TTL
;Name Server Information
@ IN NS test.$TESTDOMAIN.
;IP address of Your Domain Name Server(DNS)
test IN A 192.168.0.40
;Mail Server MX (Mail exchanger) Record
$TESTDOMAIN. IN MX 10 mail.$TESTDOMAIN.
;A Record for Host names
www IN A 192.168.0.50
mail IN A 192.168.0.60
;CNAME Record
ftp IN CNAME www.$TESTDOMAIN.
EOF
cat << EOF > /etc/bind/reverse.$TESTDOMAIN
\$TTL 86400
@ IN SOA $TESTOMDINA. root.$TESTDOMAIN. (
2022072752 ;Serial
3600 ;Refresh
1800 ;Retry
604800 ;Expire
86400 ;Minimum TTL
)
;Your Name Server Info
@ IN NS test.$TESTDOMAIN.
test IN A 192.168.0.40
;Reverse Lookup for Your DNS Server
40 IN PTR test.$TESTDOMAIN.
;PTR Record IP address to HostName
50 IN PTR www.$TESTDOMAIN.
60 IN PTR mail.$TESTDOMAIN.
EOF
systemctl restart named
systemctl --no-pager status named