Вы находитесь на странице: 1из 11

DNS

The Domain Name System (DNS)


Prof. Jean-Yves Le Boudec Prof. Andrzej Duda ICA, EPFL
CH-1015 Ecublens http://lcawww.epfl.ch

Domain Name System: DNS


o Objective of DNS
l l l l l

support user friendly naming of resources: computers, printers, mailboxes, hide IP address changes distribute naming authority distribute the database used primarily for system names and email domain name: high level identifier; eg. lrcsuns IP address: low level identifier
related to routing, physical topology

o Names and addresses


l l l

ssc.epfl.ch

level 2 addresses: low level identifiers


MAC address: serial number of communication interface ATM address: combination of MAC and route related address

email address: high level address used for email eg. gwen.nedeleg@ssc.epfl.ch
email addresses are mapped to domain names: gwen.nedeleg@ssc.epfl.ch -> gwen\.nedeleg.ssc.epfl.ch

DNS

telnet disun3 1 lrcsuns application program name resolver 3

DNS Example
IP dest addr = 129.178.15.7 protocol = UDP source port = 1267 dest port = 53 DNS message = header = query, question = (QNAME=disun3.epfl.ch. QTYPE=A) DNS query DNS answer 2 stisun1

name server IP dest addr = 129.178.156.24 protocol = UDP source port = 53 dest port = 1267 DNS message = header = response, AA question = (QNAME=disun3.epfl.ch. QTYPE=A) answer = (disun3.epfl.ch. TTL=86400 TYPE=A 128.178.79.9) zone data (authoritative data) RR type A = IPv4 addr AAAA = IPv6 addr

resolv.conf nameserver 129.178.15.7 nameserver 129.178.15.8 domain epfl.ch

disun3.epfl.ch. 86400 A 128.178.79.9 in-inr.epfl.ch. 86400 A 128.178.156.1 86400 A 128.178.182.5 cached data (non-authoritative data)

Resource Records (RRs) keyed by domain names

ezinfo.ethz.ch.

1770 A 129.132.2.72

Domain Name Tree


root generic domains arpa top level domains country domains ch us za epfl ssc

int com edu gov mil net org firm store web arts rec info nom 2nd level domains ibm zurich ethz ee tik www

in-addr IP6 128 178 156

lrcsuns

gwen\.nedeleg

jachen\.carigiet lrcsuns.epfl.ch

24 24.156.178.128.in-addr.arpa

l l l

every node on the tree represents one or a set of resources every node on the tree has a label (lrcsuns) and a domain name (lrcsuns.epfl.ch) domain name = sequence of labels, 64 bytes per label
examples: www.zurich.ibm.com, lrcsuns.epfl.ch, ezinfo.ethz.ch,
ee.ethz.ch

names have the same syntax for subdomains or individual resources

DNS

Name Authority
o hierarchical name authority
l l

top level: Internic any organization can apply to become authority for a subdomain examples:
SWITCH for ch. and li. EPFL for epfl.ch.

any authority can create subdomains and delegate recursively unilaterally definition: zone = a connected subset of nodes property: a zone has one single node closest to the root (top node, used to name the
zone))

o zones:
l

l l

definition: zone Z1 is a subzone (or child) of zone Z0 iff the top node of Z1 is connected to a node in Z0; name authority matches zone boundaries:
names and subzones, can be created and deleted by the authority responsible for a zone; examples:
l l

zurich.ibm.com is a subzone of ibm.com zone zurich.ibm.com. has authority delegation from ibm.com.

Fully Qualified Domain Names


l

complete domain name = fully qualified domain name (FQDN)


ends with a period (.) trailing period usually hidden by the user interface software

incomplete names are completed by local resolver


add period: www.zurich.ibm.com -> www.zurich.ibm.com. or add local domain suffix: lrcsuns -> lrcsuns.epfl.ch.

DNS

The DNS distributed database


o DNS offers one distributed world-wide database
l l

distributed according to the zone concept: every zone has a master file describing all records under the zones authority name servers hold their part of the database
for one zone, at least two name servers have the zone information, copied from master file
l

example: stisun1.epfl.ch, stisun2.epfl.ch; dns1.ethz.ch, dns2.ethz.ch

zone information held by the name server is called authoritative data one name server may hold zone data for one or more zones
l l

zone data contains pointers to name servers holding authoritative data for subzones all name servers know IP addresses of root servers (name servers for the top level zones)

Query Processing and Cached Data


o query processing
l l

resolver associated with an application sends a query to a name server name server responds with answer or with pointer to another server
example: question www.zurich.ibm.com. A from a node at EPFL; response is a pointer to a name server responsible for zone ibm.com.

o query processing can be


l l

iterative recursive: server responds with final answer


server acts as an intermediate resolver recursive operation only if requested in query and server accepts it root servers never support recursive operation

o name servers usually cache some information for nodes outside their zones
l l l

recently obtained informationis cached when acting recursively every record has a TTL field (ex: 1 day) used for cache management cached data is not authoritative

DNS

2 stisun1 name server 3 4 root name server

Example: Query Processing


1

lrcsuns resolver 6

5 query, RD=yes question = www.zurich.ibm.com.

watson ibm.com.

2,4 query, RD=no question = www.zurich.ibm.com. 3

answer question = www.zurich.ibm.com. A answer = autority= ibm.com. NS watson.ibm.com. NS ns.austin.ibm.com. NS ns.almaden.ibm.com. additional=watson.ibm.com. A 192.35.232.34 ns.austin.ibm.com. A 129.34.139.4 ns.almaden.ibm.com A 198.4.83.134

5,6 answer question = www.zurich.ibm.com. answer = www.zurich.ibm.com.

A 193.5.61.131

10

Replication
o zone data is replicated in several servers responsible for the zone
l l

primary server holds master file on disk secondary servers poll primary servers (ex: every 3 hours)
using the SERIAL field in zone data copying is called zone transfer; uses TCP (queries usually use UDP)

changes in zone data by system manager:


update master file signal primary name server to reload; new value of SERIAL field automatically created secondary servers will discover the change automatically

zone data in secondary servers is authoritative example: in which name servers can these RRs appear as zone or cache data:
disun3.epfl.ch. 86400 A 128.178.79.9

DNS

11

TYPE

value and meaning 1 Ipv4 address 2 an authoritative name server 5 the canonical name for an alias 6 marks the start of a zone of authority 12 a domain name pointer 13 host information 14 mailbox or mail list information 15 mail exchange 16 text strings 28 IPv6 address

Resource Record Types and Message Formats

A NS CNAME SOA PTR HINFO MINFO MX TXT AAAA

+---------------------+ | Header | +---------------------+ | Question | +---------------------+ | Answer | +---------------------+ | Authority | +---------------------+ | Additional | +---------------------+

the question for the name server RRs answering the question RRs pointing toward an authority RRs holding additional information

12

Examples of Records
o MX records: used by email application
l

example:
di.epfl.ch. di.epfl.ch. MX 10 dimail.epfl.ch. MX 20 disunmm2.epfl.ch.

possible use : ? example:


5.182.178.128.in-addr.arpa PTR in-inr 1.156.178.128.in-addr.arpa PTR in-inr
6.5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.5.6.3.0.3.0.0.0.1.4.0.0.e.a.4.0 PTR lrcpc3

o PTR records: inverse mapping IP addr -> domain name


l

l l

used for verifying names zone date should contain PTR records for all systems in the zone

o other records: ISDN number, ATM address (proposed)

DNS

13

Examples: Queries/ Answers

1 $ nslookup www.zurich.ibm.com Server: stisun1.epfl.ch Address: 128.178.15.8 Non-authoritative answer: Name: www.zurich.ibm.com Address: 193.5.61.131 2 $ nslookup -querytype=NS zurich.ibm.com 129.34.139.4 Server: watson.ibm.com Address: 129.34.139.4 zurich.ibm.com nameserver = ns1.zurich.ibm.ch zurich.ibm.com nameserver = watson.ibm.com ns1.zurich.ibm.ch internet address = 193.5.61.131 watson.ibm.com internet address = 129.34.139.4 3 $ nslookup -querytype=PTR 193.5.61.131 Server: stisun1.epfl.ch Address: 128.178.15.8 131.61.5.193.in-addr.arpa name = uetliberg.zurich.ibm.ch 61.5.193.in-addr.arpa nameserver = ns1.zurich.ibm.ch 61.5.193.in-addr.arpa nameserver = scsnms.switch.ch 61.5.193.in-addr.arpa nameserver = swidir.switch.ch ns1.zurich.ibm.ch internet address = 193.5.61.131 scsnms.switch.ch internet address = 130.59.10.30 scsnms.switch.ch internet address = 130.59.1.30 swidir.switch.ch internet address = 130.59.72.10

14

Example of Zone Data (ch.)

SOA scsnms.switch.ch, ch-zoneSOA scsnms.switch.ch, ch-zonecontact.switch.ch contact.switch.ch (serial == 1174 (serial 1174 refresh == 43200 ;(12 hours) refresh 43200 ;(12 hours) retry retry == 7200 ;(2 hours) 7200 ;(2 hours) expire == 2592000 ;(30 days) expire 2592000 ;(30 days) minimum ttl == 345600 ); (4 days) minimum ttl 345600 ); (4 days) ch NS scsnms.switch.ch NS scsnms.switch.ch NS swidir.switch.ch NS swidir.switch.ch NS dxmon.cern.ch epfl ethz switch NS dxmon.cern.ch NS ns.eu.net NS ns.eu.net Ns ns.uu.net Ns ns.uu.net NS princeton.edu exercice: NS princeton.edu epfl.ch. 86400 NS stisun1.epfl.ch epfl.ch. 86400 NS stisun1.epfl.ch where are the servers 86400 NS stisun2.epfl.ch 86400 NS stisun2.epfl.ch responsible for that zone ? ethz.ch. 86400 NS dns1.ethz.ch ethz.ch. 86400 NS dns1.ethz.ch 86400 NS bernina.ethz.ch 86400 NS bernina.ethz.ch what are the data indicating switch.ch 138200 NS scsnms.switch.ch switch.ch 138200 NS scsnms.switch.ch authority delegation ? 138200 NS swidir.switch.ch 138200 NS swidir.switch.ch AA 128.178.15.7 what records are authoritative ? stisun1.epfl.ch. stisun1.epfl.ch. 128.178.15.7 AA 128.178.100.7 128.178.100.7 what would change if ch. and stisun2.epfl.ch. AA 128.178.15.8 stisun2.epfl.ch. 128.178.15.8 switch.ch. were in the AA 128.178.100.8 128.178.100.8 same zone ? bernina.ethz.ch. AA 129.132.1.11 bernina.ethz.ch. 129.132.1.11 AA 129.132.98.11 129.132.98.11 what is the answer to a query scsnms.switch.ch. AA 130.59.1.30 scsnms.switch.ch. 130.59.1.30 scsnms.ethz.ch A scsnms.switch.ch. AA 130.59.10.30 scsnms.switch.ch. 130.59.10.30

DNS

15

Example of Zone Data (epfl.ch.)


ch epfl ethz switch

exercice:
where are the servers responsible for that zone ? what are the data indicating authority delegation ? what records are authoritative ? what is the answer to a query lrcwww.epfl.ch A

SOA stisun1.epfl.ch () SOA stisun1.epfl.ch () epfl.ch. NS stisun1.epfl.ch. epfl.ch. NS stisun1.epfl.ch. NS stisun2.epfl.ch NS stisun2.epfl.ch stisun1.epfl.ch. AA 128.178.15.7 stisun1.epfl.ch. 128.178.15.7 AA 128.178.100.7 128.178.100.7 stisun2.epfl.ch. AA 128.178.15.8 stisun2.epfl.ch. 128.178.15.8 AA 128.178.100.8 128.178.100.8 lrcsuns.epfl.ch AA 128.178.156.24 lrcsuns.epfl.ch 128.178.156.24 lrcwww.epfl.ch CNAME lrcsuns.epfl.ch lrcwww.epfl.ch CNAME lrcsuns.epfl.ch lrcftp.epfl.ch CNAME lrcsuns.epfl.ch lrcftp.epfl.ch CNAME lrcsuns.epfl.ch ssc.epfl.ch MX 10 sicmail.epfl.ch ssc.epfl.ch MX 10 sicmail.epfl.ch *.di.epfl.ch MX 10 sicmail.epfl.ch *.di.epfl.ch MX 10 sicmail.epfl.ch 24.156.178.128.in-addr.arpa PTR 24.156.178.128.in-addr.arpa PTR lrcsuns.epfl.ch lrcsuns.epfl.ch (other records )) (other records

16

Name Server Algorithm (1)


RFC 1034 says:

1. Set or clear the value of recursion available in the response depending on whether the name server is willing to provide recursive service. If recursive service is available and requested via the RD bit in the query, go to step 5, otherwise step 2. 2. Search the available zones for the zone which is the nearest ancestor to QNAME. If such a zone is found, go to step 3, otherwise step 4. 3. Start matching down, label by label, in the zone. The matching process can terminate several ways: a. If the whole of QNAME is matched, we have found the node. If the data at the node is a CNAME, and QTYPE doesn't match CNAME, copy the CNAME RR into the answer section of the response, change QNAME to the canonical name in the CNAME RR, and go back to step 1. Otherwise, copy all RRs which match QTYPE into the answer section and go to step 6. b. If a match would take us out of the authoritative data, we have a referral. This happens when we encounter a node with NS RRs marking cuts along the bottom of a zone. Copy the NS RRs for the subzone into the authority section of the reply. Put whatever addresses are available into the additional section, using glue RRs if the addresses are not available from authoritative data or the cache. Go to step 4.

DNS

17

Name Server Algorithm (2)

c. If at some label, a match is impossible (i.e., the corresponding label does not exist), look to see if a the "*" label exists. If the "*" label does not exist, check whether the name we are looking for is the original QNAME in the query or a name we have followed due to a CNAME. If the name is original, set an authoritative name error in the response and exit. Otherwise just exit. If the "*" label does exist, match RRs at that node against QTYPE. If any match, copy them into the answer section, but set the owner of the RR to be QNAME, and not the node with the "*" label. Go to step 6. 4. Start matching down in the cache. If QNAME is found in the cache, copy all RRs attached to it that match QTYPE into the answer section. If there was no delegation from authoritative data, look for the best one from the cache, and put it in the authority section. Go to step 6. 5. Using the local resolver or a copy of its algorithm (see resolver section of this memo) to answer the query. Store the results, including any intermediate CNAMEs, in the answer section of the response. 6. Using local data only, attempt to add other RRs which may be useful to the additional section of the query. Exit.

18

Name Resolution
o Application requests name resolution on local host
l

resolver sends query to name server /etc/resolv.conf on many systems points to the name server if no pointer, then local host activates its own name server
resolver usually requests recursive query response is processed until an answer is found

l l

name server acting recursively plays the role of a resolver for that query host resolvers usually do not cache responses (stub resolvers), but name servers do (full resolvers)

DNS

19

DNS Components Overview


query stisun1 query User Program lrcsuns Stub Resolver recursive query Master File resp. Full Resolver response Foreign Name Server

cache addition

reference Foreign Resolver

Shared Database refresh

query

reference response disun3 Stub Resolver recursive query Name Server

response

stisun2 response maintenance query/response Other Name Server for same zone(s)

20

References : DNS
o Halsall, chapter 13.2 o RFCs: 1032, 1033, 1034, 1035, 1591
o nslookup, host, resolver, named

DNS

21

NetBIOS
o Windows uses NetBIOS for transactions and distributed file system o NetBIOS is a programming interface (as Sockets is) which uses NetBIOS names instead of (IP address, port number)
l

example: ICARE, ICA118PC29

o name resolution was done originally by LAN broadcast o in modern installations, done by NetBIOS name server
l

WINS

22

DNS: Conclusion
o high level names
l l l

global world-wide decouple names used by humans from IP addresses


names not related to routing

decouple logical names from machine names loose consistency in records strict hierarchical database with zone concept high survivability thanks to replication within one zone caching to improve performance survivability and security are key issues

o distributed database with simple database mechanisms


l l l l

o DNS has become a key component of the Internet


l