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