week 5 lec 1-bit

Upload: mni007

Post on 03-Apr-2018

227 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/29/2019 Week 5 Lec 1-Bit

    1/23

    Chapter 2Application LayerComputer Networking:A Top Down Approach,4th edition.Jim Kurose, Keith RossAddison-Wesley, July2007.

  • 7/29/2019 Week 5 Lec 1-Bit

    2/23

    Last Lecture

    HTTP Request and Response

    MessagesHTTP state aware mechanism

  • 7/29/2019 Week 5 Lec 1-Bit

    3/23

    Todays Lecture

    Electronic mail (Email)

    SMTPDomain Name System (DNS)

  • 7/29/2019 Week 5 Lec 1-Bit

    4/23

    HTTP Request MessageTwo types of HTTP messages:

    Request, ResponseHTTP request message:

    Human-readable format

    A typical HTTP request message

    GET /somedir/page.html HTTP/1.1Host: www.someschool.edu

    User-agent: Mozilla/4.0Connection: closeAccept-language:fr

    (Blank Line)

    Body

  • 7/29/2019 Week 5 Lec 1-Bit

    5/23

    HTTP Request Message

    Request Line

    First Line of HTTP request message

    The request line has three fields

    Method field can take on several values

    GET,POST, PUT, DELETE etcMajority of HTTP request messages use GET

    URL field

    HTTP version field

    Header Lines Host: Host on which the object resides

    User-agent: Identifies the client program e.g. Mozilla/4.0

    Connection: Shows whether the connection should be closedor not

    Accept-language: Shows the language the client prefers

  • 7/29/2019 Week 5 Lec 1-Bit

    6/23

    HTTP Request Message

    Body is empty withGET method

    Used with the POSTmethod

    Web page oftenincludes form input

    Input is sent toserver in body

    PUT method:

    To upload objects toweb server

    DELETE method Allows a user or an

    application to deletean object on web

    server

    Find out about OPTIONS, TRACE, HEAD?

  • 7/29/2019 Week 5 Lec 1-Bit

    7/23

    HTTP Response Message

    HTTP/1.1 200 OKConnection: closeDate: Thu, 06 Aug 1998 12:00:15

    GMTServer: Apache/1.3.0 (Unix)Last-Modified: Mon, 22 Jun 1998Content-Length: 6821Content-Type: text/html

    Body contains Requested Object

  • 7/29/2019 Week 5 Lec 1-Bit

    8/23

    HTTP Response Message

    Status Line Protocol Version

    Status Code and Status MessageThe status code and associated phrase indicate the result of

    the request Header Line Connection: Shows whether the connection should be closed

    or not

    Date and time: When the HTTP response was created Server: Analogous to user-agent in request message

    Last-modified: When the Object was last created ormodified

    Content-length: Number of bytes in object being sent

    Content-Type: Indicates the object type (HTML text etc.)

  • 7/29/2019 Week 5 Lec 1-Bit

    9/23

    HTTP Response Status Codes

    200 OK Request succeeded and information is returned in

    response301 Moved Permanently Requested object moved, new location specified later in

    this message (Location:)

    400 Bad Request Request message not understood by server

    404 Not Found Requested document not found on this server

    505 Version not supported HTTP version is not supported by the server

    The status code and associated phrase indicate the result ofthe request

  • 7/29/2019 Week 5 Lec 1-Bit

    10/23

    Electronic Mail

    Asynchronous CommunicationMedium

    Three major components: User Agents Mail Servers Simple Mail Transfer Protocol:

    SMTP

    User Agent a.k.a. mail reader composing, editing, reading

    mail messages e.g., Eudora, Outlook, Mozilla

    Thunderbird Sends message to the mail

    server

    user mailboxoutgoing

    message queue

    mail

    server

    user

    agent

    user

    agent

    user

    agentmailserver

    user

    agentuser

    agent

    mail

    server

    user

    agent

    SMTP

    SMTPSMTP

  • 7/29/2019 Week 5 Lec 1-Bit

    11/23

    Electronic Mail

    Mail Servers

    Each recipient has a mailboxlocated in one of the mail servers

    Mailbox manages and maintains themessages that have been sent tohim.

    Messagequeue of outgoing (to besent) mail messages

    Simple Mail Transfer Protocol(SMTP) between mail servers tosend email messages

    Client and Server Both client and sever sides of

    SMTP run on every mail server.

    Runs on TCP at port 25.

    RFC 5321

    mailserver

    useragent

    useragent

    user

    agentmail

    serveruseragent

    useragent

    mailserver

    useragent

    SMTP

    SMTPSMTP

  • 7/29/2019 Week 5 Lec 1-Bit

    12/23

    Scenario: Alice sends message to Bob

    1) Alice uses UA to compose

    message [email protected]

    2) Alices UA sends messageto her mail server; messageplaced in message queue

    3) Client side of SMTP opensTCP connection with Bobsmail server

    4) SMTP client sends Alices

    message over the TCPconnection

    5) Bobs mail server places themessage in Bobs mailbox

    6) Bob invokes his user agent

    to read message

    useragent

    mailserver

    mailserver user

    agent1

    2 3 4 56

  • 7/29/2019 Week 5 Lec 1-Bit

    13/23

    Sample SMTP InteractionClient SMTP establishes a TCP connection with ServerSMTP

    Application Layer handshaking to introduce themselves

    Sample SMTP InteractionS: 220 hamburger.edu (Service Ready)C: HELO crepes.frS: 250 Hello crepes.fr, pleased to meet you

    C: MAIL FROM: S: 250 [email protected]... Sender okC: RCPT TO: S: 250 [email protected] ... Recipient okC: DATA (All lines after DATA command are treated as the

    mail message)

    S: 354 Enter mail, end with "." on a line by itselfC: Do you like ketchup?C: How about pickles?C: .S: 250 Message accepted for deliveryC: QUITS: 221 hamburger.edu closing connection

  • 7/29/2019 Week 5 Lec 1-Bit

    14/23

    SMTP and HTTP SMTP uses persistent connections

    Can send all of the messages over the same TCP connection

    Comparison with HTTP: HTTP transfer files from web server to web client

    SMTP from one mail server to another

    Both use Persistent Connections HTTP: pull

    Someone loads information on a web server and users useHTTP to pull this info

    TCP connection is initiated by the machine that wants toreceive the file

    SMTP: push

    Sending mail sever pushes the file to the receiving mail server

    TCP connection is initiated by the machine that wants to sendthe file

  • 7/29/2019 Week 5 Lec 1-Bit

    15/23

    Mail Access Protocols

    SMTP: delivery/storage to receivers server

    Mail access protocol: retrieval from server

    POP: Post Office Protocol [RFC 1939]

    IMAP: Internet Mail Access Protocol [RFC 1730]

    HTTP: Gmail, Hotmail, Yahoo! Mail, etc. User agent is ordinary web browser

    HTTP to send email to web server

    HTTP to access mail box

    useragent

    senders mailserver

    useragent

    SMTP SMTP accessprotocol

    receivers mailserver

  • 7/29/2019 Week 5 Lec 1-Bit

    16/23

    DNS: Domain Name System

    People: many identifiers: SSN, name, passport #

    Internet hosts: IP address (32 bit)

    name, e.g.,ww.yahoo.com - used byhumans

    Q: map between IPaddresses and name ?

    Domain Name System: Distributed Database

    implemented in hierarchy ofmany DNS servers

    An application-layer protocol

    that allows hosts to query thedistributed database

    DNS uses UDP over portnumber 53.

    RFC 1034 and RFC 1035

  • 7/29/2019 Week 5 Lec 1-Bit

    17/23

    DNS

    Simple design would have one DNS serverthat contains all the mappings

    Why not centralize DNS?

    Single point of failure

    Traffic volume Distant centralized database

    Maintenance

    A centralized database in a single DNSserver doesnt scale!

  • 7/29/2019 Week 5 Lec 1-Bit

    18/23

    Root DNS Servers

    com DNS servers org DNS servers edu DNS servers

    poly.edu

    DNS servers

    umass.edu

    DNS servers

    yahoo.com

    DNS serversamazon.com

    DNS servers

    pbs.org

    DNS servers

    Distributed, Hierarchical Database

    Client wants IP for www.amazon.com:

    Client first queries a root server

    The root server returns the IP addresses for TLD servers forthe top level domain com

    The client then contacts one of the TLD servers which returnsthe IP address of an authoritative server for amazon.com

    The authoritative server then returns the IP address for thehost name www.amazon.com

  • 7/29/2019 Week 5 Lec 1-Bit

    19/23

    DNS: Root Name Servers

    13 root DNS servers world wide

    Each server is a cluster of replicated servers security and reliability purposes.

    For more information see www.root-servers.org

    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, MDj Verisign, ( 21 locations)

  • 7/29/2019 Week 5 Lec 1-Bit

    20/23

    TLD and Authoritative Servers

    Top-level Domain (TLD) Servers: Responsible for com, org, net, edu, etc, and all

    top-level country domains uk, fr, jp. Network Solutions maintains servers for com TLD

    Educause for edu TLD ICANN: Internet Corporation for Assigned Names

    and Numbers

    Authoritative DNS Servers:

    Every organization with publicly accessible hostsprovide accessible DNS records.That maps the names of those hosts to IP addresses

    Authoritative DNS servers houses these DNS records

  • 7/29/2019 Week 5 Lec 1-Bit

    21/23

    Local Name Server

    Does not strictly belong to hierarchy

    Each company, university has one. Also called default name server

    When host makes DNS query, query is sentto its local DNS server acts as proxy, forwards query into hierarchy

  • 7/29/2019 Week 5 Lec 1-Bit

    22/23

    requesting hostcis.poly.edu

    gaia.cs.umass.edu

    root DNS server

    local DNS serverdns.poly.edu

    1

    2 345

    6

    authoritative DNS serverdns.cs.umass.edu

    78

    TLD DNS server

    DNS nameresolution example

    Host at cis.poly.eduwants IP address forgaia.cs.umass.edu

    Iterated query: Contacted server

    replies with name ofserver to contact

    I dont know this

    name, but ask thisserver

  • 7/29/2019 Week 5 Lec 1-Bit

    23/23

    requesting hostcis.poly.edu

    gaia.cs.umass.edu

    root DNS server

    local DNS serverdns.poly.edu

    1

    2

    45

    6

    authoritative DNS serverdns.cs.umass.edu

    7

    8

    TLD DNS server

    3Recursive Query: Puts burden of name

    resolution on otherserver

    DNS Caching Extensively used Cache entries timeout

    (disappear) after sometime

    TLD servers typicallycached in local nameservers Thus root name

    servers not oftenvisited

    DNS nameresolution example