Presentation is loading. Please wait.

Presentation is loading. Please wait.

Network Protocols: Design and Analysis Polly Huang EE NTU

Similar presentations


Presentation on theme: "Network Protocols: Design and Analysis Polly Huang EE NTU"— Presentation transcript:

1 Network Protocols: Design and Analysis Polly Huang EE NTU http://cc.ee.ntu.edu.tw/~phuang phuang@cc.ee.ntu.edu.tw

2 TCP Overview

3 Polly Huang, NTU EE3 What does TCP Provide? Connection establishment: Connectionless communication: Congestion avoidance: Differentiated services: Duplicate packet detection: Flow control: loss recovery: message or record boundaries: ordered data delivery to the application: out-of-order data delivery to the application: quality-of-service: urgent data indication:

4 Polly Huang, NTU EE4 Where and Why is TCP Used? where: anywhere reliable communication is needed –file transfer/ftp, http, p2p; e-mail smpt; remote login/telnet; db transfer/dns; some real audio why? –connection oriented—can be easier to manage (ex. firewall config) –has the right features (congestion ctl, etc.) –widely deployed => interoperability, understood, exhaustively studied, pretty good implementations –doing your own protocol is a lot of work

5 Polly Huang, NTU EE5 TCP in a Nutshell abstraction: –reliable –ordered –point-to-point –byte-stream mechanisms –window-based flow control –sequence numbers/ordering, 3- way handshake –reliability (ACK, retx policies) –congestion control –RTT estimation

6 Polly Huang, NTU EE6 TCP Header Source portDestination port Sequence number Acknowledgement Advertised window Hdr len Flags 0 ChecksumUrgent pointer Options (variable) Data Flags: SYN FIN RESET PUSH URG ACK

7 Polly Huang, NTU EE7 Agenda connection setup and teardown –initial sequence number selection –passive/active open –time-wait flow control congestion control practice and theory loss recovery security performance

8 Polly Huang, NTU EE8 Three-Way Handshake why? –passes buffer sizes –connection startup –set up initial seq number – options –is someone there? AB SYN SYN+ACK-A ACK-B

9 Polly Huang, NTU EE9 Connection Setup States passive vs. active (and both active!) (error recovery is not on this figure)

10 Polly Huang, NTU EE10 Initial Sequence Number Selection Why not just start at 0? –want to avoid accidental replay of old packets (tcp connection: src + dest ip address + port) Approach: –randomly chosen –OR semi-sequentally

11 Polly Huang, NTU EE11 Tear-down Packet Exchange SenderReceiver FIN FIN-ACK FIN FIN-ACK Data write Data ack

12 Polly Huang, NTU EE12 Connection Tear-down

13 Polly Huang, NTU EE13 Connection Tear-down either side can close –or one side can close and the other stay open one side must maintain state (TIME_WAIT) for 2 minutes, why? –suppress old packets

14 Polly Huang, NTU EE14 Agenda connection setup and teardown flow control –setting window sizes –Nagle’s algorithm –silly window syndrome –protection against wrap-around congestion control practice and theory loss recovery security performance

15 Polly Huang, NTU EE15 Flow Control Window sizes are passed in every packet –beware: implementations often have separate TCP and socket buffers –effective window is the minimum of the two

16 Polly Huang, NTU EE16 Flow Control Why? –avoid overrunning receiver Solutions –TCP have a sliding window w/how much data can be outstanding –(OR could have a rate)

17 Polly Huang, NTU EE17 Window Flow Control: Sender Sent but not ackedNot yet sent advertised window (from receiver) Sequence numbers last byte sentlast byte ACKed effective window send buffer

18 Polly Huang, NTU EE18 Window Flow Control: Receiver ACKed but not delivered to user recv’d but not ACKed Receive buffer (possible window) Sequence numbers advertised window missing data

19 Polly Huang, NTU EE19 Window Advancement Issues What if window is full? –sender sends full window, but ACK is lost  sender sends 1-byte probes (solicits new ACK) Silly window syndrome (RFC-813) –receiver dribbles out small window advances  Silly Window Avoidance: delay ACKing (receiver) or sending small segments (sender) Sender who dribbles out data (like telnet)  Nagle’s algorithm (RFC-896): send 1 st partial packet, but not more until it’s ACKed or you have a full packet

20 Polly Huang, NTU EE20 Problem: Rapid Wrap-Around Wraparound time vs. Link speed: 1.5Mbps: 6.4 hours 10Mbps: 57 minutes 45Mbps: 13 minutes 100Mbps: 6 minutes 622Mbps: 55 seconds 1.2Gbps: 28 seconds  Protection Against Wrapped Sequences (PAWS extension): Use timestamp to distinguish sequence number wraparound

21 Polly Huang, NTU EE21 Agenda connection setup and teardown flow control congestion control theory –what and why –how congestion control practice loss recovery security performance

22 Polly Huang, NTU EE22 Congestion Collapse If both sources send full speed, the router is completely overwhelmed  congestion collapse: senders lose data from congestion and they resend, causing more congestion (can be self-reinforcing) –has been observed many times 10 Mbps 1.5 Mbps

23 Polly Huang, NTU EE23 Congestion Control vs. Flow Control What does flow control do? –avoids overrunning the receiver What does congestion control do? –avoid overrunning router buffers; avoid saturating the network What mechanism do they use? –both use windows: (flow control) wnd, (congestion control) cwnd: actual window used is the MIN of wnd and cwnd

24 Polly Huang, NTU EE24 Congestion Control Goals control network buffer usage avoid congestion collapse want to fairly allocate network resources make good use of network bandwidth: power

25 Polly Huang, NTU EE25 Power and Load throughput and delay change due to load –want to optimize power load throughput load delay (From [Ramakrishnan90a]) power := (throughput)  delay knee

26 Polly Huang, NTU EE26 Fairness Also want fairness –should treat all users equally but it’s not so easy –what is a user? host, flow, person?  if n flows through a link, each should get n -1 of the bandwidth –R&J’s fairness index: (  x i ) 2 /n(  x i 2 ) –but what if flows have different needs? different RTTs?

27 Polly Huang, NTU EE27 Congestion Control Design Avoidance or control? (R&J:) –avoidance keeps system at knee of curve requires some congestion signal –control responds to loss after the fact TCP –Which is TCP? congestion control (according to R&J’s definition) –How does TCP do it? slow start, congestion avoidance, exponential backoff

28 Polly Huang, NTU EE28 How to Adjust Window? When to increase/decrease? A control theory problem –observe network –reduce window if congested –increase window if not congested Constraints: –efficency –fairness –stability (too much oscillation is bad) –out-of-date info RTT is fundamental limit to how quickly you can react

29 Polly Huang, NTU EE29 Linear Control X i (t + 1) = a i (t,f) + b i (t,f) X i (t) Formulation allows for the feedback signal: –to change additively: a i (t) –to change multiplicatively: b i (t) –can consider feedback What does TCP do and why? –AIMD: additive increase, multiplicative decrease Types of feedback in Internet? –packet loss or ECN (explicit congestion notification) or in R&J “binary feedback” DECBit

30 Polly Huang, NTU EE30 Agenda connection setup and teardown flow control congestion control theory congestion control practice (in TCP) loss recovery security performance => next sets of slides


Download ppt "Network Protocols: Design and Analysis Polly Huang EE NTU"

Similar presentations


Ads by Google