Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm making a website, and I need a sub-domain.

I need to email my host so he can add the sub-domain linking, but I don't know which type of DNS record to add on my end in the DNS.

Is it A or CNAME?

share|improve this question

migrated from Jun 1 '11 at 17:19

This question came from our site for professional and enthusiast programmers.

It depends on whether you want to delegate hosting the subdomain off to a different DNS server (or to the same server, but in a different zone file). You delegate a zone when you want some other entity to control it, such as a different IT department or organization.

If you do, then you need NS records. If not, A or CNAME records will suffice.

Let's say you have the domain You have an A record for and you want to create the subdomain with as a host in it.


In the this situation, let's further say you have two DNS servers that will be hosting that subdomain. (They could be the same servers that are currently hosting In this case, you will create two NS entries in the zone file:

info        IN NS
info        IN NS

On those two servers, you will create the zone and populate it as you would any other domain.

www         IN A

No delegation

Here, just add an A record in the zone file, using a dot to indicate that you want to create the host in the domain:    IN A


The decision of whether to use a CNAME is independent of the delegation choice. I generally like to use a CNAME for the "generic" names which point to specific machine names. For example, I might name my machines using an organizational naming convention such as cartoon characters (daffy, elmer, mickey, etc.) or something bureaucratic (sc01p6-serv) and point the generic names to them. If the IP address of the machine ever changes, I need look in only one place to modify it.

www         IN CNAME   sc01p6-serv
mail        IN CNAME   sc01p6-serv
sc01p6-serv IN A
share|improve this answer
Ehm, isn't www. already a subdomain? ;) – kaiser Aug 17 '15 at 15:07

The answer is, either will work.

Which is preferred should be advised upon by your web host.

If they're in the habit of changing the IP addresses of their servers, use a CNAME pointing to the name they tell you.

share|improve this answer

You need the following records in your hosts DNS:

  • two Name Server (NS) records pointing to the authoritative name servers for your sub-domain
  • Address (A) records for the sub-domain name servers

And you need to provide a pair of DNS name servers for your sub-domain. They need to serve the following records:

  • a Start of Authority SOA record for the sub-domain
  • two or more NS records
  • A records for the sub-domain name servers

RFC1034 contains a good description of how sub-domains are configured.

BTW - you might have better luck posting questions about configuration to or in the future.

share|improve this answer

If your host gives you a name in another domain, you need to create a cname in your domain, if your host gives you an IP address, you need to create an a record in your domain.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.