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

Good morning -

I'm a product manager type building an application for the first time. I've taught myself the ruby and rails pieces, but I'm a little gunshy about the sysadmin stuff. I apologize in advance if this is a trivial question.

My domain.com is registered at Dreamhost. My email goes through Dreamhost, and the domain.com currently redirects to blog.domain.com, which is hosted at Dreamhost.

I've been building out the application at Slicehost (it has a couple of application servers, in addition to the web server). I've been hitting the site directly at the IP address as I've been building it.

So now, I want to tell Dreamhost that domain.com should point to the Slicehost machines, but I still want to have Dreamhost managing the domain.com email traffic.

I looked at CNAME, but this looks like it would redirect the mail, too. I'm a little lost, and I have the creeping terrors that bad things will happen if I mess this up.

Thanks for any direction you can provide,

Jason

share|improve this question

4 Answers 4

up vote 9 down vote accepted

The answer to your question will depend on the URLs you want your users to use.

If you want users to access your application via http://app.domain.com/ or http://www.domain.com/ you can either use an A record to point app or www to the IP address of the application server, or add a CNAME record to point to the real name of the app server.

server01.domain.com.     A       192.0.2.1
; Either
app.domain.com.          CNAME   server01.domain.com.
; OR
app.domain.com.          A       192.0.2.1

If you want http://domain.com/ to point to your application things are trickier. The correct answer it to point the A record for domain.com to the IP of your application server. A CNAME might seem tempting; however when you use a CNAME to specify the canonical name for a host you are not allowed to have any other resource records for that host. Your zone will need to have at least SOA and NS records as well as MX records to function properly so a CNAME will not work.

domain.com.    SOA ( ns0.domain.com. hostmaster.domain.com. 
                     2009061501 86400 7200 3600000 3600 )
@              NS  ns0.domain.com.
@              NS  ns1.domain.com.
@              MX 5 mail.domain.com.
@              MX 10 relay.domain.com.
; This is invalid:
@              CNAME    server01.domain.com.
; This is valid:
@              A   192.0.2.1

For information on common DNS mistakes, including CNAME limitations, see RFC1912.

share|improve this answer
    
+1 for citing the RFC! –  Josh Brower Jun 15 '09 at 13:43
    
Thanks. Very helpful! –  Jason Butler Jun 15 '09 at 18:12

MX records are used to direct where your email is delivered. Changing your A records or CNAMEs will not change where email is delivered. BUT you probably should confirm how Dreamhost has your DNS setup before changing anything.

share|improve this answer
1  
This is only partly correct. As others have mentioned, having a CNAME record will prevent you from using any other record type, including an MX, so if you need mail going to one place and web traffic going to another, all for the same domain/subdomain, then you can't use a CNAME. –  Mark Jun 15 '09 at 14:20
    
Yes, you are correct my answer was only partial but then again you need to ask who is asking the question. Jason said he was a product manager type person and so really all he PROBABLY needs to do is change his A record for domain.com to point to his new IP address (And he also needs to see where his MX records are pointing to make sure that they are not referencing the domain.com entry). So while I agree that my answer was way too short an answer (and he probably needs more information) the top-rated answer right now is too technical and probably does not help him out. –  Jeff Widmer Jun 15 '09 at 15:25
    
Thanks for the response. Yours, in conjunction with the other one, definitely pointed me in the right direction. Once I had direction on which way to go, Dreamhost's interface was clear enough to be able to make it happen. –  Jason Butler Jun 15 '09 at 18:11

Do you have access to zone files on dreamhost?

If yes:

  • Change the TTL to a small number some time before moving the domain, nameservers that respect TTL will update your information faster. After some time past the update, change it back to a regular value.

Regarding email:

Make sure your MX entry is pointing to your old mail server (dreamhost), change only A/CNAME entries.

http://en.wikipedia.org/wiki/MX_record

share|improve this answer

The server that handles the mail for yourdomain.com is referenced by the MX record in the root of the zone file for yourdomain.com.

The server that handles web traffic for yourdomain.com is referenced by the A record in the root of the zone file for yourdomain.com, as well as other address like www.

As you can see, those are separate records, and can be adjusted independently.

share|improve this answer

Your Answer

 
discard

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.