summaryrefslogtreecommitdiff
blob: 9c41c68c62d16d68a08f38539a992f4e95b41bd8 (plain)
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
/*
 * Refer to the named.conf(5) and named(8) man pages, and the documentation
 * in /usr/share/doc/bind-9 for more details.
 * Online versions of the documentation can be found here:
 * http://www.isc.org/software/bind/documentation
 *
 * If you are going to set up an authoritative server, make sure you
 * understand the hairy details of how DNS works. Even with simple mistakes,
 * you can break connectivity for affected parties, or cause huge amounts of
 * useless Internet traffic.
 */

acl "xfer" {
	/* Allow no transfers. If we have other name servers, place them here. */
	//127.0.0.1/32;
	//::1/128;
	"none";
};

/* 
 * You might put in here some ips which are allowed to use the cache or
 * recursive queries
 */
acl "trusted" {
	127.0.0.0/8;
	::1/128;
};

options {
	directory "/var/bind";
	pid-file "/var/run/named/named.pid";

	/* https://www.isc.org/solutions/dlv */
	bindkeys-file "/etc/bind/bind.keys";

	listen-on-v6 { none; };
	listen-on { 127.0.0.1; };

	allow-query {
		/*
		 * Accept queries from our "trusted" ACL.  We will
		 * allow anyone to query our master zones below.
		 * This prevents us from becoming a free DNS server
		 * to the masses.
		 */
		trusted;
	};

	allow-query-cache {
		/* Use the cache for the "trusted" ACL. */
		trusted;
	};

	allow-transfer {
		/*
		 * Zone tranfers limited to members of the
		 * "xfer" ACL (e.g. secondary nameserver).
		 */
		xfer;
	};

/*
 * If you've got a DNS server around at your upstream provider, enter its
 * IP address here, and enable the line below. This will make you benefit
 * from its cache, thus reduce overall DNS traffic in the Internet.
 * 
 * Uncomment the following lines to turn on DNS forwarding, and change
 *  and/or update the forwarding ip address(es):
 */
/*
	forward first;
	forwarders {
	//	123.123.123.123;	// Your ISP NS
	//	124.124.124.124;	// Your ISP NS
		4.2.2.1;		// Level3 Public DNS
		4.2.2.2;		// Level3 Public DNS
		8.8.8.8;		// Google Open DNS
		8.8.4.4;		// Google Open DNS
	};

*/

	//dnssec-enable yes;

	/* if you have problems and are behind a firewall: */
	//query-source address * port 53;
};

logging {
	channel default_log {
		file "/var/log/named/named.log" versions 5 size 50M;
		print-time yes;
		print-severity yes;
		print-category yes;
	};

	category default { default_log; };
	category general { default_log; };
};

include "/etc/bind/rndc.key";
controls {
	inet 127.0.0.1 port 953 allow { 127.0.0.1/32; ::1/128; } keys { "rndc-key"; };
};


view "internal" in {
	/*
	 * Our internal (trusted) view. We permit the internal networks
	 * to freely access this view. We perform recursion for our
	 * internal hosts, and retrieve data from the cache for them.
	 */

	match-clients { trusted; };
	recursion yes;
	additional-from-auth yes;
	additional-from-cache yes;

	zone "." in {
		type hint;
		file "/var/bind/root.cache";
	};

	zone "localhost" IN {
		type master;
		file "pri/localhost.zone";
		allow-update { none; };
		notify no;
	};

	zone "127.in-addr.arpa" IN {
		type master;
		file "pri/127.zone";
		allow-update { none; };
		notify no;
	};

	/*
	 * NOTE: All zone blocks for "public" view should be listed here in "internal"
	 * too! Otherwise you'll have trouble to resolv the public zones properly.
	 * That affects all hosts from the "trusted" ACL.
	 * A separate config, which contains all zone blocks, might be better in
	 * this case. Then you can simply add:
	 * include "/etc/bind/zones.cfg";
	 * for "internal" and "public" view.
	 */
};

view "public" in {
	/*
	 * Our external (untrusted) view. We permit any client to access
	 * portions of this view. We do not perform recursion or cache
	 * access for hosts using this view.
	 */

	match-clients { any; };
	recursion no;
	additional-from-auth no;
	additional-from-cache no;

	zone "." in {
		type hint;
		file "/var/bind/root.cache";
	};

	//zone "YOUR-DOMAIN.TLD" {
	//	type master;
	//	file "/var/bind/pri/YOUR-DOMAIN.TLD.zone";
	//	allow-query { any; };
	//};

	//zone "YOUR-SLAVE.TLD" {
	//	type slave;
	//	file "/var/bind/sec/YOUR-SLAVE.TLD.zone";
	//	masters { <MASTER>; };

	//	/* Anybody is allowed to query but transfer should be controlled by the master. */
	//	allow-query { any; };
	//	allow-transfer { none; };

	//	/* The master should be the only one who notifies the slaves, shouldn't it? */
	//	allow-notify { <MASTER>; };
	//	notify no;
	//};

	/*
	 * Briefly, a zone which has been declared delegation-only will be effectively
	 * limited to containing NS RRs for subdomains, but no actual data beyond its
	 * own apex (for example, its SOA RR and apex NS RRset). This can be used to
	 * filter out "wildcard" or "synthesized" data from NAT boxes or from
	 * authoritative name servers whose undelegated (in-zone) data is of no
	 * interest.
	 * See http://www.isc.org/products/BIND/delegation-only.html for more info
	 */

	//zone "COM" { type delegation-only; };
	//zone "NET" { type delegation-only; };
};