Solved

DNS - How to  use CNAMES to redirect from  domain.org to domain.net?

Posted on 2008-10-20
9
1,295 Views
Last Modified: 2013-12-23
Using Bind 8.1.2 on Solaris.  I want example.net to resolve to example.org.  I have a stanza for both domains in named.conf.  Below are my sample zone files.
1. Are my zone files setup correctly?
If not.
2. What zone file should the cname record be in, example.net or example.org or both?  I have it in example.net.
3. What else do I need to add to which respective zone file to make example.net resolve to example.org?
4. Is there a link that has examples of zone files that explains how to resolve from one domain to another?  
5. Is the setup different in Bind 9.4.2? Use  DNAME instead of CNAME? If so, example please.

; NAMED Configuration for example.org Domain
;
example.org.      IN      SOA       gk.example.org postmaster.example.org. (
                              22      ;serial
                              3600      ; refresh
                              300      ; retry
                              604800      ; expire
                              3600  )      ; minimum
;
;name servers
;
                  IN      NS      gk.example.org.
                  
;

                  IN      A      63.78.97.78
;
                  
$ORIGIN      example.org.
;
www                  IN      A      63.78.97.78  

==================================================================================

; NAMED Configuration for www.example.net Domain
;
example.net.      IN      SOA       gk.example.org. postmaster.example.org. (
                              34            ;serial
                              3600        ; refresh
                              300            ; retry
                              604800      ; expire
                              3600  )      ; minimum
;
;name servers
;
                  IN      NS      gk.example.org.
                  
;
;
                  IN      A      63.78.97.78
$ORIGIN      example.net.
;
;               Aliases
www.example.net.       IN      CNAME      www.example.org.

0
Comment
Question by:Westez
  • 3
  • 3
  • 3
9 Comments
 
LVL 5

Expert Comment

by:ifreq
ID: 22762705
Greetings,

Your zone-files are almost right. Change this:

$ORIGIN      example.net.
;
;               Aliases
www.example.net.       IN      CNAME      www.example.org.

To this:

$ORIGIN      example.net.
;
;               Aliases
www                              IN      CNAME      www.example.org.

Also remember to configure your www.example.org (www-server to accept traffic from www.example.net-domain). On Apache they are called as VirtualHosts.

0
 
LVL 19

Expert Comment

by:bevhost
ID: 22764443
ifreq:  I don't see how that will make any difference

I would recommend against CNAMEs unless the IP Address changes often.
You might as well use A records instead.
CONS:
It just means that you have to update all the A records if the IP changes.
PROS:
Resolvers don't need to do two lookups to get the answer.

0
 
LVL 19

Accepted Solution

by:
bevhost earned 250 total points
ID: 22764447
I believe that your zone files need no changes.  BUT as ifreq says you may need to configure the web server to accept both names.
0
 
LVL 5

Assisted Solution

by:ifreq
ifreq earned 250 total points
ID: 22765065
bevhost, I didnt say that changing zonefile would make any change. But It would be configured same way
as the 1st domain. Its just for the looks. :-)
0
New My Cloud Pro Series - organize everything!

With space to keep virtually everything, the My Cloud Pro Series offers your team the network storage to edit, save and share production files from anywhere with an internet connection. Compatible with both Mac and PC, you're able to protect your content regardless of OS.

 

Author Comment

by:Westez
ID: 22767560
All - Clarify this  point for me.
You can create an A record using the same ip address in the two different zone files rather than using the CNAME record in one of the zone files and get the same results?

Configure the web server to accept both names?  We use IIS, wouldn't you set this up by using the host headers method?

We host the primary name server in house, gk.example.org.  An outside vendor hosts the secondary's.
We're authoritive for 30 domains.  When I take the primary of out of play by stopping named on it. I have 6 domains that name resolution fails on, otherwise they all work with named running on the primary.  All of them have the CNAME record line, hence my questions on whether I have my zone fles set up correctly.  
Now I'm wondering if the problem is not on the secondary's.  Like maybe they don't have a stanza in the named.conf file for example.net.







0
 
LVL 19

Expert Comment

by:bevhost
ID: 22772267
You get a better result by using two A records because for each domain only one lookup is required.
A CNAME tells the resolver to lookup the answer in a new location, therefore requiring two lookups.

The Host Headers option is required when the two (different) websites share the same IP address.  If the same web site has two names then host headers are not needed and both can reside in the default web site, in which case the names don't need to be configured on the web server.

I'm not sure about stanza's, but I did find this
http://docs.hp.com/en/B2355-90137/ch05s06.html


0
 

Author Comment

by:Westez
ID: 22780022
How do you configure IIS and Apache to accept both names?  

0
 
LVL 5

Expert Comment

by:ifreq
ID: 22780835
On Apache you make two separate Virtual Hosts entries, like this:

<VirtualHost *:80>
 DocumentRoot /var/www/html
 ServerName www.example.net
</VirtualHost>

<VirtualHost *:80>
 DocumentRoot /var/www/html
 ServerName www.example.org
</VirtualHost>

Notice both pointing to same directory.

0
 

Author Comment

by:Westez
ID: 22798232
I don't know much about Apache.  Is this a requirement for Apache to accept answers for both domain names.  I thought that once the private dns server resolved the name to an ip address it would just send the packet on to it's destination.  Once it arrived the web server would process it.  I'm using IIS, and I don't use host headers so I have an ip address for each site and at the firewall it's static nat.  So it's a one public to one private ip address relationship.  There's always more than one way to do these things, but this is the way I've been taught.  Hence my question on Apache, I'm always interested in learning new ways to do things and how others out there are doing them.
0

Featured Post

Scale it in WD Gold

With up to ten times the workload capacity of desktop drives, WD Gold hard drives employ advanced technology to deliver among the best in reliability, capacity, power efficiency and performance.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
In this article, I am going to show you how to simulate a multi-site Lab environment on a single Hyper-V host. I use this method successfully in my own lab to simulate three fully routed global AD Sites on a Windows 10 Hyper-V host.
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now