A server is assigned to each domain, plus a
root
server which
knows the servers for all the top-level domains.
Clients must know at least the root server ahead of time.
Look up bills.accounting.mega.com.
Ask the root server the address of bills.accounting.mega.com.
It will tell you the address of a com server.
Ask the com server if it knows bills.accounting.mega.com.
It will tell you the address of a name
server for mega.com
Ask the mega.com server if it knows
bills.accounting.mega.com.
It might be configured to tell you, or might refer to a server
for the accounting department.
If the later, one more request should do it.
Recursive and non-recursive requests.
A recursive request asks the server to run through the whole chain
and tell the final answer.
A non-recursive request just asks for as much a the
server already knows.
Clients may mark their request recursive or not.
A server may ignore the recursive mark if so configured.
If a server tells the next step instead of the answer, that is
called a “referral.”
Practical Deployment
Root and Top-Level Domain (TLD) servers organized by IANA and its
licensees.
Second-level servers provided by the domain owner or their ISP.
Public, non-recursive service for outside requests.
Recursive, caching service for internal requests.
Local host resolver.
Usually a library to implement DNS client operations.
DNS server to use configured by DHCP, modifiable by hand.
There are public DNS servers if you don't like the one
from your ISP or organization.
Efficiencies
Caching and caching support in DNS.
Clients cache final results so they don't have to be run again.
Servers doing recursive lookups cache at each level, and can
process new requests with last known part.
DNS responses specify how long they should be cached.
A response from owning domain server, instead of something
that cached it along the way is “authoritative.”
Many requests are local.
A name may map to several IP addresses.
The DNS server may return them in rotation.
The DNS server may return all of them and the client picks one.
This allows load balancing.
Security issues.
Clients are generally assigned a local caching DNS server.
Usually assigned by DHCP, which the machine trusts.
The server you're assigned might be full of lies.
(The coffee shop just might have a hacker running its DHCP).
DHCP server identity is not verified. Another customer at the
coffee shop might be running the one you get.
Hackers can send unsolicited DNS responses in hopes of being believed.
If so, these will be cached.
A system using signed DNS records has been standardized, but is
not widely deployed.
In practice, the main defense against false DNS records seems to be
the TLS certificate check in https.
The contacted server must prove it is who it says.
But most
TLS services other than https do not use a certificate check.
Record types.
There are many record types for different information DNS can hold.
Major ones:
A
Records the IP address for a given name.
PTR
Map an IP address to a host name.
MX
Where to send mail addressed to a host.
CNAME
Name is an alias for another.
There may be multiple A records pointing to the same IP.
A PTR record can denote any name that points to its IP, or
one that doesn't.
International Domains.
The DNS standard allows host names to be made of ASCII.
International names are coded with a complicated scheme called
Punycode.