Traditional DNS Howto - Page 5

Want to support HowtoForge? Become a subscriber!
 
Submitted by taft (Contact Author) (Forums) on Sun, 2006-03-12 10:53. ::

A Records

Up to now we have used the domain names centralsoft.org, server1.centralsoft.org, and ns0.centralsoft.org, but we did not specify anywhere to which IP addresses these domains should point to. That's where A records come into play. A records are the most important DNS records; with them you can create host addresses. Let's create our first A record:

centralsoft.org.   A 70.253.158.42

This means that centralsoft.org has the IP address 70.253.158.42. Remember my hint about the '.'? You can also write

                   A 70.253.158.42

which means exactly the same.

Now in a browser you are used to typing www.centralsoft.org instead of centralsoft.org, aren't you? www.centralsoft.org is technically totally different from centralsoft.org, but obviously you expect to see the same web site for both. Therefore we create this record:

www                A 70.253.158.42

which is the same as

www.centralsoft.org.              A 70.253.158.42

Finally we specify server1.centralsoft.org and ns0.centralsoft.org:

server1            A 70.253.158.42
ns0 A 70.253.158.45

ns0.centralsoft.org points to a different IP address which makes sense because it is our secondary nameserver which should be on a different system in case our primary nameserver goes down.

CNAME Records

CNAME is short for "canonical name", you can think of it as an alias to an A record. For example,

ftp                CNAME www

means, ftp.centralsoft.org is an alias for www.centralsoft.org, so ftp.centralsoft.org points to the same machine as www.centralsoft.org.

A CNAME must always point to an A record; a CNAME must not point to another CNAME! In addition to that, you must not use CNAME records for MX and SOA records. For example,

                   MX 10 ftp

is not allowed!

The usage of CNAMEs has its pros and cons. I can hear you say "If the usage of CNAME records has that many restrictions, why don't we always use A records?" That's true, but imagine you have hundreds of machine names as A records, pointing to the same IP address, and now you move the server to another data center where it is assigned a different IP address. You'd have to update every single A record. If you had just one A record and all other records were CNAMEs, you'd just have to update one A record...


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.