Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I created a simple static web site and have two separately registered domains a.com and b.net. I want a.com to be the primary domain name and all requests coming in to b.net to be routed to a.com. How do I configure my DNS server to do this? I was assuming all I needed was a CNAME record as below, but this is not working. Here's how I setup my DNS zone file. (Note: all requests to a.com work fine)

; a.com [154997]
$TTL 86400 
@   IN  SOA ds1.dnsserver.com. fname.lname.mail.com. (
@       NS  ds1.dnsserver.com. 
@       NS  ds2.dnsserver.com.
@       NS  ds3.dnsserver.com. 
@       NS  ds4.dnsserver.com.
@       NS  ds5.dnsserver.com.
@           MX  10  mail.a.com.
@           A
mail        A
www         A
b.net       CNAME   a.com.
www.b.net           CNAME   a.com.
share|improve this question
Quick question, what does your DNS zone b.net look like? –  KJ-SRS Feb 2 '11 at 16:47

3 Answers 3

You have to put the CNAME entries in a zonefile for the b.net domain. How should DNS now it has to look into a.com when it looks for b.net?

share|improve this answer

Your understanding of CNAME records is backwards. For the hostname "b.net" to alias to the hostname "a.com" you would need to put the CNAME record into the "b.net" zone, not the "a.com" zone.

A silly analogy would be physical mail forwarding with the postal service. You file a request to forward mail from your old post office to the new address (the CNAME record in the b.net zone), because the mail is going to come to the old post office. Filing a forward request at the new post office (putting the cname into the "a.com" zone) isn't going to help because your old mail isn't coming to the new post office to begin with.

share|improve this answer
+1. Clear answer and explanation. –  Carlos Feb 2 '11 at 17:12

Assuming you can ping your server using b.net (if not - see SvenW answer) that should work without any problems as long as you have your web server configured properly to handle your second domain too (b.net). This way you can have two domains serving the same content independently.

If you want b.net to be really redirected (so that the location bar shows a.com), you should probably do it on the webserver level.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.