Domain name: an identification string that defines a realm of administrative autonomy, authority, or control within the Internet.
DNS currently has ~300 million DNS registrations. Both query and reply messages follow the same message format. Both always include Name, Type, Class tuples — Class is usually IN
. Names cannot be wildcarded but type and class can
How do we resolve domain names to IP addresses? Resolves starting from the root and makes it way down the network hierarchy
- Root (13 of these worldwide)
- Top-level Domains (e.g. .com, .net, .org, etc.)
- Second-level Domains (e.g. UBC)
- Subdomains (e.g. www)
- Individual machines
- Local DNS Servers (not actually a part of the hierarchy, just caches data)
Authoritative DNS server is the server with the actual jurisdiction of the domain name you are looking for. The authoritative server of cs.ubc.ca
is the cs
server under UBC.
Types of queries
- Recursive Query — if the name server doesn’t know the answer, it asks a downstream server (recursively) for the answer on your behalf.
- Iterative Query — if the name server doesn’t know the answer, it tells you where to look at next, you do all the querying
DNS servers store resource records (RRs) Types:
- A (address records)
- name: hostname
- value: IPv4 address
- NS (name server)
- name: domain
- value: name of DNS server for domain
- MX (mail exchanger)
- name: domain of email address
- value: name of mail server
- AAAA (addressx4 record)
- name: hostname
- value: IPv6 address
- CNAME (canonical name)
- name: alias
- value: canonical name (e.g. foo.com)
- TXT (just plain text)
- name: domain
- value: plain text in the format of
attribute=value
. The TXT record was originally intended as a place for human-readable notes but now often used for domain ownership verification (see: dnslink and Bluesky)
Inserting records into DNS
- Register name with a registrar
- Provide registrar with name and IP address for your authoritative name server (usually a primary and secondary)
- Registrar inserts two resource records into the top-level domain server for each authoritative name server
(example.com, dns1.example.com, NS)
(dns1.example.com, 212.212.212.1, A)
- Add appropriate records into our own authoritative name server
(www.example.com, <server-ip>, A)
(www.example.com, <server-ip>, MX)
DNSLink
DNSLink uses DNS TXT records to map a DNS name, like en.wikipedia-on-ipfs.org, to an IPFS address
Because you can edit your DNS records, you can use them to always point to the latest version of an object in IPFS.
$ dig +noall +answer TXT _dnslink.docs.ipfs.tech
_dnslink.docs.ipfs.tech. 34 IN TXT "dnslink=/ipfs/QmVMxjouRQCA2QykL5Rc77DvjfaX6m8NL6RyHXRTaZ9iya"