Chapter 2: Application layer 2.1 Principles of network 2.6 P2P - - PowerPoint PPT Presentation

chapter 2 application layer
SMART_READER_LITE
LIVE PREVIEW

Chapter 2: Application layer 2.1 Principles of network 2.6 P2P - - PowerPoint PPT Presentation

Chapter 2: Application layer 2.1 Principles of network 2.6 P2P applications applications 2.7 Socket programming 2.2 Web and HTTP with TCP 2.3 FTP 2.8 Socket programming with UDP 2.4 Electronic Mail 2.9


slide-1
SLIDE 1

2: Application Layer 1

Chapter 2: Application layer

  • 2.1 Principles of network

applications

  • 2.2 Web and HTTP
  • 2.3 FTP
  • 2.4 Electronic Mail

– SMTP, POP3, IMAP

  • 2.5 DNS
  • 2.6 P2P applications
  • 2.7 Socket programming

with TCP

  • 2.8 Socket programming

with UDP

  • 2.9 Building a Web

server

slide-2
SLIDE 2

2: Application Layer 2

DNS: Domain Name System

People: many identifiers:

– SSN, name, passport #

Internet hosts, routers:

– IP address (32 bit) - used for addressing datagrams – “name”, e.g., ww.yahoo.com - used by humans

Q: map between IP addresses and name ? Domain Name System:

  • distributed database

implemented in hierarchy of many name servers

  • application-layer protocol

– host, routers, name servers communicate to resolve names (address/name translation)

  • note: core Internet function,

implemented as application- layer protocol

– complexity at network’s “edge”

slide-3
SLIDE 3

2: Application Layer 3

DNS

Why not centralize DNS?

  • single point of failure
  • traffic volume
  • distant centralized

database

  • maintenance

doesn’t scale!

DNS services

  • Hostname-to-IP

address translation

  • host aliasing

– Canonical, alias names

  • mail server aliasing
  • load distribution

– replicated Web servers: set of IP addresses for

  • ne canonical name
slide-4
SLIDE 4

2: Application Layer 4

Root DNS Servers com DNS servers

  • rg DNS servers

edu DNS servers poly.edu DNS servers umass.edu DNS servers yahoo.com DNS servers amazon.com DNS servers pbs.org DNS servers

Distributed, Hierarchical Database

Client wants IP for www.amazon.com; 1st approx:

  • client queries a root server to find com DNS server
  • client queries com DNS server to get amazon.com DNS

server

  • client queries amazon.com DNS server to get IP

address for www.amazon.com

slide-5
SLIDE 5

2: Application Layer 5

DNS: Root name servers

  • contacted by local name server that can not resolve name
  • root name server:

– contacts authoritative name server if name mapping not known – gets mapping – returns mapping to local name server 13 root name servers worldwide

b USC-ISI Marina del Rey, CA l ICANN Los Angeles, CA e NASA Mt View, CA f Internet Software C. Palo Alto,

CA (and 36 other locations)

i Autonomica, Stockholm (plus 28 other locations) k RIPE London (also 16 other locations) m WIDE Tokyo (also Seoul, Paris, SF) a Verisign, Dulles, VA c Cogent, Herndon, VA (also LA) d U Maryland College Park, MD g US DoD Vienna, VA h ARL Aberdeen, MD

j Verisign, ( 21 locations)

slide-6
SLIDE 6

2: Application Layer 6

TLD and Authoritative Servers

  • Top-level domain (TLD) servers:

– responsible for com, org, net, edu, etc, and all top-level country domains uk, fr, ca, jp. – Network Solutions maintains servers for com TLD – Educause for edu TLD

  • Authoritative DNS servers:

– organization’s DNS servers, providing authoritative hostname to IP mappings for organization’s servers (e.g., Web, mail). – can be maintained by organization or service provider

slide-7
SLIDE 7

2: Application Layer 7

Local Name Server

  • does not strictly belong to hierarchy
  • each ISP (residential ISP, company, university)

has one.

– also called “default name server”

  • when host makes DNS query, query is sent to its

local DNS server

– acts as proxy, forwards query into hierarchy

slide-8
SLIDE 8

2: Application Layer 8

requesting host

cis.poly.edu gaia.cs.umass.edu

root DNS server local DNS server

dns.poly.edu

1 2 3 4 5 6

authoritative DNS server dns.cs.umass.edu

7 8 TLD DNS server

DNS name resolution example

  • Host at cis.poly.edu

wants IP address for gaia.cs.umass.edu iterated query:

contacted server

replies with name of server to contact

“I don’t know this

name, but ask this server”

slide-9
SLIDE 9

2: Application Layer 9

requesting host

cis.poly.edu gaia.cs.umass.edu

root DNS server local DNS server

dns.poly.edu

1 2 3 4 5 6

authoritative DNS server dns.cs.umass.edu

7 8 TLD DNS server

  • Host at cis.poly.edu

wants IP address for gaia.cs.umass.edu iterated query:

contacted server

replies with name of server to contact

“I don’t know this

name, but ask this server”

DNS name resolution example

slide-10
SLIDE 10

2: Application Layer 10

requesting host

cis.poly.edu gaia.cs.umass.edu

root DNS server local DNS server

dns.poly.edu

1 2 4 5 6

authoritative DNS server dns.cs.umass.edu

7 8 TLD DNS server 3

recursive query:

puts burden of name

resolution on contacted name server

heavy load?

DNS name resolution example

slide-11
SLIDE 11

2: Application Layer 11

DNS: caching and updating records

  • once (any) name server learns mapping, it caches

mapping – cache entries timeout (disappear) after some time – TLD servers typically cached in local name servers

  • Thus root name servers not often visited
  • update/notify mechanisms under design by IETF

– RFC 2136

– http://www.ietf.org/html.charters/dnsind-charter.html

slide-12
SLIDE 12

2: Application Layer 12

DNS records

DNS: distributed db storing resource records (RR)

  • Type=NS

– name is domain (e.g. foo.com) – value is hostname of authoritative name server for this domain RR format: (name, value, type, ttl)

Type=A

name is hostname value is IP address

Type=CNAME

name is alias name for some

“canonical” (the real) name

www.ibm.com is really servereast.backup2.ibm.com

value is canonical name

Type=MX

value is name of mailserver

associated with name

slide-13
SLIDE 13

2: Application Layer 13

DNS protocol, messages

DNS protocol : query and reply messages, both with same message format msg header

identification: 16 bit #

for query, reply to query uses same #

flags:

query or reply recursion desired recursion available reply is authoritative

slide-14
SLIDE 14

2: Application Layer 14

DNS protocol, messages

Name, type fields for a query RRs in response to query records for authoritative servers additional “helpful” info that may be used

slide-15
SLIDE 15

2: Application Layer 15

DNS records

  • from wikipedia:

In computer networking, a zone file is a text file that describes a portion of the domain name system (DNS) called a DNS

  • zone. A zone contains information that defines mappings

between domain names and IP addresses and other resources, organized in the form of resource records (RR).

  • originally defined in RFC 1034, RFC 1035
  • Maintained by the DNS server
  • Some types:

A

– identifies the name’s address

– CNAME

– identifies the name’s “canonical name”

– MX

– identifies a mail-server for the domain

slide-16
SLIDE 16

two example zone files

$TTL 3600 ; 1 hour default TTL example.org. IN SOA ns1.example.org. admin.example.org. ( 2006051501 ; Serial 10800 ; Refresh 3600 ; Retry 604800 ; Expire 300 ; Negative Reponse TTL ) ; DNS Servers IN NS ns1.example.org. IN NS ns2.example.org. ; MX Records IN MX 10 mx.example.org. IN MX 20 mail.example.org. IN A 192.168.1.1 ; Machine Names localhost IN A 127.0.0.1 ns1 IN A 192.168.1.2 ns2 IN A 192.168.1.3 mx IN A 192.168.1.4 mail IN A 192.168.1.5 ; Aliases www IN CNAME example.org. $TTL 3600 ; 1 hour default TTL example.org. IN SOA ns1.example.org. admin.example.org. ( 2006051501 ; Serial 10800 ; Refresh 3600 ; Retry 604800 ; Expire 300 ; Negative Reponse TTL ) ; DNS Servers IN NS ns1.example.org. IN NS ns2.example.org. ; MX Records IN MX 10 mx.example.org. IN MX 20 mail.example.org. IN A 192.168.1.1 ; Machine Names localhost IN A 127.0.0.1 ns1 IN A 192.168.1.2 ns2 IN A 192.168.1.3 mx IN A 192.168.1.4 mail IN A 192.168.1.5 ; Aliases www IN CNAME example.org.

;; from website tldp.org/HOWTO/DNS-HOWTO-7.html

$TTL 3D @ IN SOA land‐5.com. root.land‐5.com. ( 199609206 ; serial, todays date + todays serial # 8H ; refresh, seconds 2H ; retry, seconds 4W ; expire, seconds 1D ) ; minimum, seconds NS land‐5.com. NS ns2.psi.net. MX 10 land‐5.com. ; Primary Mail Exchanger TXT "LAND‐5 Corporation" localhost A 127.0.0.1 router A 206.6.177.1 land‐5.com. A 206.6.177.2 ns A 206.6.177.3 www A 207.159.141.192 ftp CNAME land‐5.com. mail CNAME land‐5.com. news CNAME land‐5.com. funn A 206.6.177.2 ; ; Workstations ; ws‐177200 A 206.6.177.200 MX 10 land‐5.com. ; Primary Mail Host ws‐177201 A 206.6.177.201 MX 10 land‐5.com. ; Primary Mail Host ws‐177202 A 206.6.177.202 MX 10 land‐5.com. ; Primary Mail Host ws‐177203 A 206.6.177.203 MX 10 land‐5.com. ; Primary Mail Host ws‐177204 A 206.6.177.204 MX 10 land‐5.com. ; Primary Mail Host ws‐177205 A 206.6.177.205 MX 10 land‐5.com. ; Primary Mail Host ; {Many repetitive definitions deleted ‐ SNIP} ws‐177250 A 206.6.177.250 MX 10 land‐5.com. ; Primary Mail Host ws‐177251 A 206.6.177.251 MX 10 land‐5.com. ; Primary Mail Host ws‐177252 A 206.6.177.252 MX 10 land‐5.com. ; Primary Mail Host ws‐177253 A 206.6.177.253 MX 10 land‐5.com. ; Primary Mail Host ws‐177254 A 206.6.177.254 MX 10 land‐5.com. ; Primary Mail Host

;; from website tldp.org/HOWTO/DNS-HOWTO-7.html

$TTL 3D @ IN SOA land‐5.com. root.land‐5.com. ( 199609206 ; serial, todays date + todays serial # 8H ; refresh, seconds 2H ; retry, seconds 4W ; expire, seconds 1D ) ; minimum, seconds NS land‐5.com. NS ns2.psi.net. MX 10 land‐5.com. ; Primary Mail Exchanger TXT "LAND‐5 Corporation" localhost A 127.0.0.1 router A 206.6.177.1 land‐5.com. A 206.6.177.2 ns A 206.6.177.3 www A 207.159.141.192 ftp CNAME land‐5.com. mail CNAME land‐5.com. news CNAME land‐5.com. funn A 206.6.177.2 ; ; Workstations ; ws‐177200 A 206.6.177.200 MX 10 land‐5.com. ; Primary Mail Host ws‐177201 A 206.6.177.201 MX 10 land‐5.com. ; Primary Mail Host ws‐177202 A 206.6.177.202 MX 10 land‐5.com. ; Primary Mail Host ws‐177203 A 206.6.177.203 MX 10 land‐5.com. ; Primary Mail Host ws‐177204 A 206.6.177.204 MX 10 land‐5.com. ; Primary Mail Host ws‐177205 A 206.6.177.205 MX 10 land‐5.com. ; Primary Mail Host ; {Many repetitive definitions deleted ‐ SNIP} ws‐177250 A 206.6.177.250 MX 10 land‐5.com. ; Primary Mail Host ws‐177251 A 206.6.177.251 MX 10 land‐5.com. ; Primary Mail Host ws‐177252 A 206.6.177.252 MX 10 land‐5.com. ; Primary Mail Host ws‐177253 A 206.6.177.253 MX 10 land‐5.com. ; Primary Mail Host ws‐177254 A 206.6.177.254 MX 10 land‐5.com. ; Primary Mail Host

slide-17
SLIDE 17

2: Application Layer 17

Inserting records into DNS

  • example: new startup “Network Utopia”
  • register name networkuptopia.com with a DNS

registrar organization(e.g., Network Solutions)

– provide names, IP addresses of authoritative name server (primary and secondary) – registrar inserts two RRs into .com TLD server: (networkutopia.com, dns1.networkutopia.com, NS) (dns1.networkutopia.com, 212.212.212.1, A)

  • create authoritative server Type A record for

www.networkuptopia.com; Type MX record for networkutopia.com

  • How do people get IP address of your Web site?
slide-18
SLIDE 18