Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 07-29-2011, 01:11 PM   #1
Registered: Mar 2010
Posts: 58

Rep: Reputation: 5
Talking [Not Serious] "Combining" DNS zones?

First off, I'm asking mostly out of laziness. I fully anticipate reactions along the lines of "Not only no, but H*ll No!"

For background and context, I'm actually doing infrastructure for a small set of dev and test subdomains and subnets. I ~absolutely~ would not be doing this for a production network!

But, this being dev and test, projects come and go, hosts get swapped around, different PMs want different naming conventions, and I'm lazy enough to wonder if I can keep my subdomains in a single zone file. Something like this:

$TTL    1d
$ORIGIN dom.ain.
@   IN  SOA ns.dom.ain. root.ns.dom.ain. (
                                      201107291  ; Serial yyyymmddn
                                      3600       ; Refresh 1h
                                      1800       ; Retry   30m
                                      86400      ; Expire  1d
                                      1800 )     ; Minimum 30m
host1.sub1      IN      A       123.456.1.1
host2.sub1      IN      A       123.456.1.2
host1.sub2      IN      A       123.456.1.11
host2.sub2      IN      A       123.456.1.12
host3.sub2      IN      A       123.456.2.11
host4.sub2      IN      A       123.456.2.12
For the ~really~ odd idea, how about doing something similar with subnets? Given 123.456.1.0 and 123.456.2.0 are right next to each other, a 23-bit netmask makes them the same subnet. How might I do ~that~ in a single zone file?

$TTL    86400
@   IN  SOA ns.dom.ain. root.ns.dom.ain. (
                                      201107291  ; Serial yyyymmddn
                                      3600       ; Refresh 1h
                                      1800       ; Retry   30m
                                      86400      ; Expire  1d
                                      1800 )     ; Minimum 30m
1.1     IN      PTR     host1.sub1
1.1     IN      PTR     host2.sub1
1.11    IN      PTR     host1.sub2
1.12    IN      PTR     host2.sub2
2.11    IN      PTR     host3.sub2
2.12    IN      PTR     host4.sub2
I have my doubts about the forward zone file. If this reverse zone file actually worked, I'd fall over.

Sadly, my job is not to play, but to provide the playground for the other girls and boys. How about you all? Anyone tried it? ;D


PS. On further thought: I wouldn't actually do this because it would confuse the daylights out of whoever had to take over for me if I got hit by a bus. Still fun to wonder about, though...

Last edited by dafydd2277; 07-29-2011 at 01:12 PM.
Old 07-29-2011, 01:52 PM   #2
LQ Guru
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 6,986
Blog Entries: 14

Rep: Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187Reputation: 1187
Actually we do something similar for many of our domains in Production.

We create a zone file for aliases e.g. something like:

Contents would be something like:
@               IN SOA (
                        2010020501      ; serial
                        10800           ; refresh
                        3600            ; retry
                        604800          ; expire
                        86400 )         ; Minimun TTL
; Name Servers
                IN NS
                IN NS
; Mail Servers
                IN MX   10  ; Primary MX
                IN MX   30  ; Primary MX
; Addresses
localhost       IN A
@               IN A
www             IN A
ftp             IN A
mail            IN A
Then for domains in named.conf we might have somthing like:

zone "" {
        type master;
        file "mainzone-aliases";
        allow-query { any; };

zone "" {
        type master;
        file "mainzone-aliases";
        allow-query { any; };
The dig for would return the IP shown by the "@" in the aliases file. A dig for would show the IP shown by the www entry in the aliases file. A dig for would show the same IP as that found for A dig for would show the same IP as that shown for Of course I used the same IP for the domain with and without www so all 4 digs would return the same IP but one doesn't have to do this. A dig for and would return the same IP for both but it would be different than the www IP.

We actually have hundreds of zones aliased this way.

Also you'll note I use the same name servers and mail servers in the aliases file since we only have name server and mail server in our primary domain (described in a separate zone file). You could make those references relative as well I believe if you had access to each of those other domains to the IPs of the DNS and mail servers - we didn't see a need to do that here.
1 members found this post helpful.



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
Gnome project: resize windows to fit screen "zones"? neocookie Linux - Software 1 02-22-2011 11:26 AM
/zones/ vi "/etc/hosts" [Read only] routers Solaris / OpenSolaris 4 07-04-2009 04:47 AM
"yum update" killed my DNS zones on VMware Server 1.0.3 girarde Linux - Server 4 04-20-2009 10:22 PM
"Failed to set up write combining range" error when running startx jbryanj Linux - Software 1 10-24-2005 05:23 PM
xfree86 logs - "Failed to set up write-combining range" jbryanj Linux - Newbie 0 04-30-2004 04:57 PM > Forums > Linux Forums > Linux - Server

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

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