The importance of DNS -part 2
Tuesday, January 29th, 2008So now you understand what DNS is. How do you use it?
The first thing you need to do for each domain is to put in the correct name server at the registrar (ex. godaddy).
If you are using your own DNS servers then the name server will probably be ns1.mydomain.com and ns2.mydomain.com where mydomain is the domain you registered. If you are going to be running your own DNS servers then I recommend at this point to contact your registrar and let them know you will be running you’re own DNS servers. They will probably ask you what your static ip will be. This will be given to you by your colocation facility or isp that you are using. You CANNOT run your own dns servers on a cablemodem/dialup or anything that your ip changes on, EVER. You need a staic ip that changes very rarely (once every few years if possible)
If you use a free DNS service, then you would input the servers used by that services (ex. ns1.zoneedit.com ns5.zoneedit.com).
Now that you have setup the name servers fo your domain, it’s time to learn some basic DNS type records. We’re going use mydomain.com as an example.
mydomain.com is the official hostname. Not www.mydomain.com, and not anything else. The prefix www. or ftp. or mail. or blog. are all just subdomains.
Below are a few of the most common dns record types:
- A
- CNAMES
- MX
A records are the most common and typically point to the ip address of the location.
example 1: You want mydomain.com to point to 192.168.1.2
example 2: You want www.mydomain.com to point to 192.168.1.2
You can assign multiple A records to the same ip address or point different records to different ips. For example dev.mydomain.com might point to a different ip on a different machine since it will be for development work
CNAME records can be treated like A records except they can also forward to another address. So dev.mydomain.com might actually forward to www.google.com
If you will not be forwarding to anything else, then I suggest using A name records since it will save on DNS queries.
MX records. These records tell mail servers where to deliver mail to.
example: You want to run a mail server on ip 192.168.1.2
- Setup the mail address A record (mail.mydomain.com) to point to 192.168.1.2
- Setup the MX record with to point to mail.mydomain.com
The idea behind MX records is that you could have several mail servers running on different ips that could receive mail for your domain. Each MX record can have a weight which will determine in order which mail server to try if one in unreachable.
Another good example is that you might want to use someone else’s mail server if you do not wish to run your own. An example is the google email system.