Lecture 11 Application layer


Published on

Details about different protocol working at application layer.

Published in: Education, Technology
1 Like
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Lecture 11 Application layer

  1. 1. Application Layer End of Saga
  2. 2. Content • Domain Name Service • Electronic Mail • World Wide Web
  3. 3. DNS • • • • • What is DNS? What services does it provide? How does it operate? Message format Types of messages
  4. 4. What is DNS? • DNS is a host name to IP address translation service • DNS is – a distributed database implemented in a hierarchy of name servers – an application level protocol for message exchange between clients and servers
  5. 5. Why DNS? • It is easier to remember a host name than it is to remember an IP address. • An name has more meaning to a user than a 4 byte number. • Applications such as FTP, HTTP, email, etc., all require the user to input a destination. • The user generally enters a host name. • The application takes the host name supplied by the user and forwards it to DNS for translation to an IP address.
  6. 6. DNS Services • Besides the address translation service, DNS also provides the following services: – Host aliasing: a host with a complicated name can have one or more aliases that are simpler to remember , e.g., relay1.west-coast.media.com -> media.com. The longer name is the canonical hostname, the shorter the alias hostname.
  7. 7. DNS Services (cont’d) – Mail server aliasing: same as above, aliases can exist for long canonical host names. – Load Balancing: a set of servers can have one name mapped onto several machines. DNS provides the full list of names to the end user’s application which generally takes the first one in the list. DNS rotates the names on the list.
  8. 8. How does it work? • DNS works by exchanging messages between client and server machines. • A client application will pass the destination host name to the DNS process (in Unix referred to as the gethostbyname() routine) to get the IP address. • The application then sits and waits for the response to return.
  9. 9. DNS Why not centralize DNS? • single point of failure • traffic volume • distant centralized database • maintenance doesn’t scale!
  10. 10. Distributed, Hierarchical Database Root DNS Servers com DNS servers yahoo.com amazon.com DNS servers DNS servers org DNS servers pbs.org DNS servers edu DNS servers poly.edu umass.edu DNS serversDNS servers 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
  11. 11. 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 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) e NASA Mt View, CA f Internet Software C. Palo Alto, k RIPE London (also 16 other locations) i Autonomica, Stockholm (plus 28 other locations) m WIDE Tokyo (also Seoul, Paris, SF) CA (and 36 other locations) 13 root name servers worldwide b USC-ISI Marina del Rey, CA l ICANN Los Angeles, CA
  12. 12. 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
  13. 13. 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
  14. 14. DNS Queries • Recursive: – The client machine sends a request to the local name server, which, if it does not find the address in its database, sends a request to the root name server, which, in turn, will route the query to an intermediate or authoritative name server. Note that the root name server can contain some hostname to IP address mappings. The intermediate name server always knows who the authoritative name server is.
  15. 15. DNS Queries (cont’d) • Iterative: – The local server queries the root server. If address not in its database, will have the name/address of an intermediate or authoritative name server and forward that information to the local name server so that it can directly communicate with the intermediate or authoritative name server. This is to prevent the overloading of the root servers that handle millions of requests.
  16. 16. 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
  17. 17. Operation of DNS • DNS uses caching to increase the speed with which it does the translation. • The DNS data is stored in the database in the form of resource records (RR). The RRs are directly inserted in the DNS messages. • The RRs are a 4 tuple that consist of: {name, value, type, TTL}.
  18. 18. Resource Records DNS: distributed db storing resource records (RR) RR format: (name, value, type, ttl) o Type=A o name is hostname o value is IP address o Type=CNAME o name is alias name for some “canonical” (the real) name, eg., www.ibm.com is really servereast.backup2.ibm.com o o Type=NS o name is domain (eg., foo.com) o value is hostname of authoritative name server for this domain value is canonical name o Type=MX o value is name of mailserver associated with name
  19. 19. Summary • DNS provides a mechanism for maintaining the user friendliness of the Internet by hiding some of the operational details. • DNS servers have to be created manually. Recently an update protocol was introduced that allows DNS to exchange data for additions and deletions.
  20. 20. E - Mail • Electronic mail is among the most widely available application services. Each user, who intends to participate in email communication, is assigned a mailbox, where out-going and incoming messages are buffered, allowing the transfer to take place in the background.
  21. 21. Electronic Mail outgoing message queue user mailbox Three major components: user agent  user agents   mail reader composing, editing, reading mail messages mail server SMTP  mail servers   mailbox contains incoming messages for user message queue of outgoing (to be sent) mail messages  simple mail transfer protocol: SMTP  to send email messages between mail servers SMTP mail server user agent SMTP user agent user agent mail server user agent user agent
  22. 22. Electronic Mail: SMTP [RFC 2821]  uses TCP to reliably transfer email message from client to server, port 25  direct transfer: sending server to receiving server  three phases of transfer  handshaking (greeting)  transfer of messages  closure  command/response interaction  commands: ASCII text  response: status code and phrase  messages must be in 7-bit ASCII
  23. 23. Scenario: Alice sends message to Bob 1) Alice uses UA to compose message and “to” bob@someschool.edu 2) Alice’s UA sends message to her mail server; message placed in message queue 3) Client side of SMTP opens TCP connection with Bob’s mail server 4) SMTP client sends Alice’s message over the TCP connection 5) Bob’s mail server places the message in Bob’s mailbox 6) Bob invokes his user agent to read message 1 user agent 2 mail server 3 mail server 4 5 6 user agent
  24. 24. Mail message format SMTP: protocol for exchanging email msgs RFC 822: standard for text message format:  header lines, e.g.,    To: From: Subject: header different from SMTP commands!  body the “message”, ASCII characters only  body blank line
  25. 25. Message format: multimedia extensions  MIME: multimedia mail extension, RFC 2045, 2056  additional lines in msg header declare MIME content type MIME version method used to encode data multimedia data type, subtype, parameter declaration encoded data From: alice@crepes.fr To: bob@hamburger.edu Subject: Picture of yummy crepe. MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Type: image/jpeg base64 encoded data ..... ......................... ......base64 encoded data
  26. 26. Mail access protocols user agent SMTP SMTP sender’s mail server access protocol user agent receiver’s mail server  SMTP: delivery/storage to receiver’s server  Mail access protocol: retrieval from server    POP: Post Office Protocol [RFC 1939] • authorization (agent <-->server) and download IMAP: Internet Mail Access Protocol [RFC 1730] • more features (more complex) • manipulation of stored msgs on server HTTP: gmail, Hotmail, Yahoo! Mail, etc.
  27. 27. Most Common Scenario
  28. 28. Web based E-mail
  29. 29. Post Office Protocol - 3
  30. 30. POP3 and IMAP More about POP3 • Previous example uses “download and delete” mode. • Bob cannot re-read e-mail if he changes client • “Download-and-keep”: copies of messages on different clients • POP3 is stateless across sessions IMAP • Keep all messages in one place: the server • Allows user to organize messages in folders • IMAP keeps user state across sessions: – names of folders and mappings between message IDs and folder name
  31. 31. WWW & HTTP
  32. 32. Web and HTTP First some jargon • Web page consists of objects • Object can be HTML file, JPEG image, Java applet, audio file,… • Web page consists of base HTML-file which includes several referenced objects • Each object is addressable by a URL • Example URL: www.someschool.edu/someDept/pic.gif host name path name
  33. 33. WWW Architecture
  34. 34. HTTP overview HTTP: hypertext transfer protocol • Web’s application layer protocol • client/server model – client: browser that requests, receives, “displays” Web objects – server: Web server sends objects in response to requests PC running Explorer Server running Apache Web server Mac running Navigator
  35. 35. HTTP overview (continued) Uses TCP: HTTP is “stateless” • client initiates TCP connection (creates socket) to server, port 80 • server accepts TCP connection from client • HTTP messages (applicationlayer protocol messages) exchanged between browser (HTTP client) and Web server (HTTP server) • TCP connection closed • server maintains no information about past client requests aside Protocols that maintain “state” are complex!  past history (state) must be maintained  if server/client crashes, their views of “state” may be inconsistent, must be reconciled
  36. 36. URLs – Uniform Resource Locaters Some common URLs.
  37. 37. HTTP Command
  38. 38. Static Web Pages
  39. 39. Dynamic Pages
  40. 40. Dynamic Pages