-4

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.

Biggles
  • 35
  • 1
  • 6
  • [Administration panels are off topic](http://serverfault.com/help/on-topic). [Even the presence of an administration panel on a system,](http://meta.serverfault.com/q/6538/118258) because they [take over the systems in strange and non-standard ways, making it difficult or even impossible for actual system administrators to manage the servers normally](http://meta.serverfault.com/a/3924/118258), and tend to indicate low-quality questions from *users* with insufficient knowledge for this site. – HopelessN00b Apr 09 '15 at 18:56
  • My goodness, your reading comprehension is shockingly bad and your closing remarks condescending to the point of ridiculous. This was *never* about admin panels and they have nothing to do with this as the question was about DNS records as set *elsewhere entirely*. The question would have been just as valid whether I was using Kloxo or whether it was a simple "hello world" page. – Biggles May 20 '15 at 09:15

2 Answers2

1

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.

Ladadadada
  • 25,847
  • 7
  • 57
  • 90
  • 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
0

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
Joe Sniderman
  • 2,749
  • 1
  • 21
  • 26