If you have a purchased a domain you have probably already have some idea of what you want to do with it. However, there is an old saying that goes, “the devil is in the details”. Now it is time to get specific with what you have in store for this domain.
Perhaps you want to run your own email server where no one scans your messages to build an advertising profile, or run a chat server for your friends and family that you believe that should be truly private. Whatever your use case, the first thing you need to do with a domain is set up Domain Name System, or DNS records.
In the dark ages of the Internet, there were no names. All computers communicated with each other by IP address. An IP address is similar to a telephone number, but for computers.
In the 1970’s and early 1980’s as more computer systems came online, the list of IP addresses became too much to memorize. The people maintaining the early internet (called ARPANET) came up with a solution which used text files to manage IP address mappings to names that were helpful to the humans operating the computer systems. This list quickly became too large to maintain, so in the mid 1980’s DNS was born.
Fun fact. While we have since stopped using text files to remember which IPs belonged to which systems, those text files remain present in operating system software to this day.
So now that we know what DNS is, how can we use it to help people find our services?
You do this by creating names for the services that you want to have. You create these names inside your domain’s DNS zone. Computers on the Interent then ask DNS where they can find your domain, and then your services within. This process is called DNS resolution.
Your hosting provider will provide an interface for making necessary changes to your DNS zone. If you are managing your DNS via a BIND installation, see [this advanced guide].
Below we discuss a few different types of DNS records; A, AAAA, CNAME, MX and TXT. Within DNS there are different record types, each having a different purpose. Don’t worry if they are a little confusing now. You won’t typically make many changes to these records unless you decide to move your server.
- A – This is an IP version 4 DNS record which maps one hostname to an IPv4 IP address (220.127.116.11)
- AAAA – This is an IP version 6 DNS record which maps one hostname to an IPv6 IP address (7890:dead:beef:0123::1)
- MX – Mail Exchanger record. This record type tells mail servers on the internet where to deliver mail for your domain.
- CNAME – Cannonical NAME record. This record type can be thought of as an alias. A CNAME record ‘chat.yourdomain.com’ pointing to ‘yourdomain.com’ tells computers on the internet that they should look up the IP address for ‘yourdomain.com‘ in order to connect to ‘chat.yourdomain.com‘
- TXT – Text records, typically used to pass extra domain information such as SPF or DKIM records for email security.
The names that you create will depend on the service that you intend to host on your domain. You are free to create any number of names within your domain, and the names can be whatever you prefer. The sections below discuss some common conventions regarding service names.
Domain root – the @ record
All domains have their root address. If you are using a registrar to manage your DNS, this record is typically an A or AAAA record indicated by an ‘@‘ in the host portion of the record. This @ indicates that this is the IP address that should be returned when a request is made for the IP address of yourdomain.com. Your registrar may have already created this record for you and pointed it to one of their IP addresses. This is the IP address that you will change when you get your private server.
Email, MX and SPF
Most people who have purchased a domain will want an email address at that domain. To do this, you will need to have a server to process your mail, and then create or update MX records in your DNS zone to inform other computer systems where to deliver your mail. MX records have an additional field for priority. The MX record’s priority tells mail servers on the internet which order to use MX records, if more than one exists. If your domain only has one mail server (this will be the case for most readers here), then you only need one MX record. A priority of ’10’ will be fine, as there is only one record.
To www, or not to www. That is the question.
If you want to run a website with your domain, you may want to set up a www.yourdomain.com as a CNAME record pointing to yourdomain.com. While many internet companies have moved away from using www, and instead have their websites at the bare domain name, i.e. https://yourdomain.com, creating the www CNAME record is still a good idea. Not creating this record will cause DNS resolution errors for users who include www. when finding your services.
Other services are typically named something that indicates what the service does, or returns to the user. For example, if you plan to host a photo sharing application, consider adding a DNS record for photos, pictures, or perhaps media. This can be a CNAME to yourdmain.com, or can be an A/AAAA record resolving to an IP address.
Perhaps you plan to host a chat service on your new domain. If so, add a record for that. chat.yourdomain.com might be a good choice.
Video calls? Add a record for that. Perhaps meet.yourdomain.com
DNS is there to help
People don’t want to remember IP addresses. Even if remembering IPs were practical, in today’s world of cloud computing and changing IP addresses. IP addresses are great for computers, but the problems around humans using them were clear 40 years ago.
Whatever services you run on your domain, you will need the Domain Name System to help users find your services. Mastering the inner complexities of DNS may require many years of study and experience in the field, but we believe that anyone can achieve an understanding of DNS that will enable them to manage their online services.
Go ahead and sign in to your the console where you registered your domain name and create the records for your domain to point to your private server.