DNS (Domain Name System) is the internet's phonebook. Computers find each other by IP address (like 203.0.113.25), but people remember names. DNS translates www.myshop.lk into an IP address.
How a lookup works
Results are cached for the record's TTL (time to live, in seconds) so lookups stay fast.
Important DNS record types
| Record | Purpose | Example |
|---|---|---|
| A | Name to IPv4 address | @ A 203.0.113.25 |
| AAAA | Name to IPv6 address | @ AAAA 2001:db8::1 |
| CNAME | Alias to another name | www CNAME myshop.lk |
| MX | Mail servers for the domain (with priority) | @ MX 10 mail.myshop.lk |
| TXT | Free text: SPF, DKIM, DMARC, domain verification | @ TXT v=spf1 include:_spf.host.com ~all |
| NS | The authoritative nameservers for the domain | @ NS ns1.host.com |
(@ means the bare domain, myshop.lk itself.)
Pointing a domain to your host: two ways
- Change nameservers at the registrar to the ones your host gives you (e.g.
ns1.host.com,ns2.host.com). The host then manages all records. - Keep nameservers at the registrar (or at a DNS provider such as Cloudflare) and add an A record with your host's IP address, and a CNAME for
www.
Propagation: changes can take minutes to 48 hours to be visible everywhere, because of cached TTLs. Lower the TTL (e.g. 300) a day before planned changes.
Check DNS yourself
Terminal
nslookup myshop.lk
nslookup -type=MX myshop.lk
dig myshop.lk A
dig +short www.myshop.lk CNAMEOnline tools: whatsmydns.net, mxtoolbox.com. Local testing trick: edit the hosts file to map a name to an IP on your own computer only.