Slide 1

Slide 1 text

TCP/IP 101 Brice Bang 2018.03.14 Buzzvil

Slide 2

Slide 2 text

Contents • Network Layers • Internet Layer • IP • Transport Layer • TCP TCP

Slide 3

Slide 3 text

Telecommunication

Slide 4

Slide 4 text

Scalability

Slide 5

Slide 5 text

Scalability

Slide 6

Slide 6 text

Many Types of Telecommunication Medium

Slide 7

Slide 7 text

Abstraction Layers • A way of hiding the implementation details of a particular set of functionality • Allows the separation of concerns to facilitate interoperability and platform independence IP Network Wired Communication Wireless Communication

Slide 8

Slide 8 text

Network Layers

Slide 9

Slide 9 text

Encapsulation Protocol Data Unit (PDU) = Header + Service Data Unit (SDU) PDU of Layer N + 1 Header of Layer N SDU of Layer N

Slide 10

Slide 10 text

Abstraction with Encapsulation and Decapsulation

Slide 11

Slide 11 text

Network Layers with Protocols Physical Layer: Ethernet 1000BASE-T, 802.11, USB, Bluetooth Network Access Layer: Ethernet, MAC, 802.11, L2TP, PPP, PPTP Internet Layer: IPv4, IPv6 Transport Layer: TCP, UDP Application Layer: HTTP

Slide 12

Slide 12 text

Internet Layer • IPv4 • IPv6

Slide 13

Slide 13 text

Routing and Forwarding

Slide 14

Slide 14 text

Transport Layer • Transmission Control Protocol (TCP) • Connection-Oriented • Flow control • In-order-delivery • Error recovery • Congestion control • User Datagram Protocol (UDP) • None of the above

Slide 15

Slide 15 text

Transmission Control Protocol (TCP) • TCP segment, sequence number, segment size, Acknowledgement (ACK), Round Trip Time (RTT) A B Acknowledgement (M+N) TCP Segment (seq: M, size: N) Round Trip Time (RTT)

Slide 16

Slide 16 text

TCP Handshake – Connection Establishment A B SYN (K), ACK (J+1) SYN (J) ACK (K+1) connect() listen() accept() connect() returns accept() returns LISTEN SYN_SENT ESTABLISHED ESTABLISHED SYN_RECV Connection-Oriented

Slide 17

Slide 17 text

TCP Handshake – Connection Termination A B ACK (M+1) FIN (M) FIN (N) ACK (N+1) ESTABLISHED ESTABLISHED CLOSE_WAIT FIN_WAIT_1 FIN_WAIT_2 TIME_WAIT LAST_ACK CLOSED close() close() CLOSED Connection-Oriented

Slide 18

Slide 18 text

TCP without Window A B Flow Control

Slide 19

Slide 19 text

TCP with Window A B Window SIze: 4 Flow Control

Slide 20

Slide 20 text

Sliding Window Flow Control

Slide 21

Slide 21 text

Buffer to Reorder Out-of-order Delivery A B Window SIze: 4 1 2 4 3 Application Layer In-order Delivery

Slide 22

Slide 22 text

Automatic Repeat reQuest (or Query) (ARQ) • Error control method that uses ACK and timeouts to achieve reliable data transmission over unreliable service A B Window SIze: 4 1 2 2 Retransmission TimeOut (RTO) 2 2 Error Recovery

Slide 23

Slide 23 text

Types of ARQ • Stop-and-wait ARQ • Go-Back-N ARQ • Selective Repeat ARQ Error Recovery

Slide 24

Slide 24 text

Stop-and-wait ARQ • One timer Error Recovery

Slide 25

Slide 25 text

Go-back-N ARQ Error Recovery • One timer • Receiver drops the out-of-order frames

Slide 26

Slide 26 text

Selective Repeat ARQ Error Recovery • One timer per frame • Receiver keeps the out-of-order frames

Slide 27

Slide 27 text

Congestion Control Congestion Control

Slide 28

Slide 28 text

Congestion • Internet had its first congestion collapse event on October 1986. • 32 Kbps link à 40 bps • What is the problem? 1. A buffer is overflowed 2. New arrival packets are dropped 3. Retransmissions to recover packet losses 4. Drastic reduction of the traffic • How to detect a network congestion? • Packet loss Congestion Control

Slide 29

Slide 29 text

Terminology • Congestion Window (CWND) • Limits the amount of data the TCP can send into network before receiving an ACK • Receiver Window (RWND) • Advertises the amount of data that the destination side can receive • Slow Start Threshold (ssthresh) • A threshold between slow-start mode and congestion avoidance mode • Rount Trip Time (RTT) • A time delay between sending a signal and receiving its ack Congestion Control

Slide 30

Slide 30 text

Slow Start • Slow-start (cwnd <= ssthresh) • cwnd = 1 MSS (Maximum segment size) • When ack is received: • cwnd += 1 MSS • It increase cwnd exponentially on each RTT • cwnd *= 2 (on each RTT) • Congestion Avoidance and Control, Van Jacobson, 1988 Congestion Control

Slide 31

Slide 31 text

Congestion Avoidance • Congestion avoidance (cwnd > ssthresh) • Additive Increase, Multiplicative Decrease (AIMD) • When ack is received: • cwnd += MSS * MSS / cwnd • Else: • ssthresh = cwnd / 2 • cwnd = 1 MSS • It increase cwnd linearly on each RTT • cwnd += MSS • Congestion Avoidance and Control, Van Jacobson, 1988 Congestion Control

Slide 32

Slide 32 text

Fast Retransmission • 3 duplicate ACK means a congestion is occurred • TCP Tahoe, 1988 Retransmission TimeOut (RTO) Congestion Control

Slide 33

Slide 33 text

Fast Recovery • If 3 dup ack is received • ssthresh = cwnd / 2 • cwnd = ssthresh • move to congestion avoidance state • If ack times out • ssthresh = cwnd / 2 • cwnd = 1 MSS • move to slow start state • TCP Reno, 1990 Congestion Control

Slide 34

Slide 34 text

TCP Variants Name By When New Features TCP Vint Cerf and Bob Kahn 1973 Ack Congestion Avoidance and Control Van Jacobson 1988 Congstion Window, Slow Start, Congestion Avoidance TCP Tahoe 4.3 BSD Tahoe 1988 Fast Retransmission TCP Reno 4.3 BSD Reno 1990 Fast Recovery TCP Vegas Lawrence Brakmo et al. 1994 Detect congestion based RTT TCP CUBIC Sangtae Ha et al. 2008 window size is cubic function TCP BBR Van Jacobson et al, Google 2016 Model-based Congestion Control

Slide 35

Slide 35 text

Google Cloud Platform CUBIC: 3.27Mbps BBR: 9150 Mbps

Slide 36

Slide 36 text

Packet Loss is not Always Congestion • Shallow Queue • Overreact à Increase queue size to reduce packet loss • Deep Queue • Let the server know the packet loss late • Bufferbloat (2011) à Priority queue, threshold, track the time a packet stays in queue • All approaches: Increase the accuracy of packet loss as an indicator of congestion 2 Packet/s

Slide 37

Slide 37 text

TCP BBR Congestion Control BBR CUBIC

Slide 38

Slide 38 text

Review • Network Layers • Encapsulation and decapsulation • Internet Layer • IP • Transport Layer • TCP • Connection-oriented • Flow control • In-order delivery • Error recovery • Congestion control • Slow start / congestion avoidance / fast retransmission / fast recovery • Loss-based congestion control: TCP Tahoe, Reno, Vegas … • Model-based congestion control: TCP BBR

Slide 39

Slide 39 text

References • Google • Wikipedia • CLOSE_WAIT & TIME_WAIT 최종 분석 • Van Jacobson’s Congestion Avoidance and Control • TCP Flow Controls • BBR: Congestion-Based Congestion Control