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.

I have two servers, both of which host multiple websites. I would like both servers setup to use a single domain.

I have Kloxo installed on both of them and would like to be able to access it via a URL, like server1.example.com or server2.example.com, which would obviously point to different IP addresses.

Currently, I have a single A record (@) for example.com that points to the IP address. Then I have several CNAMEs that point to @.

Should I create two more A records, one for server1 that points to it's IP address and another for server2 that points to it's address? Should I still keep the @ record and point the CNAMEs to it, or should the CNAMEs then point to server1.example.com instead of @?

EDIT - I'm not looking to have the example.com website on both servers. It is an Apache vhost on server1 and is fine like that. What I'm trying to do is properly DNS register the servers themselves using example.com such that I can access the Kloxo admin panels via a URL instead of an IP address, or can set PTR/rDNS/whatever records so that email works.

share|improve this question

2 Answers 2

CNAMEs are more for logical ordering than any fundamental part of how DNS works. Clients such as web browsers have no idea whether the IP address came from an A record or a chain of any number of CNAME records. The idea is that because the URLs http://www.example.com and http://example.com will always both be served by the same webserver, you will always have to update the IP addresses of both at the same time. So a CNAME says that www.example.com should just use whatever IP address example.com has.

If your domains and subdomains have relationships like that example, where two domains should always have the same IP address then a CNAME is appropriate. Otherwise, an A record is appropriate. It doesn't really matter all that much. So as long as it works you are generally okay. (There are some exceptions to this regarding MX records.)


You said in the question that you have

a single A record (@) for example.com that points to the IP address

A records only have one IP address. Do you have two A records for the same domain with different IP addresses? This would be DNS load balancing.

If that is the case, you should definitely create new A records for server1 and server2 for each of your Kloxo installs.

share|improve this answer
    
At the moment I have a single A record for example.com that points to the IP for server1, which has an Apache vhost for example.com. I don't want the website itself to be hosted on both servers, I just want to be able to use the domain to identify the hosts themselves in a server1.example.com way. Hope that makes sense. –  Biggles Jun 17 '12 at 22:41

Yes - Create the A records for each server.

(and leave the existing records unchanged)

For example:

Lets say your example.com website itself is hosted on 192.0.2.1, and your two Kloxo servers are on 192.0.2.2 and 192.0.2.3, respectively.

You would want something like the following in your zone:

@           IN     A     192.0.2.1
www         IN     CNAME @
server1     IN     A     192.0.2.2
server2     IN     A     192.0.2.3
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.