LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-17-2011, 09:12 AM   #1
iluvAS
LQ Newbie
 
Registered: Jul 2011
Posts: 2

Rep: Reputation: Disabled
Smile Setting up DNS in RHEL5 (newbie)


Hi there, I've been googling for solutions but I couldn't find much that explains how named.conf and zone files work. Anyways for my school project using RHEL5 I am suppose to set up the following:
  • a DNS master server for the domain p0920948.com
  • I will be using bind-chroot
  • I have two machines one server (172.16.112.39/24) and another client (172.16.112.40/24)
  • Client has to be able to ping server by p0920948S1.p0920948.com
  • This part im not sure what it means by "dig" but its in the instructions: dig p0920948S1.p0920948.com
  • Client able to ping server by aliased www.p0920948.com
  • client able to ping itself by p0920948C1.p0920948.com

So what I've done so far is
  1. install bind and chroot
  2. write the command chkconfig named on to start it on boot
  3. Copied some files from /usr/share/doc/bind-*/sample into chroot
  4. Modified resolve.config adding in "nameserver 127.0.0.1" for localhost
  5. Add in "listen-on port 53 {127.0.0.1; 172.16.112.39; 172.16.112.40};" under the options bracket in named.conf
  6. declared an acl "safe-subnet" {172.16.112.0/24}; and added it into the match-clients and match-destinations for internal
  7. And within internal i added in a zone file refrence
  8. I modified named.root.hints to add in a zone reference as well
  9. Created the zone file

NAMED.CONF FILE
Code:
//
// Sample named.conf BIND DNS server 'named' configuration file
// for the Red Hat BIND distribution.
//
// See the BIND Administrator's Reference Manual (ARM) for details, in:
//   file:///usr/share/doc/bind-*/arm/Bv9ARM.html
// Also see the BIND Configuration GUI : /usr/bin/system-config-bind and 
// its manual.
//
options
{
	listen-on port 53 { 127.0.0.1; 172.16.112.39; 172.16.112.40; };
        // Those options should be used carefully because they disable port
        // randomization
	// query-source    port 53;	
	// query-source-v6 port 53;
	
	// Put files that named is allowed to write in the data/ directory:
	directory "/var/named"; // the default
	dump-file 		"data/cache_dump.db";
        statistics-file 	"data/named_stats.txt";
        memstatistics-file 	"data/named_mem_stats.txt";

};
logging 
{
/*      If you want to enable debugging, eg. using the 'rndc trace' command,
 *      named will try to write the 'named.run' file in the $directory (/var/named).
 *      By default, SELinux policy does not allow named to modify the /var/named directory,
 *      so put the default debug log file in data/ :
 */
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };	
};
//
// All BIND 9 zones are in a "view", which allow different zones to be served
// to different types of client addresses, and for options to be set for groups
// of zones.
//
// By default, if named.conf contains no "view" clauses, all zones are in the 
// "default" view, which matches all clients.
// 
// If named.conf contains any "view" clause, then all zones MUST be in a view; 
// so it is recommended to start off using views to avoid having to restructure
// your configuration files in the future.
//
view "localhost_resolver"
{
/* This view sets up named to be a localhost resolver ( caching only nameserver ).
 * If all you want is a caching-only nameserver, then you need only define this view:
 */
	match-clients 		{ localhost; };
	match-destinations	{ localhost; };
	recursion yes;
	# all views must contain the root hints zone:
	include "/etc/named.root.hints";

        /* these are zones that contain definitions for all the localhost
         * names and addresses, as recommended in RFC1912 - these names should
	 * ONLY be served to localhost clients:
	 */
	include "/etc/named.rfc1912.zones";
};

acl "safe-subnet" { 172.16.112.0/24; };

view "internal"
{
/* This view will contain zones you want to serve only to "internal" clients
   that connect via your directly attached LAN interfaces - "localnets" .
 */
	match-clients		{ localnets; localhost; safe-subnet; };
	match-destinations	{ localnets; localhost; safe-subnet; };
	recursion yes;
	// all views must contain the root hints zone:
	include "/etc/named.root.hints";

        // include "named.rfc1912.zones";
	// you should not serve your rfc1912 names to non-localhost clients.
 
	// These are your "authoritative" internal zones, and would probably
	// also be included in the "localhost_resolver" view above :

	zone "p0920948.com" {
		type master;
		notify no;
		allow-query { any; };
		file "var/named/zones/internal/p0920948.zone";
	};
		
	zone "my.internal.zone" { 
		type master;
		file "my.internal.zone.db";
	};
	zone "my.slave.internal.zone" {
		type slave;
		file "slaves/my.slave.internal.zone.db";
		masters { /* put master nameserver IPs here */ 127.0.0.1; } ;
		// put slave zones in the slaves/ directory so named can update them
	};	
	zone "my.ddns.internal.zone" {
		type master;
		allow-update { key ddns_key; };
		file "slaves/my.ddns.internal.zone.db";
		// put dynamically updateable zones in the slaves/ directory so named can update them
	};			
};
key ddns_key
{
	algorithm hmac-md5;
	secret "use /usr/sbin/dns-keygen to generate TSIG keys";
};
view    "external"
{
/* This view will contain zones you want to serve only to "external" clients
 * that have addresses that are not on your directly attached LAN interface subnets:
 */
	match-clients		{ any; };
	match-destinations	{ any; };

	recursion no;
	// you'd probably want to deny recursion to external clients, so you don't
        // end up providing free DNS service to all takers

	allow-query-cache { none; };
	// Disable lookups for any cached data and root hints

	// all views must contain the root hints zone:
	include "/etc/named.root.hints";

	// These are your "authoritative" external zones, and would probably
        // contain entries for just your web and mail servers:

	zone "my.external.zone" { 
		type master;
		file "my.external.zone.db";
	};
};
NAMED ROOT HINTS
Code:
//
//   The 'named.root' root cache hints zone for the bind DNS 'named' nameserver.
//
//   named's cache must be primed with the addresses of the root zone '.' nameservers. 
//   The root zone file can be obtained by querying the root 'A' nameserver:
//     $ dig . ns @198.41.0.4 > named.root
//   Or by download via FTP / HTTP:
//     $ wget ftp://ftp.rs.internic.net/domain/named.root 
//   
//   Every view that is to provide recursive service must include this zone.
//
zone "." IN {
	type hint;
	file "named.root";
};

zone "p09209498.com" IN {
   type master;
   file "/var/named/zones/internal/p0920948.zone";
   allow-update { none; };
};

zone file "p0920948.zone"
Code:
;
; Zone file for p0920948.com
;
; The full zone file
;
$TTL 3D
@       IN      SOA    www.p0920948.com. hostmaster.p0920948.com. (
                       200211152       ; serial#
                       3600            ; refresh, seconds
                       3600            ; retry, seconds
                       3600            ; expire, seconds
                       3600 )          ; minimum, seconds

                          NS      www             ; Inet Address of nameserver
p0920948S1.p0920948.com.  A      10 p0920948S1   ; Server
p0920948C1.p0920948.com.  A      10 p0920948C1	 ; Client

p0920948S1      A       172.16.112.39
p0290948C1	A	172.16.112.40
www             CNAME   p0920948S1
INTERNAL_ZONES.CONF
Code:
zone "p09209498.com" IN {
   type master;
   file "/var/named/zones/internal/p0920948.zone";
   allow-update { none; };
};
After all that when i execute the /etc/init.d/named restart command, i got bombarded with errors and I tried debugging line by line and gave up when i realize its due to my lack of the concept on how zone files work and me copying chunks of code i find online thats causing the errors. So it would be great if anyone can help explain the concept or point out some of the mistakes i make.

Thanks for reading my epicly long post, any help will be greatly appreciated.

Last edited by iluvAS; 07-17-2011 at 09:21 AM. Reason: typo
 
Old 07-17-2011, 10:53 AM   #2
iluvAS
LQ Newbie
 
Registered: Jul 2011
Posts: 2

Original Poster
Rep: Reputation: Disabled
I found out i had some typo errors such as typing in p09209498 instead of p0920948, i fixed that and i got the error

/etc/named.conf:86: zone 'p0920948.com' :already exists previous definition /etc/named.root.hints:17

So i decided to remove the zone declaration of p0920948 inside named.conf, i finally get no errors but when it displays Starting named: it shows [FAILED]

any ideas what could be wrong?
 
Old 07-17-2011, 11:48 AM   #3
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,605

Rep: Reputation: 1532Reputation: 1532Reputation: 1532Reputation: 1532Reputation: 1532Reputation: 1532Reputation: 1532Reputation: 1532Reputation: 1532Reputation: 1532Reputation: 1532
You can check logs in /var/log/messages and/or /var/log/syslog
You can also run:
Code:
named-checkconf -z -t /var/named/chroot
to check the configuration, assuming you run bind chrooted under /var/named/chroot.
 
Old 07-17-2011, 06:57 PM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,260

Rep: Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328
As you're on RHEL 5, I recommend this manual http://www.linuxtopia.org/online_boo...ion/index.html
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
internal and external DNS configuration in RHEL5.3 or RHEL5.4 edu kiai Red Hat 4 05-04-2011 09:34 PM
DNS in RHEL5 unix.fresher Linux - Server 4 03-30-2010 07:43 AM
how to configure master dns in windows2003 server and its slave dns in rhel5 suneellinux Linux - Newbie 1 04-11-2008 06:13 PM
newbie setting up dns with fedora 3 delphipgmr Linux - Newbie 4 11-10-2004 01:23 PM
newbie setting up DNS host statmobile Linux - Networking 3 05-19-2004 10:10 PM


All times are GMT -5. The time now is 02:16 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration