Post

DNS Cheatsheet

Cname

To create a CNAME record, you need specific pieces of information related to your domain and the target you’re pointing to. Here’s how to gather all the necessary information step-by-step:

1. Understand What a CNAME Record Is

A CNAME record (Canonical Name Record) maps one domain name (alias) to another domain name (canonical name). For example, you might use a CNAME to make www.example.com point to example.com or to point a subdomain to an external service like mail.example.com to mail.provider.com.

2. Required Information for a CNAME Record

Alias Name: The domain or subdomain you’re creating the CNAME record for. Examples: www (for www.example.com). blog (for blog.example.com). This is the name field in your DNS settings.

Canonical Name (Target): The domain or hostname you want the alias to point to. Examples: example.com (if you’re pointing www.example.com to example.com). custom.serviceprovider.com (if you’re using an external service like email or CDN).

TTL (Time-to-Live): This determines how long the DNS resolver should cache the record before checking for updates. Most DNS providers use a default TTL (e.g., 300 seconds or 1 hour). You can usually leave this as the default unless advised otherwise.

3. Where to Find This Information

Alias Name: Decide which subdomain you want to point. Examples: Use www for a www.example.com record. Use mail for mail.example.com.

Canonical Name: Provided by the service or host you’re pointing to. Examples: If you’re pointing to the root domain, the canonical name might be example.com. If pointing to a service, the provider typically gives you a specific hostname (e.g., cname.serviceprovider.com).

TTL: Check your DNS provider’s settings for default values, or set one manually if required.

4. Steps to Gather Information

Log in to Your Hosting/DNS Manager: Access your DNS settings through your hosting provider (e.g., cPanel, Cloudflare, Namecheap).

Check Your Service Provider: If pointing to an external service (e.g., email, CDN, or custom hosting), refer to their documentation or support portal for the correct target (canonical name). Examples: Email hosting: If you’re setting up email through a provider like G Suite or Office365, they will provide the exact CNAME target. CDN/Custom Service: Providers like Cloudflare or AWS Route53 will give you a specific CNAME value to use.

Verify Existing DNS Records: If you’re adding a CNAME to an existing setup, check your current DNS records to avoid conflicts.

5. Example: Setting Up a CNAME for www

If you want to point www.example.com to example.com:

Alias Name: www Canonical Name: example.com TTL: Use default (e.g., 3600 seconds).

6. Tips for CNAME Configuration

Do Not Use CNAME for Root Domains: Most DNS systems do not allow CNAME records on root domains (e.g., example.com). Use an A record instead. Check for Existing Conflicts: Ensure the alias (subdomain) does not already have an A or CNAME record. Verify Changes: Use tools like nslookup, dig, or online DNS checkers to confirm the CNAME record is active after propagation.

If you’re working with a specific provider or service, I can guide you through the exact process for their setup!

A Record

Create an A Record:

Add a Subdomain (DNS A Record):

Name: subsite (or subsite.example.com depending on the DNS provider interface). Type: A Value: The IP address of the server where your website is hosted (same as example.com if it’s on the same server). TTL: Leave as default (e.g., 3600 seconds).

Transferring MX (mail) Records

When transferring mail records such as google DNS records. Its an effective technique to get the existing records first and just copy these over to the new dns provider. Get these records before changing the nameserver and your good to go.

1
dig example.com.au MX

You should add smtp.google.com as the value for your MX record(s) with the appropriate priority. It’s recommended to add multiple MX records with different priorities for redundancy, but if you started using Google Workspace before 2023, you might have different MX record values (starting with “aspmx”)

The ASPMX.L.GOOGLE.COM records are for older gmail installs

This post is licensed under CC BY 4.0 by the author.