Title: DNS The Domain Name System
1DNS - The Domain Name System
- Sirak Kaewjamnong
-
- Computer Network Systems
2Outline
- DNS basic
- name space
- resolver
- protocol
- configuration
3Why need DNS?
- host table /etc/hosts
- simple text file with has IP address to name
mapping - problems
- name collision
- consistency
- A hierarchical name with distributed control is
needed
4DNS basic
- DNS is a distributed database
- TCP/IP applications use DNS to
- map hostname to IP address
- map IP address to hostname
- provide e-mail routing information
- mail ksirak_at_ratree.psu.ac.th gt ratree.psu.ac.th
- handle aliases
- www.cs.psu.ac.th is actually www2.cs.psu.ac.th
5Naming Scheme
www.cs.psu.ac.th
building tree from top to bottom
more specific
cs
www
www.cs.psu.ac.th
- name space is a tree of domain
- names are case-insensitive
6Domain Name Space
root
cc
cc.usu.edu
cs
eng
www
www.cs.psu.ac.th
generic domains
country domains
7DNS Management
managed by ICANN
managed by thnic Thailand
- ICANN manages root and top level domain name
- local admins manage 3rd level or more
manage by ku
managed by psu
8Domain Name Concept
label
every node has a label (except root)
domain name
the list of labels, starting at that node,
working up to the root, using a . to separate
psu.ac.th, cs.psu.ac.th
domain name that ends with a period
absolute domain name
www.cs.psu.ac.th.
www
name to be completed
relative domain name
www
9Domains
domain
subtree of the domain name space
ac.th domain
psu.ac.th domain
cs
eng
www
www.cs.psu.ac.th node
10Domains and Zones
- Zone is a subtree for which naming authority has
been delegated
psu.ac.th domain
psu.ac.th domain
psu.ac.th zone
psu.ac.th zone
cc
cc
mgt
cs
case 1 single DNS administration
case 2 cs and cc have authority
for their zones
11Name Servers
- Name server Server that store information about
the zone
ns.cc.psu.ac.th
ns.psu.ac.th
responsibility for cc.psu.ac.th zone
cc
responsibility for psu.ac.th zone
ns.cs.psu.ac.th
cs
responsibility for Cs.psu.ac.th zone
12Type of Name Servers
- Primary Name server gets the data for zones from
files on the host it runs on - Secondary Name server gets its zone data from the
primary for redundancy and workload distribution
13Zone Transfer
- Secondary Name Server pulls zone data over from
the primary called zone transfer.
ns.eng.ku.ac.th
primary for eng.ku.ac.th secondary for
ku.ac.th secondary for cpe.ku.ac.th
ns.ku.ac.th
primary for ku.ac.th secondary for cpe.ku.ac.th
ns2.eng.ku.ac.th
secondary for eng.ku.ac.th
nontri.ku.ac.th
secondary for ku.ac.th secondary for cpe.ku.ac.th
ns.cpe.ku.ac.th
primary for cpe.ku.ac.th secondary for
ku.ac.th secondary for eng.ku.ac.th
cc2.cpe.ku.ac.th
secondary for cpe.ku.ac.th
14Root Name Server
- name server must contact other name servers for
non local IP - it has to know IP address of the top most server
called root name server - root name server - provide the names and address
of the name server authoritative for top level
domain name
15Root Name Server
- 13 root servers are currently available in
Internet
A.ROOT-SERVERS.NET 198.41.0.4 B.ROOT-SERVERS.NET
128.9.0.107 C.ROOT-SERVERS.NET
192.33.4.12 D.ROOT-SERVERS.NET
128.8.10.90 E.ROOT-SERVERS.NET
192.203.230.10 F.ROOT-SERVERS.NET
192.5.5.241 G.ROOT-SERVERS.NET 192.112.36.4
H.ROOT-SERVERS.NET 128.63.2.53 I.ROOT-SERVERS.NE
T 192.36.148.17 J.ROOT-SERVERS.NET
198.41.0.10 K.ROOT-SERVERS.NET
193.0.14.129 L.ROOT-SERVERS.NET
198.32.64.12 M.ROOT-SERVERS.NET 202.12.27.33
http//www.icann.org/committees/dns-root/y2k-state
ment.htm
16Name Resolution Process
address of www.psu.ac.th?
name server
root name server
ask th name servers
address of www.psu.ac.th?
th name server
ask ac.th name servers
address of www.psu.ac.th?
ac.th name server
ask psu.ac.th name server
address of www.psu.ac.th?
psu.ac.th name server
ask ns.psu.ac.th name server
address of www.psu.ac.th?
ns.psu.ac.th name server
www
address is 192.168.100.61
address is 192.168.100.61
resolver
address of www.psu.ac.th?
17Reverse Resolution
root
- in-addr.arpa domainin reverse directionof IP
address
0
255
192
255
0
168
255
0
100
0
255
www. psu.ac.th
61
61.100.168.192.in-addr.arpa
18Caching
- all name servers employ a cache to reduce the DNS
traffic - standard UNIX keep cache in name server with
time-out - cache data is non-authoritative
19DNS message format
- fixed 12 byte header with 4 variable length
fields - DNS message format is defined for both queries
and answers
0 15
16
31
identification16
flags16
number of questions 16
number of answer RRs16
fixed header
number of authority RRs 16 number of
additional RRs16
1 or more questions
query
1 or more answers
1 or more authority
reply
1 or more additional information
20DNS message format detail
0 15
16
31
Identification 16
Flags 16
- set by the client and return by the server
- lets the client match responses to requests
21DNS message format detail
identification16
flags16
QR opcode AA TC RD RA (zero)
rcode
1 4 1 1 1
1 3 4
QR 0 query, 1 response
opcode 0 standard query, 1inverse query,
2server status request
AA 0 authoritatived answer,1 non
authoritatived answer
TC 1 truncated. using UDP, reply
wasgt512 bytes, return only 512 bytes
RD 1 recursive desired, 0 iterative
RA 1 recursion available (server
support recursion)
rcode return code 0no error, 3name error
22DNS message format detail
questions 32
query name
- query class normally 1 meaning Internet
address
query type query class
- query name is the name being lookup
- sequence of label begins with 1-byte count
3www2cs3psu2ac2th0
A 1 IP address
- query type indicates desired response
NS 2 name server
CNAME 5 canonical name
PTR 12 pointer record
HINFO 13 host info
MX 15 mail exchange record
23DNS message format detail
these three fields share a common resource
record (RR)
1 or more answers 1 or more authority 1 or more
additional information
reply
domain name type
class time-to-live resource data
resource length
- domain name corresp. response name, (query
name format) - type response RR type code
(see query type) - time-to-live cache life time of RR (often
864001 day) - resource length specify the size of resource
data - resource data the answer, e.g. IP address or
other type
24Operation
- use port 53
- typically UDP request and reply
- if answer is too big, use TCP
ip hdr UDP hdr DNS hdr query
answer1 answer2
25Resolves file
- resolver must have address for local name server
- /etc/resolv.conf on UNIX
- /etc/resolv.conf
- domain
- domain cs.psu.ac.th
- list of name server
- 192.100.77.5
- 192.100.77.2
26Setting up DNS
- BIND (Berkeley Internet Name Domain) package
- /usr/somewhere/in.named - BSD named DNS server
- /etc/named.boot - named configuration (tell named
where to find database files)