Transcript ppt

NET0183 Networks and Communications
Lecture 25
DNS Domain Name System
NET0183 Networks and Communications by Dr
Andy Brooks
DNS is a distributed database implemented
in a hierarchy of many servers.
DNS is an application layer protocol that
runs over UDP and uses port 53.
When someone uses the term “DNS” they might be talking about
the servers or they might be talking about the protocol or both.
NET0183 Networks and Communications by Dr
Andy Brooks
DNS @ Webopedia 17/3/10
Short for Domain Name System (or Service or Server), an Internet
service that translates domain names into IP addresses. Because
domain names are alphabetic, they're easier to remember. The
Internet however, is really based on IP addresses. Every time you
use a domain name, therefore, a DNS service must translate the
name into the corresponding IP address. For example, the domain
name might translate to
The DNS system is, in fact, its own network. If one DNS server
doesn't know how to translate a particular domain name, it asks
another one, and so on, until the correct IP address is returned.
NET0183 Networks and Communications by Dr
Andy Brooks
4.20 Name Resolution
• The translation of a domain name into an address is called
name resolution and the name is said to be resolved to an
• Software to perform translation is known as a name resolver
(or simply resolver).
• In the socket API, for example, the resolver is invoked by
calling function gethostbyname.
• Each resolver is configured with the address of one or more
local DNS servers.
• The resolver forms a DNS request message and sends the
message to the local DNS server.
– The resolver the waits for the local DNS server to send a DNS reply
message with the answer.
© 2009 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved.
Root server system @ Webopedia 17/3/10
A system of 13 file servers that are distributed around the globe
and contain authoritative databases that form a master list of all
top-level domain names (TLDs). There is one central, or "A",
server that replicates changes to the other servers on a daily basis.
Different organizations maintain the servers on the root server
system. The U.S. government plays a role in maintaining about
half of the servers.
“While only 13 names are used for the root nameservers, there are many more
physical servers; C, F, I, J, K, L and M servers now exist in multiple locations on
different continents, using anycast address announcements to provide decentralized
service. As a result most of the physical root servers are now outside the United
States, allowing for high performance worldwide.”
Root nameserver @ Wikipedia 3/17/2010
NET0183 Networks and Communications by Dr
Andy Brooks
TLD @ Webopedia 17/3/10
Short for top-level domain, and refers to the suffix attached to
Internet domain names. There are a limited number of predefined
suffixes, and each one represent a top-level domain. Current top-level
domains include:
• com - commercial businesses; this is the most common TLD
• gov - U.S. government agencies
• edu - Educational institutions such as universities
• org - Organizations (mostly nonprofit)
• mil - Military
• net - Network organizations
• ca - Canada
• th - Thailand
NET0183 Networks and Communications by Dr
Andy Brooks
NET0183 Networks and Communications by Dr
Andy Brooks
slide from Kurose & Ross
Distributed, Hierarchical Database
Client wants IP for; 1st approx:
• Client queries a root server to find com DNS server
• Client queries com DNS server to get DNS
• Client queries DNS server to get IP address
slide from Kurose & Ross
 Host at
wants IP address for
slide from Kurose & Ross
Recursive queries
recursive query:
 puts burden of name
resolution on
contacted name
 heavy load?
iterated query:
 contacted server
replies with name of
server to contact
 “I don’t know this
name, but ask this
slide from Kurose & Ross
DNS: caching
 once (any) name server learns a mapping, it
caches the mapping
 cache entries timeout (disappear) after some
 Top-level domain servers are typically cached
in local name servers.
 Thus root name servers are not often
Domain Name System @ Wikipedia 17/3/10
“In principle, authoritative name servers are sufficient for the
operation of the Internet. However, with only authoritative name
servers operating, every DNS query must start with recursive queries
at the root zone of the Domain Name System and each user system
must implement resolver software capable of recursive operation.”
“To improve efficiency, reduce DNS traffic across the Internet, and
increase performance in end-user applications, the Domain Name
System supports DNS cache servers which store DNS query results for
a period of time determined in the configuration (time-to-live) of the
domain name record in question.”
“An authoritative-only name server only returns answers to queries
about domain names that have been specifically configured by the
NET0183 Networks and Communications by Dr
Andy Brooks
DNS caching in Web browsers
“DNS has a cost. It typically takes 20-120 milliseconds for DNS to lookup the IP
address for a given hostname. The browser can’t download anything from this
hostname until the DNS lookup is completed.”
“DNS lookups are cached for better performance. This caching can occur on a special
caching server, maintained by the user's ISP or local area network, but there is also
caching that occurs on the individual user's computer. The DNS information remains
in the operating system's DNS cache (the "DNS Client service" on Microsoft
“Most browsers have their own caches, separate from the operating system's cache.
As long as the browser keeps a DNS record in its own cache, it doesn't bother the
operating system with a request for the record.”
“Internet Explorer caches DNS lookups for 30 minutes by default, as specified by the
DnsCacheTimeout registry setting. Firefox caches DNS lookups for 1 minute,
controlled by the network.dnsCacheExpiration configuration setting.”
NET0183 Networks and Communications by Dr
Andy Brooks
slide from Kurose & Ross
DNS records
DNS: a distributed database storing resource records (RR)
RR format: (name,
 Type=A
 name is hostname
 value is IP address
 Type=NS
 name is domain (e.g.
 value is hostname of
authoritative name
server for this domain
value, type, ttl)
 Type=CNAME
 name is alias name for some
“canonical” (the real) name is really
value is canonical name
 Type=MX
 value is name of mailserver
associated with name
slide from Kurose & Ross
DNS protocol, messages
query & reply messages both have the same message format
msg header
 Identification: 16 bit # for query, reply to query uses same #
 Flags, e.g.
query or reply
 Bit 16 - QR bit. The message is a query if the value is 0.
The message is a response if the value is 1.
reply is authoritative
 Bit 21 - AA bit. - Authoritative answer is set if the
responding name server is an aurhority for the domain
name in question.
recursion desired
 Bit 23 – RD bit. Recursion Desired is set in a query and
indicates the query should be persued recursively.
slide from Kurose & Ross
DNS protocol, messages