|
|
b7523e |
/*
|
|
|
b7523e |
Sample named.conf BIND DNS server 'named' configuration file
|
|
|
b7523e |
for the Red Hat BIND distribution.
|
|
|
b7523e |
|
|
|
b7523e |
See the BIND Administrator's Reference Manual (ARM) for details, in:
|
|
|
b7523e |
file:///usr/share/doc/bind-{version}/arm/Bv9ARM.html
|
|
|
b7523e |
Also see the BIND Configuration GUI : /usr/bin/system-config-bind and
|
|
|
b7523e |
its manual.
|
|
|
b7523e |
*/
|
|
|
b7523e |
|
|
|
b7523e |
options
|
|
|
b7523e |
{
|
|
|
b7523e |
// Put files that named is allowed to write in the data/ directory:
|
|
|
b7523e |
directory "/var/named"; // "Working" directory
|
|
|
b7523e |
dump-file "data/cache_dump.db";
|
|
|
b7523e |
statistics-file "data/named_stats.txt";
|
|
|
b7523e |
memstatistics-file "data/named_mem_stats.txt";
|
|
|
b7523e |
secroots-file "data/named.secroots";
|
|
|
b7523e |
recursing-file "data/named.recursing";
|
|
|
b7523e |
|
|
|
b7523e |
|
|
|
b7523e |
/*
|
|
|
b7523e |
Specify listenning interfaces. You can use list of addresses (';' is
|
|
|
b7523e |
delimiter) or keywords "any"/"none"
|
|
|
b7523e |
*/
|
|
|
b7523e |
//listen-on port 53 { any; };
|
|
|
b7523e |
listen-on port 53 { 127.0.0.1; };
|
|
|
b7523e |
|
|
|
b7523e |
//listen-on-v6 port 53 { any; };
|
|
|
b7523e |
listen-on-v6 port 53 { ::1; };
|
|
|
b7523e |
|
|
|
b7523e |
/*
|
|
|
b7523e |
Access restrictions
|
|
|
b7523e |
|
|
|
b7523e |
There are two important options:
|
|
|
b7523e |
allow-query { argument; };
|
|
|
b7523e |
- allow queries for authoritative data
|
|
|
b7523e |
|
|
|
b7523e |
allow-query-cache { argument; };
|
|
|
b7523e |
- allow queries for non-authoritative data (mostly cached data)
|
|
|
b7523e |
|
|
|
b7523e |
You can use address, network address or keywords "any"/"localhost"/"none" as argument
|
|
|
b7523e |
Examples:
|
|
|
b7523e |
allow-query { localhost; 10.0.0.1; 192.168.1.0/8; };
|
|
|
b7523e |
allow-query-cache { ::1; fe80::5c63:a8ff:fe2f:4526; 10.0.0.1; };
|
|
|
b7523e |
*/
|
|
|
b7523e |
|
|
|
b7523e |
allow-query { localhost; };
|
|
|
b7523e |
allow-query-cache { localhost; };
|
|
|
b7523e |
|
|
|
b7523e |
/* Enable/disable recursion - recursion yes/no;
|
|
|
b7523e |
|
|
|
b7523e |
- If you are building an AUTHORITATIVE DNS server, do NOT enable recursion.
|
|
|
b7523e |
- If you are building a RECURSIVE (caching) DNS server, you need to enable
|
|
|
b7523e |
recursion.
|
|
|
b7523e |
- If your recursive DNS server has a public IP address, you MUST enable access
|
|
|
b7523e |
control to limit queries to your legitimate users. Failing to do so will
|
|
|
b7523e |
cause your server to become part of large scale DNS amplification
|
|
|
b7523e |
attacks. Implementing BCP38 within your network would greatly
|
|
|
b7523e |
reduce such attack surface
|
|
|
b7523e |
*/
|
|
|
b7523e |
recursion yes;
|
|
|
b7523e |
|
|
|
b7523e |
/* DNSSEC related options. See information about keys ("Trusted keys", bellow) */
|
|
|
b7523e |
|
|
|
b7523e |
/* Enable DNSSEC validation on recursive servers */
|
|
|
b7523e |
dnssec-validation yes;
|
|
|
b7523e |
|
|
|
b7523e |
/* In Fedora we use /run/named instead of default /var/run/named
|
|
|
b7523e |
so we have to configure paths properly. */
|
|
|
b7523e |
pid-file "/run/named/named.pid";
|
|
|
b7523e |
session-keyfile "/run/named/session.key";
|
|
|
b7523e |
|
|
|
b7523e |
managed-keys-directory "/var/named/dynamic";
|
|
|
b7523e |
|
|
|
b7523e |
/* In Fedora we use system-wide Crypto Policy */
|
|
|
b7523e |
/* https://fedoraproject.org/wiki/Changes/CryptoPolicy */
|
|
|
b7523e |
include "/etc/crypto-policies/back-ends/bind.config";
|
|
|
b7523e |
};
|
|
|
b7523e |
|
|
|
b7523e |
logging
|
|
|
b7523e |
{
|
|
|
b7523e |
/* If you want to enable debugging, eg. using the 'rndc trace' command,
|
|
|
b7523e |
* named will try to write the 'named.run' file in the $directory (/var/named).
|
|
|
b7523e |
* By default, SELinux policy does not allow named to modify the /var/named directory,
|
|
|
b7523e |
* so put the default debug log file in data/ :
|
|
|
b7523e |
*/
|
|
|
b7523e |
channel default_debug {
|
|
|
b7523e |
file "data/named.run";
|
|
|
b7523e |
severity dynamic;
|
|
|
b7523e |
};
|
|
|
b7523e |
};
|
|
|
b7523e |
|
|
|
b7523e |
/*
|
|
|
b7523e |
Views let a name server answer a DNS query differently depending on who is asking.
|
|
|
b7523e |
|
|
|
b7523e |
By default, if named.conf contains no "view" clauses, all zones are in the
|
|
|
b7523e |
"default" view, which matches all clients.
|
|
|
b7523e |
|
|
|
b7523e |
Views are processed sequentially. The first match is used so the last view should
|
|
|
b7523e |
match "any" - it's fallback and the most restricted view.
|
|
|
b7523e |
|
|
|
b7523e |
If named.conf contains any "view" clause, then all zones MUST be in a view.
|
|
|
b7523e |
*/
|
|
|
b7523e |
|
|
|
b7523e |
view "localhost_resolver"
|
|
|
b7523e |
{
|
|
|
b7523e |
/* This view sets up named to be a localhost resolver ( caching only nameserver ).
|
|
|
b7523e |
* If all you want is a caching-only nameserver, then you need only define this view:
|
|
|
b7523e |
*/
|
|
|
b7523e |
match-clients { localhost; };
|
|
|
b7523e |
recursion yes;
|
|
|
b7523e |
|
|
|
b7523e |
# all views must contain the root hints zone:
|
|
|
b7523e |
zone "." IN {
|
|
|
b7523e |
type hint;
|
|
|
b7523e |
file "/var/named/named.ca";
|
|
|
b7523e |
};
|
|
|
b7523e |
|
|
|
b7523e |
/* these are zones that contain definitions for all the localhost
|
|
|
b7523e |
* names and addresses, as recommended in RFC1912 - these names should
|
|
|
b7523e |
* not leak to the other nameservers:
|
|
|
b7523e |
*/
|
|
|
b7523e |
include "/etc/named.rfc1912.zones";
|
|
|
b7523e |
};
|
|
|
b7523e |
view "internal"
|
|
|
b7523e |
{
|
|
|
b7523e |
/* This view will contain zones you want to serve only to "internal" clients
|
|
|
b7523e |
that connect via your directly attached LAN interfaces - "localnets" .
|
|
|
b7523e |
*/
|
|
|
b7523e |
match-clients { localnets; };
|
|
|
b7523e |
recursion yes;
|
|
|
b7523e |
|
|
|
b7523e |
zone "." IN {
|
|
|
b7523e |
type hint;
|
|
|
b7523e |
file "/var/named/named.ca";
|
|
|
b7523e |
};
|
|
|
b7523e |
|
|
|
b7523e |
/* these are zones that contain definitions for all the localhost
|
|
|
b7523e |
* names and addresses, as recommended in RFC1912 - these names should
|
|
|
b7523e |
* not leak to the other nameservers:
|
|
|
b7523e |
*/
|
|
|
b7523e |
include "/etc/named.rfc1912.zones";
|
|
|
b7523e |
|
|
|
b7523e |
// These are your "authoritative" internal zones, and would probably
|
|
|
b7523e |
// also be included in the "localhost_resolver" view above :
|
|
|
b7523e |
|
|
|
b7523e |
/*
|
|
|
b7523e |
NOTE for dynamic DNS zones and secondary zones:
|
|
|
b7523e |
|
|
|
b7523e |
DO NOT USE SAME FILES IN MULTIPLE VIEWS!
|
|
|
b7523e |
|
|
|
b7523e |
If you are using views and DDNS/secondary zones it is strongly
|
|
|
b7523e |
recommended to read FAQ on ISC site (www.isc.org), section
|
|
|
b7523e |
"Configuration and Setup Questions", questions
|
|
|
b7523e |
"How do I share a dynamic zone between multiple views?" and
|
|
|
b7523e |
"How can I make a server a slave for both an internal and an external
|
|
|
b7523e |
view at the same time?"
|
|
|
b7523e |
*/
|
|
|
b7523e |
|
|
|
b7523e |
zone "my.internal.zone" {
|
|
|
b7523e |
type master;
|
|
|
b7523e |
file "my.internal.zone.db";
|
|
|
b7523e |
};
|
|
|
b7523e |
zone "my.slave.internal.zone" {
|
|
|
b7523e |
type slave;
|
|
|
b7523e |
file "slaves/my.slave.internal.zone.db";
|
|
|
b7523e |
masters { /* put master nameserver IPs here */ 127.0.0.1; } ;
|
|
|
b7523e |
// put slave zones in the slaves/ directory so named can update them
|
|
|
b7523e |
};
|
|
|
b7523e |
zone "my.ddns.internal.zone" {
|
|
|
b7523e |
type master;
|
|
|
b7523e |
allow-update { key ddns_key; };
|
|
|
b7523e |
file "dynamic/my.ddns.internal.zone.db";
|
|
|
b7523e |
// put dynamically updateable zones in the slaves/ directory so named can update them
|
|
|
b7523e |
};
|
|
|
b7523e |
};
|
|
|
b7523e |
|
|
|
b7523e |
key ddns_key
|
|
|
b7523e |
{
|
|
|
b7523e |
algorithm hmac-sha256;
|
|
|
b7523e |
secret "use /usr/sbin/ddns-confgen to generate TSIG keys";
|
|
|
b7523e |
};
|
|
|
b7523e |
|
|
|
b7523e |
view "external"
|
|
|
b7523e |
{
|
|
|
b7523e |
/* This view will contain zones you want to serve only to "external" clients
|
|
|
b7523e |
* that have addresses that are not match any above view:
|
|
|
b7523e |
*/
|
|
|
b7523e |
match-clients { any; };
|
|
|
b7523e |
|
|
|
b7523e |
zone "." IN {
|
|
|
b7523e |
type hint;
|
|
|
b7523e |
file "/var/named/named.ca";
|
|
|
b7523e |
};
|
|
|
b7523e |
|
|
|
b7523e |
recursion no;
|
|
|
b7523e |
// you'd probably want to deny recursion to external clients, so you don't
|
|
|
b7523e |
// end up providing free DNS service to all takers
|
|
|
b7523e |
|
|
|
b7523e |
// These are your "authoritative" external zones, and would probably
|
|
|
b7523e |
// contain entries for just your web and mail servers:
|
|
|
b7523e |
|
|
|
b7523e |
zone "my.external.zone" {
|
|
|
b7523e |
type master;
|
|
|
b7523e |
file "my.external.zone.db";
|
|
|
b7523e |
};
|
|
|
b7523e |
};
|
|
|
b7523e |
|
|
|
b7523e |
/* Trusted keys
|
|
|
b7523e |
|
|
|
b7523e |
This statement contains DNSSEC keys. If you want DNSSEC aware resolver you
|
|
|
b7523e |
should configure at least one trusted key.
|
|
|
b7523e |
|
|
|
b7523e |
Note that no key written below is valid. Especially root key because root zone
|
|
|
b7523e |
is not signed yet.
|
|
|
b7523e |
*/
|
|
|
b7523e |
/*
|
|
|
b7523e |
trust-anchors {
|
|
|
b7523e |
// Root Key
|
|
|
b7523e |
. initial-key 257 3 8 "AwEAAaz/tAm8yTn4Mfeh5eyI96WSVexTBAvkMgJzkKTOiW1vkIbzxeF3
|
|
|
b7523e |
+/4RgWOq7HrxRixHlFlExOLAJr5emLvN7SWXgnLh4+B5xQlNVz8Og8kv
|
|
|
b7523e |
ArMtNROxVQuCaSnIDdD5LKyWbRd2n9WGe2R8PzgCmr3EgVLrjyBxWezF
|
|
|
b7523e |
0jLHwVN8efS3rCj/EWgvIWgb9tarpVUDK/b58Da+sqqls3eNbuv7pr+e
|
|
|
b7523e |
oZG+SrDK6nWeL3c6H5Apxz7LjVc1uTIdsIXxuOLYA4/ilBmSVIzuDWfd
|
|
|
b7523e |
RUfhHdY6+cn8HFRm+2hM8AnXGXws9555KrUB5qihylGa8subX2Nn6UwN
|
|
|
b7523e |
R1AkUTV74bU=";
|
|
|
b7523e |
|
|
|
b7523e |
// Key for forward zone
|
|
|
b7523e |
example.com. static-key 257 3 8 "AwEAAZ0aqu1rJ6orJynrRfNpPmayJZoAx9Ic2/Rl9VQW
|
|
|
b7523e |
LMHyjxxem3VUSoNUIFXERQbj0A9Ogp0zDM9YIccKLRd6
|
|
|
b7523e |
LmWiDCt7UJQxVdD+heb5Ec4qlqGmyX9MDabkvX2NvMws
|
|
|
b7523e |
UecbYBq8oXeTT9LRmCUt9KUt/WOi6DKECxoG/bWTykrX
|
|
|
b7523e |
yBR8elD+SQY43OAVjlWrVltHxgp4/rhBCvRbmdflunaP
|
|
|
b7523e |
Igu27eE2U4myDSLT8a4A0rB5uHG4PkOa9dIRs9y00M2m
|
|
|
b7523e |
Wf4lyPee7vi5few2dbayHXmieGcaAHrx76NGAABeY393
|
|
|
b7523e |
xjlmDNcUkF1gpNWUla4fWZbbaYQzA93mLdrng+M=";
|
|
|
b7523e |
|
|
|
b7523e |
|
|
|
b7523e |
// Key for reverse zone.
|
|
|
b7523e |
2.0.192.IN-ADDRPA.NET. initial-ds 31406 8 2 "F78CF3344F72137235098ECBBD08947C2C9001C7F6A085A17F518B5D8F6B916D";
|
|
|
b7523e |
};
|
|
|
b7523e |
*/
|