LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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-11-2013, 07:01 PM   #1
Altiris
Member
 
Registered: Mar 2013
Posts: 554

Rep: Reputation: Disabled
Exclamation Which DNS zone file is the best?


I have a couple of forward/reverse zone files for BIND9 that I have collected from tutorials. It seems that each of them seem to be able to resolve one thing but then lack to resolve another in all of them.

Out of the three which seem the best, feel free to revise them/combine them as I am in need of the best zone file as I am helping a company setup a DNS server on a Debian 7 linux box.

**PLEASE NOTE**
(I have replaced the actual domain name with "domain" to hide the domain)
(The hostname name is simply "hostname" to hide hostname)
(I have organized each of set of zone files into 3)

1. Forward Zone
Code:
$ORIGIN domain.com.
$TTL 86400
@	IN	SOA	dns1.domain.com. hostmaster.domain.com. (
	2013071101 ;serial
	21600 	   ;refresh after 6 hours
	3600	   ;retry after 1 hour
	604800     ;expire after1 week
	86400 )    ;minimum TTL 1 day

	IN	NS 	dns1.domain.com.
	
	IN	MX	10	mail.domain.com.

	IN	A	192.168.12.137

dns1	IN	A	192.168.12.137

hostname	IN	A	192.168.12.137

ftp	IN	A	192.168.12.137

mail	IN	CNAME	hostname

www	IN	CNAME	hostname
1. Reverse Zone
Code:
$ORIGIN 12.168.192.in-addr.apra.
$TTL 86400
@	INandre-server	SOA	dns1.domain.com. hostmaster.domain.com. (
	2013071101 ;serial
	21600	   ;refresh after 6 hours
	3600	   ;retry after 1 hour
	604800     ;expire after1 week
	86400 )    ;minimum TTL 1 day

@	IN	NS 	hostname.domain.com.
	
1	IN	PTR	hostname.domain.com.

2	IN	PTR	hostname.domain.com.

3	IN	PTR	hostname.domain.com.

4	IN	PTR	hostname.domain.com.
--------------------------------------------------

2. Forward Zone
Code:
$TTL 3D
@	IN	SOA	hostname.domain.com. admin.domain.com. (
2013071101;
28800;
3600;
604800;
38400;
);

dataglobe.com.	IN	NS	hostname.domain.com.
hostname	IN	A	192.168.12.137
www		IN	CNAME	hostname
2. Reverse Zone
Code:
$TTL 3D
@	IN	SOA	hostname.domain.com.. admin.hostname.com. (
2013071101;
28800;
604800;
604800;
86400;
);

	IN	NS	hostname.domain.com.
137	IN	PTR	hostname.domain.com.
1	IN	PTR	gw.domain.com.
-----------------------------------------------------

3. Forward Zone (PLEASE NOTE ON THIS ONE HOSTMASTER IS ACTUALLY HOSTMASTER, NOT TO BE CONFUSED WITH HOSTNAME)
Code:
;
; BIND data file for domain.com
;
$TTL 86400
@       IN      SOA     domain.com. hostmaster.domain.com. (
                        2013040601      ; Serial
                        21600           ; Refresh
                        600             ; Retry
                        604800          ; Expire
                        86400 )         ; Minimum TTL
                IN      A       192.168.12.137
;
@               IN      NS      dns1.domain.com.
        IN      MX      10      mail.domain.com.
dns1            IN      A       192.168.12.137
hostname        IN      A       192.168.12.137
ftp             IN      A       192.168.12.137
mail            IN      A       192.168.12.137
www             IN      A       192.168.12.137
3. Reverse Zone

Code:
;
; BIND reverse data file for local 192.168.12.137 net
;
$TTL 86400
@       IN      SOA     dns1.domain.com. hostmaster.domain.com. (
                        2013050601      ; Serial
                        21600           ; Refresh
                        3600            ; Retry
                        604800          ; Expire
                        86400 )         ; Minimum TTL
;
@       IN      NS      dns1.domain.com.
137     IN      PTR     dns1.domain.com.
2       IN      PTR     dom-ain.domain.com.
----------------------------------------------------
 
Old 07-11-2013, 07:29 PM   #2
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 2,404

Rep: Reputation: Disabled
There's a typo in the $ORIGIN statement in the first reverse zone ("in-addr.apra").

The indentation in the second forward zone and the second reverse zone is horrible, but otherwise they look OK.

Instead of just posting a bunch of zone files, could you perhaps tell us the exact nature of the problem? Which records are the server unable to resolve?
 
Old 07-11-2013, 08:56 PM   #3
Altiris
Member
 
Registered: Mar 2013
Posts: 554

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Ser Olmy View Post
There's a typo in the $ORIGIN statement in the first reverse zone ("in-addr.apra").

The indentation in the second forward zone and the second reverse zone is horrible, but otherwise they look OK.

Instead of just posting a bunch of zone files, could you perhaps tell us the exact nature of the problem? Which records are the server unable to resolve?
Yes #1 is horrible. Thanks for the typ-o fix I did not notice that. Here are some problems I get with each zone file

1. Forward/Reverse
nslookup hostname - Resolves
nslookup domainname - DOESNT Resolve (weird)
nslookup hostname.domain - Resolves
nslookup www domainname.com - Resolves (weird)
nslookup www.yahoo.com - Resolves
(Extra below)
nslookup www. domainname.com - Resolves
nslookup mail.domainname.com - Resolves
nslookup ftp.domainname.com - Resolves
nslookup dns1.domainname.com - Resolves
nslookup www.yahoo.com - Resolves

2. Forward/Reverse
nslookup hostname - Resolves
nslookup domainanme - Resolves
nslookup hostname.domainname - Resolves


3. Forward/Reverse
nslookup hostname - Resolves
nslookup domainanme - Resolves
nslookup hostname.domainname - Resolves
(Extra below)
nslookup www. domainname.com - Resolves
nslookup mail.domainname.com - Resolves
nslookup ftp.domainname.com - Resolves
nslookup dns1.domainname.com - Resolves
nslookup www.yahoo.com - Resolves

Seems like 2 and 3 work fine and 1 is the crappy one. Does anyone else know of any other things I should add to these zones? I think I will stick with the first one for now. Thanks for your help, I didnt think of doing this.


EDIT: I am noticing that when I try and ping the domain on one of the other computers it cant ping the domain. I can ping the hostname but not the domainname, why is this? I think I need to add some type of A record for my external IP, what would that look like?

Would it be something like "dns1 IN A x.x.x.x" (the x's are my external IP)

Last edited by Altiris; 07-15-2013 at 11:49 AM.
 
Old 07-13-2013, 06:04 AM   #4
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,604

Rep: Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241
For #1, there is no definition given for the domain name, so how could it return a definition? And why is www.domainname lookup wierd - you did give it a definition.

In the reverse, you give different IP numbers than used in the forward lookup... (reverse)192.168.0.1, .2, .3, .4 and in the forward everything is 192.168.12.137

In #2, you have what might be a typo... "hostname.domain.com..", and you have a reverse reference to 192.168.12.2, but without a forward reference.

In #3, looks fine, though again there is a reverse reference to 192.168.12.2 without a forward reference.
 
Old 07-13-2013, 01:33 PM   #5
Altiris
Member
 
Registered: Mar 2013
Posts: 554

Original Poster
Rep: Reputation: Disabled
Alright I will answer all of your questions/feedback in order, thanks btw. (I am thinking of dropping #2 as it seems the weirdest one for me. For #1 like you said it DOES NOT have anythig for the domain. To do so in the forward zone, would I just add:

"domain.com. IN NS hostname.domainname.com."

And then for the reverse zone would I type:

" IN NS hostname.domainname.com."

As for the other responsive you said I gave the wrong IPs, would I replace 1,2,3,4 with 137? And how do I make it so its 12.137 and not 0.137 or somethig, I am a bit confused.
It is a typo, extra dot, and do I change 2 to 137? However I will probably not use 2.

As for the reverse with 2, once again, change that to 137? And then to add a forward record, what do I add?

Thanks for the help!
 
Old 07-14-2013, 08:15 AM   #6
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,604

Rep: Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241
Yes the "IN NS" would be valid. But you still would need an A record for the hostname.

Normally all forward records are <name> IN A <IP number> - which why the domain can't be identified - no A record.


For reverse lookups, it is the zone definition (in the named.conf file) that defines how the IP numbers are used.

A "zone "12.168.192.ipv4.arpa" IN {....} would set the the IP base to 192.168.12.x, then within the file, only the last octet is needed.
 
  


Reply

Tags
bind9, dns, zones


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
Which zone bind dns work either in forward zone are reverse zone sanjay87 Linux - Server 2 06-05-2012 05:21 AM
"Ignoring out-of-zone data" errors with my DNS Zone file zyzzogeton Linux - Networking 2 12-17-2009 09:51 AM
Dns Problem Loading The Zone File Error(zone File Not Found) ramineni Linux - Newbie 1 09-14-2008 09:36 AM
DNS Zone file help mnm_mc Linux - Networking 2 05-22-2007 10:19 AM
Need help with DNS zone file please:-) TippyToes Linux - Networking 5 04-28-2004 06:32 PM


All times are GMT -5. The time now is 08:40 AM.

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