Download presentation
Presentation is loading. Please wait.
Published byLillian Gardner Modified over 8 years ago
1
A Closer Look at HTTP, TCP, IP, and PPP Chapter 3 Copyright 2001 Prentice Hall Revision 2: July 2001
2
2 A Closer Look at n HTTP at the Application Layer n TCP (and UDP) at the Transport Layer n IP at the Internet Layer n PPP at the Data Link Layer
3
3 HTTP: A Closer Look n World Wide Web Standards –HTML (HyperText Markup Language) governs the structure of the HTML webpage –HTTP (HyperText Transfer Protocol) governs the format and timing of requests and responses between the browser and the webserver application program Browser Webserver Program HTML HTTP
4
4 HTTP: A Closer Look n Sample HTTP Request Line –All text, often only a single line –Keyword absolute path HTTP/ version –Keyword (Method) is GET for Retrievals GET must be capitalized –Absolute path is URL without http://hostname GET /report1/home.htm HTTP/1.1 Absolute Path
5
5 HTTP: A Closer Look n Sample HTTP Request Header –Although the book only discusses the request- line, if only the absolute path is give, the request line is supposed to be followed by a header line naming the host. –So if the host is puka.hawaii.edu, the request- line and header would be (where CRLF is carriage return followed by line feed): GET /report1/home.htm HTTP/1.1[CRLF] Host:puka.hawaii.edu New
6
6 HTTP: A Closer Look n Sample HTTP Response Message –Header is multiple lines of text –Each ends with [CRLF] HTTP/1.1 200 OK[CRLF] Date: Tuesday, 20-JAN-1999 18:32:15 GMT[CRLF] Server: name of server software[CRLF] MIME-version: 1.0[CRLF] Content-type: text/plain[CRLF] [CRLF] File to be downloaded.
7
7 HTTP: A Closer Look n Sample HTTP Response Message –200 is a code for a successful retrieval, followed by the humanly readable code, OK –Other codes indicate errors, such as 404 HTTP/1.1 200 OK[CRLF] Date: Tuesday, 20-JAN-1999 18:32:15 GMT[CRLF] Server: name of server software[CRLF] MIME-version: 1.0[CRLF] Content-type: text/plain[CRLF] [CRLF] File to be downloaded.
8
8 HTTP: A Closer Look n Sample HTTP Response Message –MIME-version and Content-type tell the type of file being retrieved –For HTML document, text/plain HTTP/1.1 200 OK[CRLF] Date: Tuesday, 20-JAN-1999 18:32:15 GMT[CRLF] Server: name of server software[CRLF] MIME-version: 1.0[CRLF] Content-type: text/plain[CRLF] [CRLF] File to be downloaded.
9
9 HTTP: A Closer Look n HTML Pages Contain Text –To be displayed n HTML Pages Contain Tags –Some tags say “place a graphic here”, “place a JAVA applet in a box here”, etc. –For instance, the tag says “Get file big.jpg and place it here in the HTML document” –Graphics, Java programs, etc. are separate files
10
10 HTTP: A Closer Look n Downloading a “page” may require several downloads –One for the HTML document –One each for the other files it calls for –Each needs a separate request/response cycle HTML Big. jpg App. java Webserver User PC File Downloads 2 3 1
11
11 HTTP: A Closer Look n How Many HTTP request-response cycles will be needed to download the three files? –3 HTTP request-response cycles HTML Big. jpg App. java Webserver User PC HTTP Request-Response Cycle 1 2 3
12
12 HTTP: A Closer Look n HTTP is Unreliable –No error detection and correction for errors –As we will see later, TCP at the transport layer is reliable, offering error detection and correction –TCP gives HTTP clean data, so there is no need for HTTP to do error checking
13
13 HTTP: A Closer Look n HTTP is Connectionless –HTTP is connectionless. Just send requests, get responses. No connection between messages Like sending a letter, fax, or e-mail Browser Webserver Application HTTP Request
14
14 TCP: A Closer Look n Browser does not send HTTP Requests directly to the webserver application –The application layer programs are not physically connected –Browser sends HTTP Request to the user PC’s transport layer process for delivery Browser Transport Process HTTP Request
15
15 TCP: A Closer Look n Transport layer process stores the HTTP Request Temporarily –Does NOT merely add a TCP header and then pass the TCP segment down to the Internet layer process as noted in Chapter 2 Browser Transport Process Transport Process Request
16
16 TCP: A Closer Look n User PC transport process opens a connection to the webserver transport layer process –This connection can be used to send several TCP segments to handle a several HTTP request-response cycles Browser Transport Process Transport Process
17
17 TCP: A Closer Look n TCP has a Flags Field –Six one-bit flags Source Port # (16)Destination Port # (16) Sequence Number (32 bits) Acknowledgement Number (32 bits) Hdr Len (4) Flags (6)Window Size (16) Options (if any)PAD Bit 0Bit 31 Reserved (6) TCP Checksum (16)Urgent Pointer (16) TCP Segment Data Field
18
18 TCP/IP: A Closer Look n Three Flags are Widely Used –SYN bit set to 1 in a TCP segment to request a connection –ACK bit set to 1 in a segment to acknowledge a received TCP segment –FIN bit set to 1 in a segment to inform of a connection closure Hdr Len (4) Flags (6)Window Size (16)Reserved (6)
19
19 TCP: A Closer Look n Opening a connection takes 3 Segments –First TCP segment has SYN flag set. Requests connection to webserver transport process (connection-oriented service) Like a telephone call User PC Transport Process Webserver Transport Process SYN
20
20 TCP: A Closer Look n Opening a connection takes 3 Segments –Second TCP segment asks to open a connection and also acknowledges the first SYN message (ACK flag set too) User PC Transport Process Webserver Transport Process SYN SYN, ACK
21
21 TCP: A Closer Look n Opening a connection takes 3 Segments –Third TCP segment acknowledges the second –All segments are acknowledged except for pure ACKs like the third segment User PC Transport Process Webserver Transport Process SYN SYN, ACK ACK
22
22 TCP: A Closer Look n Next, user PC sends the HTTP Request –Sends HTTP Request in data field of a TCP segment –Will receive an ACK TCP segment to acknowledge receipt User PC Transport Process Webserver Transport Process TCP segment containing HTTP Request ACK
23
23 Delivering the HTTP Response n Transport layer process on the webserver receives the TCP segment delivering the HTTP Request –The transport process on the webserver passes the HTTP Request in the TCP segment data field to the webserver application program Webserver Application Transport Process HTTP Request
24
24 Delivering the HTTP Response n Webserver application creates the HTTP Response message –Webserver application passes the HTTP Response message to the webserver transport layer process for delivery to the user PC transport layer process Webserver Application Transport Process HTTP Response
25
25 Delivering the HTTP Response n Webserver Transport Process Delivers the Response –User PC transport process sends an acknowledgement User PC Transport Process Webserver Transport Process TCP segment containing HTTP Response ACK
26
26 TCP: A Closer Look n Multiple HTTP Request-Response Cycles can be Handled with a Single TCP Connection in HTTP/1.1 and later versions n Request message must have following line: Connection: Keep-Alive New
27
27 TCP: A Closer Look n Closing the Connection takes 4 TCP Segments –You don’t simply hang up in a phone call! –Initiated by the browser when it downloads the last file User PC Transport Process Webserver Transport Process FIN ACK
28
28 TCP: A Closer Look n Refinement –If your respond quickly to a letter, often include acknowledgement of letter your received in your response letter –TCP segments too can both send new information and acknowledge a segment received. Example: SYN, ACK at start of connection –If response will take time, however, send a pure ACK message
29
29 TCP Connections: Recap n For Page Downloads… –3 TCP segments to open the connection –4 TCP segments per file downloaded More if file downloaded is long, because may take multiple segments to download –4 TCP segments to close the connection –A very chatty protocol
30
30 TCP: Error Handling n TCP is reliable--it does error correction –ACKs acknowledge each correctly-received TCP segment –If a TCP segment is not acknowledged, the other side retransmits it after awhile n TCP is reliable--it Places TCP Segments in Order –IP does not guarantee that packets will arrive in order –TCP can place TCP segments in order based on their sequence numbers
31
31 TCP: Error Handling n TCP Reliability in Perspective –Provides clean application data to application program –If data link layer frame or IP packet is lost at lower layers, receiving transport process will not acknowledge a segment –The sending transport process will resend automatically –So TCP protects against errors at lower layers as well as transport layer errors
32
32 User Datagram Protocol (UDP) n UDP –User Datagram Protocol –Alternative to TCP at the transport layer –Lightweight No connections (connectionless) No error correction (unreliable) Reduces work source and destination host must do
33
33 User Datagram Protocol (UDP) n UDP –Good for voice, for which the delay of error correction would be unacceptable –Good for applications for which the cost of an occasional message is small compared to the cost of connection-oriented service
34
34 IP: Connectionless Service n The Internet Protocol (IP) –Internet layer protocol –Governs transmission between router and host –Governs transmission between pairs of routers –Gives end-to-end route across many routers User PC WebserverRouter IP
35
35 IP: Connectionless Service n The Internet Protocol (IP) –IP messages are called IP packets n IP is unreliable and connectionless –Low overhead –Let TCP correct any errors! Internet Process Internet Process IP Packet
36
36 TCP/IP Partnership n TCP checks for errors only once, at the destination host n By not checking for errors at each router along the route, IP greatly reduces overall processing work –Reduces router costs Transport Internet Check Only Once Host Router Host
37
37 Connectionless IP n IP is unreliable (does not catch errors) –But this is not bad –First, errors are corrected--at the next- higher layer (transport) if TCP is used –Second, avoiding error correction at each hop between routers lowers router costs –Far less expensive to correct errors on one destination host than on many routers along the way
38
38 IP Addresses and Router Forwarding n Routers use the destination IP address of an incoming packet in the router forwarding decision, that is, to decide what output port to use to send the packet back out to the destination host or to another router (B, C or D?) B? D? C? Router A B C D Packet
39
39 Router Delivery n If Destination Host is On the Source Host’s Subnet, Source Host Delivers the Packet Directly –No router is involved –Called local delivery to destination host Subnet Source Host Destination Host Local Delivery
40
40 Router Delivery n If Destination Host is NOT On the Source Host’s Subnet, Source Host Sends the Packet to a Router for Delivery –Delivery to next-hop router Subnet Delivery to Next-Hop Router
41
41 Router Delivery n If Destination Host is On One of the Router’s Subnets, the Router Sends the Packet to the Destination Host for Delivery –Local delivery to destination host Subnet Local Delivery
42
42 Router Delivery n If Destination Host is NOT On One of the Router’s Subnets, the Router Sends the Packet to a Next-Hop Router for Delivery –May have to choose among several possible next-hop routers for delivery Subnet Delivery to Next-Hop Router
43
43 Router Delivery n Border Routers Connect Networks, Not Subnets –Select between next-hop router on own network or on another network Own Network Other Network
44
44 IP Addresses and Router Forwarding n Routers look at destination IP address of packet to make decisions n What do I do with this packet, based upon its IP destination address B? D? C? Router A B C D Packet
45
45 IP Addresses n Many Addressing Systems Use Hierarchical Addressing –Postal delivery: city, street address –Post office looks at city first If not P.O.’s city, put in bag for other city If in P.O.’s city, put in bag for sorting by street address –Hierarchical addressing greatly speeds sorting at each post office Imagine if we needed a sorting bin for each address in the country! City 1 City 2 City 3 Letter
46
46 IP Hierarchical Addressing n IP Address has Three Parts –Network part Identifies host’s network on the Internet –Subnet part Most networks consist of smaller subnets Identifies host’s subnet on that network –Host part Identifies a particular host –Total equals 32 bits (the whole IP address)
47
47 IP Hierarchical Addressing n Using Address Parts –Router has one forwarding rule for all packets to a particular network or to a particular subnets –Does not need a forwarding rule for each host –Many fewer rules to look through when making router forwarding decisions –Vastly reduces the work that routers have to do –Internet core routers still have 100,000 to 200,000 rules New
48
48 IP Addresses n Network Part Numbers –For the University of Hawaii, this is 128.171 –All IP Addresses in that organization’s network begin with that Network Part –Network parts can be 8 to 24 bits long Network Part IP Address 128.171
49
49 Assigning Network Parts n Organization applies to an Internet IP address registrar –Registrar gives organization a network part –Organization assigns the remaining bits to its hosts internally –Only large organizations and ISPs get network parts RegistrarFirm 128.171 128.171.17.13 128.171.123.130
50
50 IP Addresses n Network Part is Followed by a Subnet Part –Identifies the subnet within the network –Remaining bits are the Host Part, designating a particular host on that subnet Network PartSubnet Part IP Address (32 bits total) Host Part
51
51 Assigning Subnet Parts n Organization Assigns Subnet Parts –Assigns subnet parts to suborganizations –Suborganization assigns host bits to hosts RegistrarFirm 128.171128.171.17.13 Suborganization Host
52
52 Assigning Parts n Example –University of Hawaii has network part 128.171 –UH gave the College of Business Administration the subnet part 17 –College of Business Administration gave the host part 13 to a computer it later gave the host name voyager.cba.hawaii.edu –So the computer’s IP address became 128.171.17.13.
53
53 Importance of Part Sizes n Determine Number of Possible Networks, Subnets, or Hosts n If There are N Bits in the Part, there can be 2 N possible Networks, Subnets, or Hosts n Actually, 2 N -2 –All zeros cannot be used for a part –All ones cannot be used for a part n Example: if part has 8 bits, 2 8 -2 possibilities (254)
54
54 Masks n Problem: Just looking at an IP address does not tell you what bits belong to each part n Solution: Create a second 32-bit number, a mask, to tell the size of –The network part for border router decisions –The network plus subnet parts for internal router decisions
55
55 Masks n Two Types: Network Masks and Subnet Masks –Network Mask Tells the Length of the Network Part. To get packet closer to network. –Subnet Mask Tells the length of the Network Plus Subnet Parts (not just subnet part). To get packet closer to subnet in own network –IP Address will be paired with one or the other, but not both simultaneously –The correct pairing happens automatically
56
56 Masks n Masks Begin with 1s, End with 0s (111…00) n For network masks, 1s are in Network Part bits; 0s are in Subnet and Host Parts n For subnet masks, 1s are in Network and Subnet Parts; 0s are in Host part –1s are not just in the subnet part n Again, always total 32 bits 11111111111111110000000000000000
57
57 Masks n IP Address-Mask Pairs often Written with Prefix Notation –128.171.17.13/16 –16 means that the mask has 16 initial 1s –Total number of bits is 32 in an IP address, so there must be 16 trailing 0s 11111111111111110000000000000000
58
58 Router Forwarding Tables n Routers make forwarding decisions using router forwarding tables –Each row is a router forwarding rule for matching packets –Based on packet’s network or subnet on its network Book calls first column the IP address part Network/SubnetDelivery 128.171.17Local 142.99Next-Hop Router A Refinement
59
59 Router Forwarding Tables n Router Compares Destination IP Address to Each Row in Router Forwarding Table –If matches, adds to list of possible rules to use –There usually are multiple matches Indicate alternative routes Network/SubnetDelivery 128.171.17Local 142.99Next-Hop Router A
60
60 Router Forwarding Tables n Also Has a Mask Column –Tells number of network or network+subnet bits –If Mask in a row is 24 bits long, router only compares first 24 bits of packet’s IP destination address to Net/Subnet bits in table row –Tells size of network part or network+subnet parts Net/SubnetMaskDestination 128.171.1724Local 1428Next-Hop Router A
61
61 Router Forwarding Tables n Also Has a Mask Column –Network mask for a host outside the organization’s network –Subnet mask for an internal host –Can’t tell which by looking at the mask –Don’t worry. It’s all automatic Net/SubnetMaskDestination 128.171.1724Local 1428Next-Hop Router A
62
62 Router Forwarding Tables n Example –Destination IP Address is 128.171.17.13 –Apply mask, get 128.171.17 –Matches networks/subnet field (128.171.17) –The row is a match! –If only match, select this row. Net/SubnetMaskDestination 128.171.1724Local 1428Next-Hop Router A
63
63 Router Forwarding Tables n Longest Match Principle –If two rows match, use longest match, that is match to greatest number of bits –For 128.171.17.13, use local delivery (24-bit match) Net/SubnetMaskDestination 128.171.1724Local 128.17116Next-Hop Router A
64
64 Router Forwarding Tables n Metric –If same length of match, turn to metric column –Metric describes the desirability of a choice –If metric is cost, choose lowest cost –For other metrics (speed, etc.), may chose largest value Net/SubnetMaskMetric (Cost) Delivery 128.1711623Local 128.1711645Next-Hop Router A
65
65 Router Forwarding Tables n There May be No Matches –One IP Address Part is Always 0.0.0.0 –Mask is 0.0.0.0, so every IP address matches this row! –Its next-hop router is called the Default Router Net/SubnetDelivery 128.171.17.13Local 0.0.0.0Next-Hop Router C
66
66 Router Forwarding Tables n Recap of Selection Rules –Compare destination IP address of arriving packet against ALL rows in the router forwarding table Add all matches to a list –After examining all rows, select the best match If multiple rows match, select the longest match If multiple rows tie on the longest match, select the best metric If no other match, select the default router row
67
67 Router Forwarding Tables n Delivery –Table designates local delivery to destination host or a next hop router –Also designates the router interface (port) that will be used for delivery Each interface connects to a different subnet InterfaceDelivery 2Local (destination host is on the subnet out interface 2) 3Next-Hop Router C 3Next-Hop Router D
68
68 Dynamic Routing Protocols n How Do Routers Get Information for their Router Forwarding Tables? –Share router forwarding table information –Standards for these exchanges are called dynamic routing protocols Router Forwarding Table Information
69
69 Dynamic Routing Protocols n How Do Routers Get Information for their Router Forwarding Tables? –Thanks to dynamic routing protocols, the Internet needs no central point of control –Routers create their router forwarding tables strictly by information from peers and their own knowledge Router Forwarding Table Information
70
70 IP Version 6 n Current Version of IP is IP Version 4 –This is the version we have been discussing –Has 32-bit IP address fields –Not long enough; running out of IP addresses n Next Version will be IP Version 6 –Will have 128-bit IP address fields –Will allow vast numbers of IP addresses (2 128 ) –Being adopted slowly
71
71 PPP n Point-to-Point Protocol –Popular data link layer protocol for dial-in connections –Between data link layer processes on user PC and first router –Not between user PC and the destination host DLL Process User PC DLL Process First Router PPP
72
72 PPP n Negotiation Phase –Before exchanging data frames, the two sides –Negotiate conditions of PPP operation –Also negotiate how specific protocols will be handled, such as IP Not limited to IP DLL Process User PC DLL Process First Router PPP
73
73 PPP n Data Frames –Header –Information field (IP packet or other information) –Trailer with Frame Check Sequence field Error detection but not correction If an error is found, PPP frame is discarded TrailerInformation FieldHeader IP Packet
74
74 PPP n Flag Fields (1 Octet Each) –Always contain: 01111110 –Designates start of frame and end of frame n Address and Control Fields (1 Octet Each) –Left over from earlier protocol (HDLC) –Address field always has the value: 11111111 –Control field always has the value 00000011 FlagAddrCtrlProtInfoCRCFlag
75
75 PPP n Protocol Field (2 Octets) –Identifies the contents of the information field –There are values for IP, IPX, other internet layer protocols that may be carried in the information field for data frames –There are values for supervisory messages to be carried in the information field for supervisory frames FlagAddrCtrlProtInfoCRCFlag
76
76 PPP n Cyclical Redundancy Check (2 Octets) –For error-checking information –Allows receiver to detect a PPP frame with a transmission error –Receiver discards such frames; error detection but not reliability (no error correction) FlagAddrCtrlProtInfoCRCFlag
77
77 Physical Layer Process n Physical layer process does not create a protocol data unit –Sends one bit at a time over the data link connecting the sending computer to the next computer –It is the data link layer process that organizes these bits into frames over the data link Physical Layer Process 10110
78
78 Key Point about Reliability n Only TCP is Reliable or Needs to Be –Corrects errors, gives application programs clean data –Corrects errors that occur a the transport layer or lower layers because only correctly received TCP segments are acknowledged
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.