Link to home
Start Free TrialLog in
Avatar of Westez
Westez

asked on

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

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.

Avatar of ifreq
ifreq
Flag of Finland image

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.

Avatar of David Beveridge
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.

ASKER CERTIFIED SOLUTION
Avatar of David Beveridge
David Beveridge
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Westez
Westez

ASKER

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.







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


Avatar of Westez

ASKER

How do you configure IIS and Apache to accept both names?  

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.

Avatar of Westez

ASKER

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.