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