DNS Records #
- A
CNAME
record is an alias that points from one domain name alias to the actual domain name. On namecheap this can be done by mapping thewww
subdomain to the actual domain name for example.- e.g. a cname of www.mysite.com would point to mysite.com
- An
A
record maps the canonical (actual) domain name to the IP address hosting the website
Recall, when you purchase a domain you purchase a top level domain (TLD) which is <domain>.<TLD>
(e.g. example.com
). www
is a subdomain so you must map that alias to the actual canonical domain name, which in this case is example.com
.
DNS #
- DNS is an inverted tree, with the root servers being the parents and each child representing the authoritative name servers for a subdomain.
- e.g. sean.test.com. will be a tree of
. -> com -> test
. The.
is the root, and each domain name must end in a.
to be a FQDN (Fully-Qualified Domain Name)
- e.g. sean.test.com. will be a tree of
- Recursive nameservers don’t know anything about actual DNS records, but recursively query the authoritative name servers, cache the result, and return it to the user. E.g. Google’s
8.8.8.8
is a recursive name server - Use
dig
(domain information groper) to query DNS serversdig +trace
gives you all the recursive query results
- By default, Linux systems will look for a name server running on port 53 (for Ubuntu this is a systemd stub) and which contains info for actual nameservers.
- See
/etc/resolv.conf
- See
- Root servers are not used to recursively query (only to retrieve info of other authoritative nameservers). These other authoritative nameservers can then recursively query.
- Can run
domainname
orhostname -d
to see the domain name of your local system
Example #
- Query test.com to
8.8.8.8
-
8.8.8.8
looks if test.com is in cache -> if so return result
-
- If not in cache, query hardcoded root server for authoritative name server for the
.com
subdomain
- If not in cache, query hardcoded root server for authoritative name server for the
-
- Ask the
.com
nameservers for the IP address oftest.com
- Ask the
-
- Ask the
test.com
nameserver for the IP address
- Ask the
-
- Credit to Julia evans
Pointer Queries #
- Convert IP addresses to hostnames
- Must be configured in a mapping like hostname to IP address