37
© Janice Regan, CMPT 128, 2007-2012 CMPT 371 Data Communications and Networking DNS 1

CMPT 371

  • Upload
    mary

  • View
    41

  • Download
    0

Embed Size (px)

DESCRIPTION

CMPT 371. Data Communications and Networking DNS. jpl.nasa.gov. . edu. gov. us. com. ca. uk. arpa. fr. In-addr. ny. sun. hp. nasa. ca. sfu . bc. fraser. jpl. fraser. cs. Zone. An administrative division of the domain name tree - PowerPoint PPT Presentation

Citation preview

Page 1: CMPT 371

© Janice Regan, CMPT 128, 2007-2012

CMPT 371Data Communications and Networking

DNS

1

Page 2: CMPT 371

jpl.nasa.gov.

Janice Regan © 2007-2012 2

.

cs

arpa com edu gov us uk ca fr

bcsfu

fraser

In-addr nycasun nasa

jpl

hp

fraser

Page 3: CMPT 371

Zone An administrative division of the domain name

tree Each zone is the responsibility of one administrative

authority A zone may include hosts and sub-domains Sub domains in a zone may or may not have authority

delegated to other administrative authorities. Any subset of sub-domains may be delegated

Janice Regan © 2007-2012 3

Page 4: CMPT 371

DNS Name Tree: zones

Janice Regan © 2007-2012 4

bc ab on qc

.ca .ca domain

sk

sk.ca zone

qc.ca zone

.ca zone

Page 5: CMPT 371

Authority for the DNS namespace A particular DNS name server will service a zone.

Its database of zone information will contain entries for any hosts or subdomains in the zone delegation information for subdomains or zones that

have been delegated to other authorities (form their own zones) Includes the address of (pointer to) the DNS

servers for the delegated domains or zones excludes information about further delegation of

authority in delegated zones or hosts in delegated domains

Janice Regan © 2007-2012 5

Page 6: CMPT 371

Operation of a DNS server A DNS name server is initialized knowing the

contents of its zone information database. The zone information database includes

Address (A) and possible alias (CNAME) records for each host in the serviced zones

Name Server (NS) records for each DNS server in the zone

Mail server (MX) records specify hosts that will process and forward mail for the zone and their priority

Each record includes a time to live (TTL) Lifetime (TTL) of each record is set by administrator

Janice Regan © 2007-2012 6

Page 7: CMPT 371

Operation of a DNS server When a request is made to a DNS server the

answer it supplies consists of some of the records in the zone information database The TTL of each supplied record tells the requestor

how long the information in that record will remain valid

Janice Regan © 2007-2012 7

Page 8: CMPT 371

Caching and TTL Each DNS server uses a cache to improve its efficiency At initialization time the cache is empty Each time a DNS query is made by the DNS server, the

records in the resulting response are cached Over time the size of the cache increases as more

information from varied queries is added. To keep the size of the cache manageable and the

contents of the cache up to date (information is dynamic and changes over time) each entry in the cache must eventually (after the TTL has expired) be removed from the cache

Janice Regan © 2007-2012 8

Page 9: CMPT 371

Authoritative responses Each time a DNS query is received by the server

The records in the cache are searched The zone database is searched The longest match is found (either from the database or

the cache) and returned to the source of the query

If the answer is returned from the zone database the answer is known as an authoritative response

If the answer is returned from the cache it is NOT authoritative

Janice Regan © 2007-2012 9

Page 10: CMPT 371

DNS There are two approaches to answering a

query Iterative: the name server receiving the

query responds with either the IP address of the host or the name of the next server it would consult (next higher server in the tree)

Recursive: the name server will, if necessary, directly query the next name server, and will return the final answer

Janice Regan © 2007-2012 10

Page 11: CMPT 371

A host submitting a query (1) An application or user on host Drab, in domain

cs.sfu.ca requests IP address for ftp.isc.org The application or user or the user expects to

receive the IP address of ftp.isc.org without making additional queries. The application will make a request by calling a

function ( gethostbyname() ) OR the user will make a request using a resolver

(resolving software such as dig or nslookup)

Janice Regan © 2007-2012 11

Page 12: CMPT 371

A host submitting a query (2) An application or user on host Drab, in domain

cs.sfu.ca sends a request to the local DNS server for the IP address for ftp.isc.org

This request may require the local DNS server (may or may not be on host drab) to Make an additional request or requests. Analyze the reply or replies to the request/s Supply the resulting IP address and potentially other

related information to the requesting process or user.

Janice Regan © 2007-2012 12

Page 13: CMPT 371

Query from local DNS server Assume that we begin with a cache containing only the

addresses of the root servers. The local DNS server must then determine the desired IP

address. It will make a series of iterative requests for information on the address of ftp.isc.org.

The local DNS server will send a request to one of the root servers. The longest match the root server can make will be to the TLD .org (as .org has been delegated)

The root server will send back a response with the IP address and name of an authoritative server for the .org domain (plus other information)

Janice Regan © 2007-2012 13

Page 14: CMPT 371

Query from the local DNS server: 2 The local DNS server will process the returned

data, add the record for the DNS server for the .org domain to the cache, and formulate a request to the DNS server for the .org domain

The local DNS server will send a request to one of the DNS servers for the domain .org The DNS server for the domain .org will send back a

response with the IP address and name (plus other information) of an authoritative server for the isc.org domain. The isc.org domain has been delegated by the .org DNS server to the ISC, so no longer domain name match can be made.

Janice Regan © 2007-2012 14

Page 15: CMPT 371

Query from the local DNS server: 3

The local DNS server will process the returned data, add the DNS server for the isc.org domain to the cache, and formulate a request to the DNS server for the isc.org domain

The local DNS server will send a request to one of the DNS servers for the domain isc.org The DNS server for the domain isc.org will send

back a response with the IP address and name (plus other information) of ftp.isc.org.

The local DNS server will process the returned data, add an entry for the ftp.isc.org to the cache formulate and send a reply to the original

request from host DrabJanice Regan © 2007-2012 15

Page 16: CMPT 371

DNS Query

Janice Regan © 2007-2012 16

Iterative queryApplication or user

Local DNS server Root DNS server

DNS server for .org

DNS server for isc.org

Referred to .org

Referred to isc.org

IP Address of ftp.isc.orgRecursive

replyRecursive query

all queries/replies are for the address of ftp.isc.org

Page 17: CMPT 371

Using the Cache: subsequent queries (1) A later query to ftp.isc.org will find the IP address

available in the local DNS servers cache. The DNS server will send back the results without making further queries

A later query to ftp2.isc.org will find the entry for isc.org DNS server in the cache of the local DNS server. A single query to the isc.org DNS server will provide the needed information

Janice Regan © 2007-2012 17

Page 18: CMPT 371

Using the Cache: subsequent queries (2)

A later query to fbt.nas.org will find the entry for org DNS server in the cache of the local DNS server. A query to the org DNS server will provide the address of the nas.org server and a request tho the nas.org server will supply the needed information

Janice Regan © 2007-2012 18

Page 19: CMPT 371

Recursive Requests In the example above the process or user on the

host made a recursive request, and the DNS server made only iterative requests.

DNS servers can also make recursive requests. However, busy DNS servers are often configured to accept only iterative requests. (this way they do not need to process the returning results as well, this reduces load on the busy server). Therefore, the iterative approach is more commonly used by DNS servers

Janice Regan © 2007-2012 19

Page 20: CMPT 371

20

Domain Server Message Messages exchanged between clients and servers

Janice Regan © 2007-2012Comer 2000: fig 24.5

Page 21: CMPT 371

Example using dig: 1jregan15: dig ftp.isc.org; <<>> DiG 9.2.1 <<>> ftp.isc.org;; global options: printcmd;; Got answer:;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 33180;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 4, ADDITIONAL: 5

;; QUESTION SECTION:;ftp.isc.org. IN A

;; ANSWER SECTION:ftp.isc.org. 2898 IN A 204.152.184.110

;; AUTHORITY SECTION:isc.org. 2898 IN NS ns-ext.lga1.isc.org.isc.org. 2898 IN NS ns-ext.nrt1.isc.org.isc.org. 2898 IN NS ns-ext.sth1.isc.org.isc.org. 2898 IN NS ns-ext.isc.org.

Janice Regan © 2007-2012 21

Page 22: CMPT 371

Example using dig: 2;; ADDITIONAL SECTION:ns-ext.lga1.isc.org. 75012 IN A 192.228.91.19ns-ext.nrt1.isc.org. 75012 IN A 192.228.90.19ns-ext.sth1.isc.org. 75012 IN A 192.228.89.19ns-ext.isc.org. 29497 IN A 204.152.184.64ns-ext.isc.org. 155246 IN AAAA 2001:4f8:0:2::13

;; Query time: 1 msec;; SERVER: 199.60.1.1#53(199.60.1.1);; WHEN: Fri Nov 5 06:21:09 2004;; MSG SIZE rcvd: 236

Janice Regan © 2007-2012 22

Page 23: CMPT 371

© Janice Regan, CMPT 128, 2007-2012

CMPT 371Data Communications and Networking

P2P

23

Page 24: CMPT 371

Comparison All the application layer protocols considered so

far use client server architecture Now let’s consider peer to peer architecture

To understand why we would want to take this alternate approach lets consider transmitting a large file from one host to several others using both approaches.

Janice Regan © 2007-2012 24

Page 25: CMPT 371

How long? One server to N clients

Janice Regan © 2007-2012 25

DR1

U1

DR2 Internet

US U2

U3U4

U5

UN

D1

D2

D3

D4D5

DN

Page 26: CMPT 371

How long to send to all clients The server must send one copy of the file to

each of the clients. The file has F bits and the rate of transmission from the server to the internet is Us. Each copy will take F/ Us seconds to transmit into the

internet. Transmitting all N copies will take N*F/ Us seconds

But the clients also need to receive their copies

Janice Regan © 2007-2012 26

Page 27: CMPT 371

How long to receive all copies The longest time for any particular host to

download the file from the internet is for the host with the slowest download rate Dmin. This host will take F/Dmin seconds to download

If we send to each host at the rate that host can receive (alternating blocks of bits between hosts) then the maximum download time for all files is F/Dmin seconds

Janice Regan © 2007-2012 27

Page 28: CMPT 371

How long 1 server - nclients Consider that the server distributes its delivery of bits in

proportion the download rate of each host. If the host that has the longest download time receives

bits at a minimum of the download rate then the time to distribute the file to all clients is F/Dmin seconds

If bits arrive more slowly that the download rate of the slowest downloading host then the time to distribute the file to all hosts will be N*F/ Us the time taken to transmit the N copies of the file

Download Time = max {F/Dmin , N*F/ Us }

Janice Regan © 2007-2012 28

Page 29: CMPT 371

How long? P2P

Janice Regan © 2007-2012 29

DR1

U1

DR2 Internet

US U2

U3U4

U5

UN

D1

D2

D3

D4D5

DN

Page 30: CMPT 371

How long to send using P2P The server must send at least one copy of the

file to the peers. This takes F/Us seconds The slowest peer must have time to download

all the bits in the file. This takes F/Dmin seconds The fastest that any host can receive uploads is

so the fastest all hosts can receive the uploaded files is

Janice Regan © 2007-2012 30

N

iis UU

1

N

iis

s UU

NFD

FUF

1

min

,,max

Page 31: CMPT 371

Janice Regan © 2007-2012 31From Kurose and Ross

Page 32: CMPT 371

Bit torrent: TRADE DATA CHUNKS

Janice Regan © 2007-2012 32

NEWEST HOST IN TORRENT

tracker: tracks peersparticipating in torrent

Page 33: CMPT 371

What is a bit torrent A TORRENT is a group of peers exchanging

portions (chunks) of a file A Torrent is controlled by a TRAKKER, a host

managing the peers trading chunks of file The file being exchanged is divided into chunks

(512K) Peers taking part in the trading of chunks may

join the group at and time and leave the group after obtaining all or any part of the file

Janice Regan © 2007-2012 33

Page 34: CMPT 371

How does a torrent work (1) A peer “Mew” joins a torrent to obtain a file “Mew” starts with none of the chunks of the file

She registers with the tracker She gets list of potential peers from the tracker. The

trakker selects a subset of all available peers. She tries to establish TCP connections with all of the

peers from the list the tracker supplied She establishes connection with a subset of the peers

from the list the tracker provided. Call these peers the neighboring peers

Janice Regan © 2007-2012 34

Page 35: CMPT 371

How does a torrent work (2) As time passes

The peer “Mew” will periodically check with t he tracker to confirm she is still part of the torrent

The peer “Mew” will acquire chunks of the file by downloading them from other neighboring peers

The peer “Mew” will upload chunks of the file it already has to neighboring peers that need those chunks

Chunks are not necessarily acquired or supplied in order

Janice Regan © 2007-2012 35

Page 36: CMPT 371

Acquiring Chunks At a particular time different peers will each

have a different subset of the chunks of the file At any time a peer can obtain a list of which

available chunks from each neighboring peer The peer “Mew” can thus find the chunks she needs The peer “Mew” can obtain the chunks she needs by

sending requests to the neighboring peers that have those chunks

Peers will usually request the chunks that are hardest to find first (to equalize the availability of those chunks)

Janice Regan © 2007-2012 36

Page 37: CMPT 371

Trading Algorithm (tit for tat)

Every 10 seconds “Mew” measures which four neighboring peers are supplying her data at the highest rate

“Mew” unchokes those four neighboring peers by sending them chunks they have requested.

Every 30 seconds she also optimistically unchokes one randomly chosen neighboring peer by sending that peer chunks

The optimistically unchoked neighboring peer may then become one of “Mew”s trading partners

Janice Regan © 2007-2012 37