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