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

Discussion in 'Networking' started by Cooky, Feb 27, 2007.

  1. Cooky

    Cooky Golden Member

    Joined:
    Apr 2, 2002
    Messages:
    1,407
    Likes Received:
    0
    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?
     
  2. DaiShan

    DaiShan Diamond Member

    Joined:
    Jul 5, 2001
    Messages:
    9,617
    Likes Received:
    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.)
     
  3. spidey07

    spidey07 No Lifer

    Joined:
    Aug 4, 2000
    Messages:
    65,476
    Likes Received:
    0
    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.
     
  4. dphantom

    dphantom Diamond Member

    Joined:
    Jan 14, 2005
    Messages:
    3,754
    Likes Received:
    0
    Yes, use cnames. Done all the time especially with web servers.

    No, do not use multiple PTR's.
     
Loading...