Recently, I’ve built many website from scratch. Building the frontend application, the backend application, put in place the SSL certificates, email redirections and the DNS records.
After buying the domain name, each service provider (like Squarespace, AWS, GCP or Ionos) allows me to configure the DNS records. Some are already in place at give conflicts with new ones. And some modifications already gave me the DNS records to put in place, but other let me alone to figure it out.
The questions I was asking to myself were: What is this record for? How do I add a subdomain URL? How do I test it?
So, to better answer those questions, I need to understand the most important DNS records.
MX
Here will be located all configurations to have a custom domain in your email address. This works when I buy a domain name and want to use it in my Google workspace.
But if I don’t have a Google workspace (a professional plan for emailing) I can’t use my domain name to send emails.
A solution can be to have an website administration like WordPress which accepts redirection rules for emails. But this only allows me to receive emails with the custom domain name.
If I want to send emails with my custom domain name, I need a email server. I can do it with paid services (like Brevo, Mailchimp), Cloud services (AWS SES) or setup my own email server in my laptop.
TXT
TXT records has no function by its own. It’s only to validate I’m the owner of the domain name.
Let’s say I want to send mails with my domain name from Brevo. Before putting this in place, Brevo must ensure I’m the owner of the domain name. They will ask me to add a TXT record with a random value. Once added, Brevo checks periodically if it exists, and certifies I’m the owner of the domain name.
CNAME: for aliases
The CNAME records are used to create aliases. Let’s say I want a new URL for my website, a URL like blog.mywebsite.com, but the old one mywebsite.com needs to point to the website too. I can do this by adding a CNAME record with the blog value.
Another usage is using a URL with my own domain name to point to the auto-generated WordPress URL. Or have a backend URL with my own domain name instead of the auto-generated by AWS.
A and AAAA: for ips
The last record types are A and AAAA. I use those when I want to point URLs to IPs. The difference between A and AAAA, is that the last one accepts IPv6.
Some applications, like website hostings or load balancers, publish IPs for their services instead of auto-generated URLs. If I want to use my own domain name instead of those IPs, I need to add an A record.
nslookup
That’s fine to know the real meaning of all those DNS records. But how do check if my URL is configured correctly?
I can use the nslookup command line.
Let’s use it with my own domain name.
> nslookup sergiolema.dev
Server: 10.177.2.9
Address: 10.177.2.9#53
Non-authoritative answer:
Name: sergiolema.dev
Address: 192.0.78.25
Name: sergiolema.dev
Address: 192.0.78.24
I can see that my domain name points to many IPs. That’s an A record (in fact, it’s two A records, one per IP).
Let’s check another one.
> nslookup blog.sergiolema.dev
Server: 10.177.2.9
Address: 10.177.2.9#53
Non-authoritative answer:
Name: blog.sergiolema.dev
Address: 192.0.78.25
Name: blog.sergiolema.dev
Address: 192.0.78.24
I have a second URL (that I don’t use) which also points to the same IP addresses, that’s another A record.
And the last one.
> nslookup store.sergiolema.dev
Server: 10.177.2.9
Address: 10.177.2.9#53
Non-authoritative answer:
store.sergiolema.dev canonical name = domains.gumroad.com.
domains.gumroad.com canonical name = production-custom-domains.gumroad.net.
Name: production-custom-domains.gumroad.net
Address: 54.167.106.173
Name: production-custom-domains.gumroad.net
Address: 52.72.18.99
Name: production-custom-domains.gumroad.net
Address: 52.5.148.118
This time, I can see the canonical name where the URL points to. This is a CNAME record. My URL points to another URL (domains.gumroad.com), which points to another URL (production-custom-domains.gumroad.net) which points to three IPs.
It always ends up with an IP.
Conclusion
Now that you’ve mastered the art of DNS records, you’re no longer just clicking buttons and hoping for the best—you’re officially in control of where your domains are pointing.
With the help of trusty commands like nslookup, you can check that your changes are actually making an impact, even if the results aren’t instant because, as always, DNS likes to take its sweet time propagating across the internet.
Patience, my friend.
Also, let’s not forget one golden rule: always copy your DNS records before you decide to play the delete game. Seriously, nothing says “fun troubleshooting session” like accidentally wiping out your records without a backup in place.



Leave a comment