Presentation is loading. Please wait.

Presentation is loading. Please wait.

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…

Similar presentations


Presentation on theme: "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…"— Presentation transcript:

1 Winter 20021 CMPE 155 Week 3

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

3 Winter 20023 Client-Server Model Client Kernel File Server Kernel Printer Server Kernel

4 Winter 20024 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!

5 Winter 20025 Protocol stack Host Application Transport Network Link User A User B Teleconferencing Layering: technique to simplify complex systems Peers

6 Winter 20026 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).

7 Winter 20027 Encapsulation

8 Winter 20028 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!

9 Winter 20029 Layering Functionality Reliability Flow control Fragmentation Multiplexing Connection setup (handshaking) Addressing/naming (locating peers)

10 Winter 200210 Example: Transport layer First end-to-end layer. End-to-end state. May provide reliability, flow and congestion control.

11 Winter 200211 Example: Network Layer Point-to-point communication. Network and host addressing. Routing.

12 Winter 200212 The Internet Protocol Router Host Application Transport Network IP Network

13 Winter 200213 IP Glues Internet together. Common network-layer protocol spoken by all Internet participating networks. Best effort datagram service: –No reliability guarantees. –No ordering guarantees.

14 Winter 200214 Remote login protocols Telnet and rlogin. Allow interactive use of remote machines. Use reliable transport protocols, e.g., TCP. What’s TCP?

15 Winter 200215 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.

16 Winter 200216 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.

17 Winter 200217 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.

18 Winter 200218 TCP Reliability Reliable delivery. – ACKs. – Timeouts and retransmissions. Ordered delivery.

19 Winter 200219 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.

20 Winter 200220 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 as separate IP datagrams A B C D 2048 bytes of data delivered to application in single READ

21 Winter 200221 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.

22 Winter 200222 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.

23 Winter 200223 TCP Protocol Overview 2 Sequence numbers. – Reliability, ordering, and flow control. – Assigned to every byte. – 32-bit sequence numbers.

24 Winter 200224 TCP Connection Setup 3-way handshake. Host 1 Host 2 SYN (SEQ=x) SYN(SEQ=y,ACK=x+1) (SEQ=x+1, ACK=y+1)

25 Winter 200225 TCP Connection Release 1 Abrupt release: –Send RESET. –May cause data loss.

26 Winter 200226 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.

27 Winter 200227 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.

28 Winter 200228 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.

29 Winter 200229 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.

30 Winter 200230 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.

31 Winter 200231 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 Sender blocked Sender may send up to 2K

32 Winter 200232 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.

33 Winter 200233 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.

34 Winter 200234 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).

35 Winter 200235 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.

36 Winter 200236 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.

37 Winter 200237 TCP Congestion Control: Example threshold timeout threshold cwin time

38 Winter 200238 TCP Retransmission Timer When segment sent, retransmission timer starts. –If segment ACKed, timer stops. –If time out, segment retransmitted and timer starts again.

39 Winter 200239 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.

40 Winter 200240 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.

41 Winter 200241 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.

42 Winter 200242 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.

43 Winter 200243 TIME_WAIT 2*MSL. Makes sure all segments die after connection is closed.

44 Winter 200244 Back to remote login…

45 Winter 200245 Telnet User’s machine Telnet client OS TCP connection over Internet Telnet server OS

46 Winter 200246 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.

47 Winter 200247 Handling heterogeneity Telnet protocol specifies standard data exchange: network virtual terminal (NVT). Telnet client and server make translation.

48 Winter 200248 Rlogin Remote login between Unix hosts. Simpler than telnet.

49 Winter 200249 More details… Stevens, TCP/IP Illustrated, Vol. 1 Comer, Internetworking with TCP/IP, Vol. 1, 4 th. edition. RFC 854 (Telnet).

50 Winter 200250 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.

51 Winter 200251 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).

52 Winter 200252 FTP Operation Client Server OS DataControl OS DataControl TCP connection

53 Winter 200253 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.

54 Winter 200254 Anonymous FTP


Download ppt "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…"

Similar presentations


Ads by Google