Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this...

54
Winter 2002 1 CMPE 155 Week 3
  • date post

    19-Dec-2015
  • Category

    Documents

  • view

    218
  • download

    2

Transcript of Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this...

Page 1: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 1

CMPE 155

Week 3

Page 2: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 2

Project 3: Basic Servers

Telnet Rlogin FTP Web

In this context, let’s look at the underlying protocols…

Page 3: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 3

Client-Server Model

Client

Kernel

File Server

Kernel

Printer Server

Kernel

Page 4: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 4

What are protocols?

Set of rules governing communication between network elements (applications, hosts, routers).

Protocols define:– Format and order of messages.– Actions taken on receipt of a message.

Protocols are hard to design– We need design guidelines!

Page 5: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 5

Protocol stack

Host Host

Application

Transport

Network

Link

User A User BTeleconferencing

Layering: technique to simplify complex systems

Peers

Page 6: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 6

Layering Characteristics

Each layer relies on services from layer below and exports services to layer above.

Interface defines interaction, Hides implementation - layers can

change without disturbing other layers (black box).

Page 7: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 7

Encapsulation

Page 8: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 8

OSI Model: 7 Protocol Layers

Physical: how to transmit bits Data link: how to transmit frames Network: how to route packets hop2hop Transport: how to send packets end2end Session: how to tie flows together Presentation: byte ordering, security Application: everything else!

Page 9: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 9

Layering Functionality

Reliability Flow control Fragmentation Multiplexing Connection setup (handshaking) Addressing/naming (locating peers)

Page 10: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 10

Example: Transport layer

First end-to-end layer. End-to-end state. May provide reliability, flow and

congestion control.

Page 11: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 11

Example: Network Layer

Point-to-point communication. Network and host addressing. Routing.

Page 12: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 12

The Internet Protocol

Router Router

Host Host

Application

Transport

Network

IP IPIP IP

Network

Page 13: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 13

IP

Glues Internet together. Common network-layer protocol spoken

by all Internet participating networks. Best effort datagram service:

– No reliability guarantees.– No ordering guarantees.

Page 14: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 14

Remote login protocols

Telnet and rlogin. Allow interactive use of remote

machines. Use reliable transport protocols, e.g.,

TCP.

What’s TCP?

Page 15: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 15

The Internet Transport Protocols: TCP and UDP UDP: user datagram protocol (RFC

768).– Connection-less protocol.

TCP: transmission control protocol (RFCs 793, 1122, 1323).– Connection-oriented protocol.

Page 16: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 16

UDP Provides connection-less, unreliable service.

– No delivery guarantees.– No ordering guarantees.– No duplicate detection.

Low overhead.– No connection establishment/teardown.

Suitable for short-lived connections.– Example: client-server applications.

Page 17: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 17

TCP

Reliable end-to-end communication. TCP transport entity:

– Runs on machine that supports TCP.– Interfaces to the IP layer.– Manages TCP streams.

• Accepts user data, breaks it down and sends it as separate IP datagrams.

• At receiver, reconstructs original byte stream from IP datagrams.

Page 18: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 18

TCP Reliability

Reliable delivery.– ACKs.– Timeouts and retransmissions.

Ordered delivery.

Page 19: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 19

TCP Service Model 1

Obtained by creating TCP end points.– Example: UNIX sockets.– Socket number or address: IP address + 16-bit

port number (TSAP).– Multiple connections can terminate at same

socket.– Connections identified by socket ids at both ends.– Port numbers below 1024: well-known ports

reserved for standard services.• List of well-known ports in RFC 1700.

Page 20: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 20

TCP Service Model 2

TCP connections are full-duplex and point-to-point.

Byte stream (not message stream).– Message boundaries are not preserved

e2e.

A B C D

4 512-byte segments sent asseparate IP datagrams

A B C D

2048 bytes of data deliveredto application in single READ

Page 21: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 21

TCP Byte Stream When application passes data to TCP, it may

send it immediately or buffer it. Sometimes application wants to send data

immediately.– Example: interactive applications.– Use PUSH flag to force transmission.– TCP could still bundle PUSH data together (e.g., if it

cannot transmit it right away).

URGENT flag.– Also forces TCP to transmit at once.

Page 22: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 22

TCP Protocol Overview 1

TCP’s TPDU: segment.– 20-byte header + options.– Data.

TCP entity decides the size of segment.– 2 limits: 64KByte IP payload and MTU.– Segments that are too large are fragmented.

• More overhead by addition of IP header.

Page 23: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 23

TCP Protocol Overview 2

Sequence numbers.– Reliability, ordering, and flow control.– Assigned to every byte.– 32-bit sequence numbers.

Page 24: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 24

TCP Connection Setup

3-way handshake.Host 1 Host 2SYN (SEQ=x)

SYN(SEQ=y,ACK=x+1)

(SEQ=x+1, ACK=y+1)

Page 25: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 25

TCP Connection Release 1 Abrupt release:

– Send RESET.– May cause data loss.

Page 26: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 26

TCP Connection Release 2 Graceful release:

– Each side of the connection released independently.

• Either side send TCP segment with FIN=1.• When FIN acknowledged, that direction is shut down for

data.• Connection released when both sides shut down.

– 4 segments: 1 FIN and 1 ACK for each direction; 1st. ACK+2nd. FIN combined.

Page 27: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 27

TCP Connection Release 3

Timers to avoid 2-army problem.– If response to FIN not received within

2*MSL (maximum segment lifetime), FIN sender releases connection.

After connection released, TCP waits for 2*MSL (e.g., 120 sec) to ensure all old segments have aged.

Page 28: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 28

TCP Transmission 1

Sender process initiates connection. Once connection established, TCP can

start sending data. Sender writes bytes to TCP stream. TCP sender breaks byte stream into

segments.– Each byte assigned sequence number.– Segment sent and timer started.

Page 29: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 29

TCP Transmission 2 If timer expires, retransmit segment.

– After retransmitting segment for maximum number of times, assumes connection is dead and closes it.

If user aborts connection, sending TCP flushes its buffers and sends RESET segment.

Receiving TCP decides when to pass received data to upper layer.

Page 30: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 30

TCP Flow Control

Sliding window.– Receiver’s advertised window.

• Size of advertised window related to receiver’s buffer space.

• Sender can send data up to receiver’s advertised window.

Page 31: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 31

TCP Flow Control: Example

2K;SEQ=0

ACK=2048; WIN=2048

2K; SEQ=2048

ACK=4096; WIN=0

ACK=4096; WIN=2048

1K; SEQ=4096

App. writes 2K of data

4K

2K

0

App. reads 2K of data

2K

1K

App. does 3K write

Senderblocked

Sendermay send upto 2K

Page 32: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 32

TCP Flow Control: Observations

TCP sender not required to transmit data as soon as it comes in from application.– Example: when first 2KB of data comes in,

could wait for more data since window is 4KB.

Receiver not required to send ACKs as soon as possible.– Wait for data so ACK is piggybacked.

Page 33: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 33

Congestion Control

Why do it at the transport layer?– Real fix to congestion is to slow down sender.

Use law of “conservation of packets”.– Keep number of packets in the network constant.– Don’t inject new packet until old one leaves.

Congestion indicator: packet loss.

Page 34: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 34

TCP Congestion Control 1

Like, flow control, also window based.– Sender keeps congestion window (cwin).– Each sender keeps 2 windows: receiver’s

advertised window and congestion window.– Number of bytes that may be sent is

min(advertised window, cwin).

Page 35: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 35

TCP Congestion Control 2

Slow start [Jacobson 1988]:– Connection’s congestion window starts at 1

segment.– If segment ACKed before time out,

cwin=cwin+1.– As ACKs come in, current cwin is

increased by 1.– Exponential increase.

Page 36: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 36

TCP Congestion Control 3

Congestion Avoidance:– Third parameter: threshold.– Initially set to 64KB.– If timeout, threshold=cwin/2 and cwin=1.– Re-enters slow-start until cwin=threshold.– Then, cwin grows linearly until it reaches

receiver’s advertised window.

Page 37: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 37

TCP Congestion Control: Example

threshold

timeout

threshold

cwin

time

Page 38: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 38

TCP Retransmission Timer

When segment sent, retransmission timer starts.– If segment ACKed, timer stops.– If time out, segment retransmitted and

timer starts again.

Page 39: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 39

How to set timer?

Based on round-trip time: time between a segment is sent and ACK comes back.

If timer is too short, unnecessary retransmissions.

If timer is too long, long retransmission delay.

Page 40: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 40

Jacobson’s Algorithm 1

Determining the round-trip time:– TCP keeps RTT variable. – When segment sent, TCP measures how

long it takes to get ACK back (M).– RTT = alpha*RTT + (1-alpha)M.– alpha: smoothing factor; determines weight

given to previous estimate.– Typically, alpha=7/8.

Page 41: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 41

Jacobson’s Algorithm 2

Determining timeout value:– Measure RTT variation, or |RTT-M|.– Keeps smoothed value of cumulative

variation D=alpha*D+(1-alpha)|RTT-M|.– Alpha may or may not be the same as

value used to smooth RTT.– Timeout = RTT+4*D.

Page 42: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 42

Keepalive Timer

Goes off when a connection is idle for a long time.

Causes one side to check whether the other side is still alive.

If no answer, connection terminated.

Page 43: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 43

TIME_WAIT

2*MSL. Makes sure all segments die after

connection is closed.

Page 44: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 44

Back to remote login…

Page 45: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 45

Telnet

User’smachine

Telnetclient

OSTCP connectionover Internet

Telnetserver

OS

Page 46: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 46

Telnet basic operation

When user invokes telnet, telnet client on user machine establishes TCP connection to specified server.

TCP connection established; user’s keystrokes sent to remote machine.

Telnet server sends back response, echoed on user’s terminal.

Telnet server can accept multiple concurrent connections.

Page 47: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 47

Handling heterogeneity

Telnet protocol specifies standard data exchange: network virtual terminal (NVT).

Telnet client and server make translation.

Page 48: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 48

Rlogin

Remote login between Unix hosts. Simpler than telnet.

Page 49: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 49

More details…

Stevens, TCP/IP Illustrated, Vol. 1 Comer, Internetworking with TCP/IP,

Vol. 1, 4th. edition. RFC 854 (Telnet).

Page 50: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 50

File Transfer

Sharing remote files: “on-line” access versus “file transfer”.

“On-line” access transparent access to shared files, e.g., distributed file system.

Sharing through file transfer: user copies file then operates on it.

Page 51: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 51

FTP

File transfer accounted for most of the Internet traffic until the Web exploded!

Also uses TCP. Allows interactive access; format

specification (e.g., binary); authentication (clients required to authenticate themselves).

Page 52: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 52

FTP Operation Client Server

OS

Data Control

OS

Data Control

TCP connection

Page 53: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 53

Port Assignment

FTP server listens on well-known port (21); data transfer uses port 20.

On client side, uses any unused port; client control process communicates that port number to server.

Server process initiates data transfer connection.

Page 54: Winter 20021 CMPE 155 Week 3. Winter 20022 Project 3: Basic Servers Telnet Rlogin FTP Web In this context, let’s look at the underlying protocols…

Winter 2002 54

Anonymous FTP