jvdias bc59c3
//
jvdias bc59c3
// Sample named.conf BIND DNS server 'named' configuration file
jvdias bc59c3
// for the Red Hat BIND distribution.
jvdias bc59c3
//
jvdias bc59c3
// See the BIND Administrator's Reference Manual (ARM) for details, in:
jvdias bc59c3
//   file:///usr/share/doc/bind-*/arm/Bv9ARM.html
jvdias bc59c3
// Also see the BIND Configuration GUI : /usr/bin/system-config-bind and 
jvdias bc59c3
// its manual.
jvdias bc59c3
//
jvdias bc59c3
options
jvdias bc59c3
{
jvdias bc59c3
	/* make named use port 53 for the source of all queries, to allow
jvdias bc59c3
         * firewalls to block all ports except 53:
jvdias bc59c3
         */
jvdias bc59c3
	query-source    port 53;	
jvdias bc59c3
	query-source-v6 port 53;
jvdias bc59c3
	
jvdias bc59c3
	// Put files that named is allowed to write in the data/ directory:
jvdias bc59c3
	directory "/var/named"; // the default
jvdias bc59c3
	dump-file 		"data/cache_dump.db";
jvdias bc59c3
        statistics-file 	"data/named_stats.txt";
jvdias bc59c3
        memstatistics-file 	"data/named_mem_stats.txt";
jvdias bc59c3
jvdias bc59c3
};
jvdias bc59c3
logging 
jvdias bc59c3
{
jvdias bc59c3
/*      If you want to enable debugging, eg. using the 'rndc trace' command,
jvdias bc59c3
 *      named will try to write the 'named.run' file in the $directory (/var/named).
jvdias bc59c3
 *      By default, SELinux policy does not allow named to modify the /var/named directory,
jvdias bc59c3
 *      so put the default debug log file in data/ :
jvdias bc59c3
 */
jvdias bc59c3
        channel default_debug {
jvdias bc59c3
                file "data/named.run";
jvdias bc59c3
                severity dynamic;
jvdias bc59c3
        };	
jvdias bc59c3
};
jvdias bc59c3
//
jvdias bc59c3
// All BIND 9 zones are in a "view", which allow different zones to be served
jvdias bc59c3
// to different types of client addresses, and for options to be set for groups
jvdias bc59c3
// of zones.
jvdias bc59c3
//
jvdias bc59c3
// By default, if named.conf contains no "view" clauses, all zones are in the 
jvdias bc59c3
// "default" view, which matches all clients.
jvdias bc59c3
// 
jvdias bc59c3
// If named.conf contains any "view" clause, then all zones MUST be in a view; 
jvdias bc59c3
// so it is recommended to start off using views to avoid having to restructure
jvdias bc59c3
// your configuration files in the future.
jvdias bc59c3
//
jvdias bc59c3
view "localhost_resolver"
jvdias bc59c3
{
jvdias bc59c3
/* This view sets up named to be a localhost resolver ( caching only nameserver ).
jvdias bc59c3
 * If all you want is a caching-only nameserver, then you need only define this view:
jvdias bc59c3
 */
jvdias bc59c3
	match-clients 		{ localhost; };
jvdias bc59c3
	match-destinations	{ localhost; };
jvdias bc59c3
	recursion yes;
jvdias bc59c3
	# all views must contain the root hints zone:
jvdias bc59c3
	include "/etc/named.root.hints";
jvdias bc59c3
jvdias bc59c3
        /* these are zones that contain definitions for all the localhost
jvdias bc59c3
         * names and addresses, as recommended in RFC1912 - these names should
jvdias bc59c3
	 * ONLY be served to localhost clients:
jvdias bc59c3
	 */
jvdias bc59c3
	include "/etc/named.rfc1912.zones";
jvdias bc59c3
};
jvdias bc59c3
view "internal"
jvdias bc59c3
{
jvdias bc59c3
/* This view will contain zones you want to serve only to "internal" clients
jvdias bc59c3
   that connect via your directly attached LAN interfaces - "localnets" .
jvdias bc59c3
 */
jvdias 2746f3
	match-clients		{ localnets; };
jvdias 2746f3
	match-destinations	{ localnets; };
jvdias bc59c3
	recursion yes;
jvdias bc59c3
	// all views must contain the root hints zone:
jvdias bc59c3
	include "/etc/named.root.hints";
jvdias bc59c3
jvdias bc59c3
        // include "named.rfc1912.zones";
jvdias bc59c3
	// you should not serve your rfc1912 names to non-localhost clients.
jvdias bc59c3
 
jvdias bc59c3
	// These are your "authoritative" internal zones, and would probably
jvdias bc59c3
	// also be included in the "localhost_resolver" view above :
jvdias bc59c3
jvdias bc59c3
	zone "my.internal.zone" { 
jvdias bc59c3
		type master;
jvdias bc59c3
		file "my.internal.zone.db";
jvdias bc59c3
	};
jvdias bc59c3
	zone "my.slave.internal.zone" {
jvdias bc59c3
		type slave;
jvdias bc59c3
		file "slaves/my.slave.internal.zone.db";
jvdias bc59c3
		masters { /* put master nameserver IPs here */ 127.0.0.1; } ;
jvdias bc59c3
		// put slave zones in the slaves/ directory so named can update them
jvdias bc59c3
	};	
jvdias bc59c3
	zone "my.ddns.internal.zone" {
jvdias bc59c3
		type master;
jvdias bc59c3
		allow-update { key ddns_key; };
jvdias bc59c3
		file "slaves/my.ddns.internal.zone.db";
jvdias bc59c3
		// put dynamically updateable zones in the slaves/ directory so named can update them
jvdias bc59c3
	};			
jvdias bc59c3
};
jvdias bc59c3
key ddns_key
jvdias bc59c3
{
jvdias bc59c3
	algorithm hmac-md5;
jvdias bc59c3
	secret "use /usr/sbin/dns-keygen to generate TSIG keys";
jvdias bc59c3
};
jvdias bc59c3
view    "external"
jvdias bc59c3
{
jvdias bc59c3
/* This view will contain zones you want to serve only to "external" clients
jvdias bc59c3
 * that have addresses that are not on your directly attached LAN interface subnets:
jvdias bc59c3
 */
jvdias bc59c3
	match-clients		{ !localnets; !localhost; };
jvdias bc59c3
	match-destinations	{ !localnets; !localhost; };
jvdias bc59c3
jvdias bc59c3
	recursion no;
jvdias bc59c3
	// you'd probably want to deny recursion to external clients, so you don't
jvdias bc59c3
        // end up providing free DNS service to all takers
jvdias bc59c3
jvdias bc59c3
	// all views must contain the root hints zone:
jvdias bc59c3
	include "/etc/named.root.hints";
jvdias bc59c3
jvdias bc59c3
	// These are your "authoritative" external zones, and would probably
jvdias bc59c3
        // contain entries for just your web and mail servers:
jvdias bc59c3
jvdias bc59c3
	zone "my.external.zone" { 
jvdias bc59c3
		type master;
jvdias bc59c3
		file "my.external.zone.db";
jvdias bc59c3
	};
jvdias bc59c3
};