Title: DNS
1DNS
- Redes de Datos 2002
- etapia_at_eie.fceia.unr.edu.ar
2Accessing Resources Applications
- The Domain Name System
- It is described in RFC 1034 and RFC 1035
- Symbolic host names
- The early Internet use only numeric IP addresses
- Problem of maintaining the mappings between IP
- Initially, host names to address mappings were
maintained by the NIC in a single file
(HOSTS.TXT), which was fetched by all hosts using
FTP. This is called a flat namespace
3The problem
- Mapping hostnames
- foobar.cs.colorado.edu to an IP address like
128.138.241.71
4The Solution
- The Domain Name System (DNS)
- Unreliable database with distributed data and
management - A resolver maps names to IP addresses using name
servers
5DNS Hierarchical Name Space
6Naming
- A host has a domain name specified using a
sequence of names, each of which may be up to 63
characters long, separated by periods. - Names are case insensitive
- A domain is an absolute domain name or a fully
qualifieddomain name (FQDN) if it ends with a
period. - E.g., foobar.cs.colorado.edu.
- Most generic domains (.com, .edu, etc) are
international, but .gov and .mil are US-specific.
7Hierarchical Administration
8Top Level Domains
9Administration Zones
- A zone is a subtree of the DNS tree that is
independently managed - Second-level domains (colorado.edu) are usually
an independent zone - Most sub-domains (cs.colorado.edu) are
independent. - E.g., most universities have departmental domains
that are then independently administered
10Administration Zones contd
- A zone must provide multiple name servers This
server records the members in the domain - You typically need a primary name server and one
or more secondary name servers. - Secondary retrieves information from primary
using a zone transfer
11Domain Name Resolution
- A user program issues a request such as the
gethostbyname() system call - This particular call is used to ask for the IP
address of a host by passing the host name. - The resolver formulates a query to the name
server. - Full resolvers have a local name cache to consult
first - Stub resolvers do not
12Domain Name Resolution
- The name server checks to see if the answer is in
its local authoritative database or cache, and
if so, returns it to the client - Otherwise, it will query other available name
server(s), starting down from the root of the DNS
tree or as high up the tree as possible. - The user program will finally be given a
corresponding IP address (or host name, depending
on the query) or an error if the query could not
be answered
13Domain Name Resolution
- Normally, the program will not be given a list of
all the name servers that have been consulted to
process the query. - The query/reply messages are transported by
either UDP or TCP
14Domain Name Resolution
- Domain name resolution is a client/server process
- The client function (called the resolver or name
resolver) is transparent to the user - Called by an application to resolve symbolic
high-level names into real IP addresses or vice
versa. - The name server (also called a domain name
server) is a server application
15Full Resolver
16Stub Resolver
17Domain Name Queries
- Queries can be one of two types recursive or
iterative (also termed non-recursive) - A flag bit in the domain name query specifies
whether the client desires a recursive query. A
flag bit in the response specifies whether the
server supports recursive queries - The server receives a request
- A recursive query requests that the server should
issue a query itself - An iterative query means that server should
return what information it has available and a
list of additional servers
18Domain Name Responses
- Authoritative and Non-authoritative
- A flag bit in the response indicates which type a
response is. - A name server receives a query for a domain in a
zone over which it has authority - It returns all of the requested information in a
response with the authoritative answer flag set - When it receives a query for a domain over which
it does not have authority - Actions depend upon the setting of the recursion
desired flag in the query.
19Domain Name Responses
- If the recursion desired flag is set and the
server supports recursive queries - It will direct its query to another name server
- This will either be a name server with authority
for the domain given in the query, or it will be
one of the root name servers - If the second server does not return an
authoritative answer (for example, if it has
delegated authority to another server), the
process is repeated
20Domain Name Responses
- Upon a response, the server will cache it.
Improve the performance of repeat queries. The
cache entry is stored for a maximum length of
time specified by the originator in a 32-bit
time-to-live (TTL) field contained in the
response. 172,800 seconds (two days) is a typical
TTL value - If the recursion desired flag is not set or the
server does not support recursive queries - It will return whatever information it has in its
cache and also a list of additional name servers
to be contacted for authoritative information.
21Domain name server operation
- Primary
- A primary name server loads a zone's information
from disk, and has authority over the zone. - Secondary
- A secondary name server has authority for a zone,
but obtains its zone information from a primary
server using a process called zone transfer. - To remain synchronized, the secondary name
servers query the primary on a regular basis
(typically every three hours) and re-execute the
zone transfer if the primary has been updated.
22Domain name server operation
- A name server can operate as a primary or a
secondary name server for multiple domains, or a
primary for some domains and as a secondary for
others. - A primary or secondary name server performs all
of the functions of a caching only name server. - Caching-only
- A name server that does not have authority for
any zone is called a caching-only name server. A
caching-only name server obtains all of its data
from primary or secondary name servers as required
23Registering Domains
- When a domain is registered with the root and a
separate zone of authority established, the
following rules apply - The domain must be registered with the root
administrator - There must be an identified administrator for the
domain - There must be at least two name servers with
authority for the zone that are accessible from
outside and inside the domain to ensure no single
point of failure.
24Domain Name System resource records
- The Domain Name System's distributed database is
composed of resource records (RRs) - which are divided into classes for different
kinds of networks.We only discuss the Internet
class of records. - Resource records provide a mapping between domain
names and network objects. - The most common network objects are the addresses
of Internet hosts, but the Domain Name System is
designed to accommodate a wide range of different
objects.
25Domain Name System resource records
- A zone consists of a group of resource records,
beginning with a Start of Authority (SOA) record.
- The SOA record identifies the domain name of the
zone. - There will be a name server (NS) record for the
primary name server for this zone - There may also be NS record(s) for the secondary
name server(s) for this zone. The NS records are
used to identify which of the name servers are
authoritative or in charge of the zone
26Domain Name System resource records
- Then come all the other resource records, which
might map names to IP addresses, or aliases to
names
27DNS General resource record format
28DNS General resource record format
- Name The domain name to be defined
- The Domain Name System is very general in its
rules for the composition of domain names. - It will consist of a series of labels consisting
of alphanumeric characters or hyphens, each label
having a length of between 1 and 63 characters,
starting with an alphabetic character. Each pair
of labels is separated by a dot (period) in human
readable form, but not in the form used within
DNS messages. Domain names are not
case-sensitive.
29DNS General resource record format
- ttl
- Time in seconds that this resource record will be
valid in a name server cache. This is stored in
the DNS as an unsigned 32-bit value. 86400 (one
day) is a typical value for records pointing to
IP addresses. - Class
- Identifies the protocol family. The only commonly
used value is IN (the Internet system) - Type
- Identifies the type of the resource in this
resource record
30DNS General resource record format
- Rdata
- The value depends on the type, for example
- A A 32-bit IP address (if the class is IN)
- CNAME A domain name
- MX A 16-bit preference value (low values being
preferred) followed by a domain name - NS A host name
- PTR A domain name
31DNS General resource record format
32Transport
- Domain Name System messages are transmitted
either as datagrams (UDP) or via stream
connection (TCP). - UDP usage Server port 53 (decimal).
- Messages carried by UDP are restricted to 512
bytes. Longer messages are truncated and the TC
bit is set in the header. - Since UDP frames can be lost, a retransmission
strategy is required. - TCP usage Server port 53 (decimal).
- In this case, the message is preceded by a 2-byte
field indicating the total message frame length
33DNS Message Format
34DNS Message Format
- Identification - set by client, returned by
server. Used to let clients match questions
answers - Questions - a hostname you want resolved - send
by a query, returned by responses - Answers - answers to the questions, only in a
response. You may get multiple answers per
question. - Authority - what host is the authoritative name
server for this query?
35DNS Message Format
36Flags
37Flags
38Flags