a closer look at http, tcp, ip, and ppp chapter 3 copyright 2001 prentice hall revision 2: july 2001

37
A Closer Look at HTTP, TCP, IP, and PPP Chapter 3 Copyright 2001 Prentice Hall Revision 2: July 2001

Upload: beatrix-watts

Post on 25-Dec-2015

218 views

Category:

Documents


1 download

TRANSCRIPT

A Closer Look at HTTP, TCP, IP, and PPP

Chapter 3

Copyright 2001 Prentice HallRevision 2: July 2001

2HTTP: A Closer Look

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

BrowserWebserverProgram

HTML

HTTP

3HTTP: A Closer Look Sample HTTP Request Line

– All text, often only a single line• GET /report1/home.htm HTTP/1.1[CRLF]

Host:puka.hawaii.edu

Sample HTTP Response MessageHTTP/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.

4HTTP: A Closer Look 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.

5HTTP: A Closer Look

Downloading a “page” may require several downloads– HTML document:text & tags of other files needed– Graphics files specified in tag– Each needs a separate request/response cycle

HTML

Big.jpg

App.java

WebserverUserPC

File Downloads

2

3

1

6HTTP: A Closer Look HTTP is Unreliable

– No error detection and correction for errors

– TCP gives HTTP clean data, so there is no need for HTTP to do error checking

HTTP is Connectionless

– Send requests without first connecting to destination

– Datagram service

7TCP: A Closer Look 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

TransportProcess

HTTP Request

8TCP: A Closer Look

TCP is connection oriented– Expensive

– Once connection open, TCP messages (segments) sent back & forth between computers.

9TCP: A Closer Look

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 0 Bit 31

Reserved (6)

TCP Checksum (16) Urgent Pointer (16)

TCP Segment

Data Field

10TCP/IP: A Closer Look

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)

11TCP: A Closer Look Opening / Request / Response Cycle

– Opening a connection takes 3 Segments

• First TCP segment has SYN flag set.

• Second TCP segment asks to open a connection and acknowledges first SYN message

• Third TCP segment acknowledges the second

– User PC sends the HTTP Request• HTTP Request in data field of a TCP segment

User PCTransportProcess

WebserverTransportProcess

SYNSYN, ACK

ACK

TCP segment withHTTP Request

ACK

12Delivering the HTTP Response Transport layer process on the webserver

receives the TCP segment – passes the HTTP Request field to the

webserver application program

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

WebserverApplication

TransportProcess

HTTP Request HTTP Response

13TCP: A Closer Look Closing the Connection takes 4 TCP

Segments– Initiated by the browser when it downloads the

last file

User PCTransportProcess

WebserverTransportProcess

FIN

FIN

ACK

ACK

14TCP: Error Handling

TCP is reliable—– Error correction

• Acknowledge correctly-received TCP segments

– Provides clean application data to application program

• If data link layer frame or IP packet is lost receiving transport process will not acknowledge

– If TCP segment not acknowledged other side retransmits

– TCP is reliable• Places TCP Segments in Order based on

sequence numbers• IP does not guarantee packets arrive order

15User Datagram Protocol (UDP)

UDP (User Datagram Protocol)– Alternative to TCP at the transport layer

– For applications tolerable to data loss or not tolerable to delay

• Connectionless

• No error correction (unreliable)

• Reduces work source and destination host must do

– No acknowledgements

16IP: Connectionless Service/Unreliable

Internet Protocol (IP)– Governs transmission between router and host

– Governs transmission between pairs of routers

– Gives end-to-end route across many routers

– IP messages are called IP packets / datagrams• Not guaranteed to arrive in sequence

UserPC

WebserverRouter RouterIP IP IP

17TCP/IP Partnership

TCP checks for errors only once, at the destination host

By not checking for errors at each router along the route, IP greatly reduces overall processing work

Transport Transport

Internet Internet Internet

Check Only Once

Host Router Host

18IP Addresses and Router Forwarding Routers use the destination IP address of

an incoming packet in the router forwarding decision– Decide output port for sending packet out

• Destination Host On Source Host’s Subnet• Destination Host NOT On Source’s Subnet• Destination Host On Router’s Subnet• Router forward to Other Router• Border Router: connect network with Internet

B?D?

C?

B

CD

Router A

PacketSubnet

19IP Hierarchical Addressing IP Address (32 bits long )

– Hierarchical Addressing

– Header stores source & destination

– Part of IP address• Network part

– Identifies host’s network on the Internet

• Subnet part– Identifies host’s subnet on that network

• Host part– Identifies host within subnet

20IP Addresses

Network Part Numbers– Assigned by IP Address Registrar:

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

21IP Addresses Network Part is Followed by a Subnet Part

– Identifies the subnet within the network

– Organization Assigns Subnet Parts to suborganizations

• UH gave the College of Business Administration the subnet part 17

• Suborganization assigns remaining bits to particular host on that subnet

– College of Business Administration assigned host part 13 to host name voyager.cba.hawaii.edu

Network Part Subnet Part

IP Address (32 bits total)

Host Part

128.171 17 13

22IP Addresses

Three rules of assigning part values– No part of host IP address can be all ones

• Broadcast address: to all hosts on subnet

– No part of host IP address can be all zeros• For unknown address

– No host can have the IP address 127.0.0.0• Loopback testing

23Masks

Problem: Router does not know that the first 16 bits of the IP address are the network part of the address

Solution: A second 32-bit number (mask) paired with the IP address

24Masks

Two Types: Network Masks and Subnet Masks

– Network Mask Designates organization network on the Internet.

– Subnet Mask Designates specific subnet on the network.

– IP Address will be paired with one or the other, but not both simultaneously

25Masks Masks Begin with 1s, End with 0s (111…00)

– Prefix Notation with IP Address-Mask Pairs 128.171.17.13/16

– Prefix represents number of initial 1s (16)

– Remaining bits = 0s

Network masks: Network Part =1s Subnet and Host Parts = 0s

For subnet masks, Network and Subnet Parts = 1s; Host part = 0s

26Router Forwarding Tables Used for Router forwarding decisions

– Lists various combinations of IP addresses, mask prefixes, next hop router & metrics and interface for sending message out.

– Each row is a router forwarding rule for matching packets

27Router Forwarding Tables 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

Mask Column– Indicates length of match to partial IP address

28Router Forwarding Tables

Matching IP Addresses– Local Delivery or Next-hop routing

– Designates router interface (port) used for delivery

• Each interface connects to a different subnet

– Simple Match

– Longest Match selection

– Metric-Based Selection• Cost• Reliability• Different routers use different metrics

– Default Routing

29Dynamic Routing Protocols

How Do Routers Get Information for their Router Forwarding Tables?– Exchange information about routes & metrics

– Dynamic routing protocols: standards governing exchanges

• 0.0.0.0 used as placeholder not IP address

Router ForwardingTable Information

30IP Version 6

Current Version of IP is IP Version 4– In use since 1981

– 32-bit IP address fields are too small

Next Version will be IP Version 6– Will have 128-bit IP address fields

– Advanced features of security, priority levels, etc.

31Closer look at Data Link Layer

Point-to-Point Protocol– Manage flow of messages (frames) thru subnet

– Popular protocol for dial-in connections

– Between data link layer processes on user PC and first router; not user PC and destination host

DLL Process

User PC

DLL Process

First Router

PPP

32Closer look at Data Link Layer

Negotiation Phase– Before exchanging data frames both sides:

• Negotiate conditions of PPP operation

– Also negotiate how specific protocols will be handled

• Not limited to IP

DLL Process

User PC

DLL Process

First Router

PPP

33Closer look at Data Link Layer

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

Trailer Information Field Header

IP Packet

34Closer look at Data Link Layer

Flag Fields (1 Octet Each)– Always contain: 01111110– Designates start of frame and end of frame

Address and Control Fields (1 Octet Each)– Left over from earlier protocol (HDLC)– Address value: 11111111 – Control value 00000011

Flag Addr Ctrl Prot Info CRC Flag

35Closer look at Data Link Layer

Protocol Field (2 Octets)– Identifies the contents of the information field

– Values for IP, IPX, other internet layer protocols in the information field

– Values for supervisory messages to be carried in the information field for supervisory frames

Flag Addr Ctrl Prot Info CRC Flag

36Closer look at Data Link Layer

Cyclical Redundancy Check (2 Octets)– Error-checking information in data link frame

– Receiver discards such frames; error detection but not reliability (no error correction)

Flag Addr Ctrl Prot Info CRC Flag

37Physical Layer Process

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 LayerProcess

Physical LayerProcess

10110