Can you create two different DNS records that resolve to same IP?

Cooky

Golden Member
Apr 2, 2002
1,408
0
76
I want to host multiple sites and URL's on the same web server that has single IP.
I usually just add the subsequent DNS records as CNAME for DNS so that when the request comes in, the server would know which site to serve.

Now, would it be better if I were to create two seperate forward DNS records?

How about the reverse DNS records? Can you have an IP resolved to two different names?
 

DaiShan

Diamond Member
Jul 5, 2001
9,617
1
0
You can absolutely use multiple A records to refer to the same IP. If you are hosting a web site Apache has a special directive known as NameVirtualHost in which you specify the IP address of the server then use the ServerName directives to tell apache what to do with the URL (which files to serve) I currently host over 200 web sites on a single IP for a client, the only caveat is when you need to run SSL (for a shopping cart) that site then needs to be hosted on it's own IP address as SSL binds to port 443 and will only serve up one certificate per IP (so if you host two sites on one IP, only one site can have SSL, if you try to access https for the other site then you will receive a lot of warnings about the certificate not matching the host etc.)
 

spidey07

No Lifer
Aug 4, 2000
65,469
5
76
Best practice is to only have a single A record for a host. CNAMEs for any other aliases/urls. I don't think you can have mulitple reverse look up records and even if you can it sounds like a bad idea.
 

dphantom

Diamond Member
Jan 14, 2005
4,763
326
126
Yes, use cnames. Done all the time especially with web servers.

No, do not use multiple PTR's.