BM 402 Bilgisayar Ağları (Computer Networks)

Similar documents
Transport Layer and Data Center TCP

Transport Layer Protocols

Computer Networks. Chapter 5 Transport Protocols

COMP 3331/9331: Computer Networks and Applications. Lab Exercise 3: TCP and UDP (Solutions)

B-2 Analyzing TCP/IP Networks with Wireshark. Ray Tompkins Founder of Gearbit

CSE 473 Introduction to Computer Networks. Exam 2 Solutions. Your name: 10/31/2013

Outline. TCP connection setup/data transfer Computer Networking. TCP Reliability. Congestion sources and collapse. Congestion control basics

Chapter 5. Transport layer protocols

TCP/IP Optimization for Wide Area Storage Networks. Dr. Joseph L White Juniper Networks

Computer Networks - CS132/EECS148 - Spring

This sequence diagram was generated with EventStudio System Designer (

TCP in Wireless Mobile Networks

ICOM : Computer Networks Chapter 6: The Transport Layer. By Dr Yi Qian Department of Electronic and Computer Engineering Fall 2006 UPRM

Prefix AggregaNon. Company X and Company Y connect to the same ISP, and they are assigned the prefixes:

TCP Flow Control. TCP Receiver Window. Sliding Window. Computer Networks. Lecture 30: Flow Control, Reliable Delivery

Data Communications & Networks. Session 6 Main Theme Reliable Data Transfer. Dr. Jean-Claude Franchitti

La couche transport dans l'internet (la suite TCP/IP)

Computer Networks UDP and TCP

La couche transport dans l'internet (la suite TCP/IP)

Higher Layer Protocols: UDP, TCP, ATM, MPLS

First Midterm for ECE374 03/09/12 Solution!!

COMP 361 Computer Communications Networks. Fall Semester Midterm Examination

Names & Addresses. Names & Addresses. Hop-by-Hop Packet Forwarding. Longest-Prefix-Match Forwarding. Longest-Prefix-Match Forwarding

q Connection establishment (if connection-oriented) q Data transfer q Connection release (if conn-oriented) q Addressing the transport user

CSE331: Introduction to Networks and Security. Lecture 9 Fall 2006

[Prof. Rupesh G Vaishnav] Page 1

Visualizations and Correlations in Troubleshooting

15-441: Computer Networks Homework 2 Solution

TCP over Multi-hop Wireless Networks * Overview of Transmission Control Protocol / Internet Protocol (TCP/IP) Internet Protocol (IP)

Mobile Communications Chapter 9: Mobile Transport Layer

Lecture 5: Network Attacks I. Course Admin

TCP Performance Management for Dummies

Improving the Performance of TCP Using Window Adjustment Procedure and Bandwidth Estimation

How do I get to

Transport Layer. Chapter 3.4. Think about

TCP and Wireless Networks Classical Approaches Optimizations TCP for 2.5G/3G Systems. Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme

Advanced Computer Networks Project 2: File Transfer Application

A Survey on Congestion Control Mechanisms for Performance Improvement of TCP

Configuring TCP Intercept (Preventing Denial-of-Service Attacks)

Midterm Exam CMPSCI 453: Computer Networks Fall 2011 Prof. Jim Kurose

First Midterm for ECE374 02/25/15 Solution!!

Transport layer protocols for ad hoc networks

Ethernet. Ethernet. Network Devices

TCP Adaptation for MPI on Long-and-Fat Networks

TCP for Wireless Networks

Data Networks Summer 2007 Homework #3

Application Level Congestion Control Enhancements in High BDP Networks. Anupama Sundaresan

2 TCP-like Design. Answer

Final for ECE374 05/06/13 Solution!!

Chapter 6 Congestion Control and Resource Allocation

Congestions and Control Mechanisms n Wired and Wireless Networks

Homework 3 assignment for ECE374 Posted: 03/13/15 Due: 03/27/15

Network Security: Workshop. Dr. Anat Bremler-Barr. Assignment #2 Analyze dump files Solution Taken from

Pig Laboratory. Additional documentation for the laboratory. Exercises and Rules. Tstat Data

Computer Networks. Data Link Layer

Lecture 15: Congestion Control. CSE 123: Computer Networks Stefan Savage

Overview. Securing TCP/IP. Introduction to TCP/IP (cont d) Introduction to TCP/IP

Simulation-Based Comparisons of Solutions for TCP Packet Reordering in Wireless Network

Access Control: Firewalls (1)

Homework 2 assignment for ECE374 Posted: 02/21/14 Due: 02/28/14

TCP/IP Networking for Wireless Systems. Integrated Communication Systems Group Ilmenau University of Technology

Multipath TCP in Practice (Work in Progress) Mark Handley Damon Wischik Costin Raiciu Alan Ford

IP - The Internet Protocol

First Midterm for ECE374 03/24/11 Solution!!

1 An application in BPC: a Web-Server

Lecture Objectives. Lecture 07 Mobile Networks: TCP in Wireless Networks. Agenda. TCP Flow Control. Flow Control Can Limit Throughput (1)

What is a DoS attack?

IP Network Layer. Datagram ID FLAG Fragment Offset. IP Datagrams. IP Addresses. IP Addresses. CSCE 515: Computer Network Programming TCP/IP

Based on Computer Networking, 4 th Edition by Kurose and Ross

Компјутерски Мрежи NAT & ICMP

Voice over IP. Demonstration 1: VoIP Protocols. Network Environment

A Transport Protocol for Multimedia Wireless Sensor Networks

A Survey: High Speed TCP Variants in Wireless Networks

Computer Networks Practicum 2015

Exercises TCP/IP Networking. Solution. With Solutions

Host Fingerprinting and Firewalking With hping

Data Communication & Networks G

Route Discovery Protocols

Low-rate TCP-targeted Denial of Service Attack Defense

Secure SCTP against DoS Attacks in Wireless Internet

Sources: Chapter 6 from. Computer Networking: A Top-Down Approach Featuring the Internet, by Kurose and Ross

Chapter 8 Security Pt 2

Defending Computer Networks Lecture 6: TCP and Scanning. Stuart Staniford Adjunct Professor of Computer Science

Internet Protocols. Background CHAPTER

The present and the future of TCP/IP

The Fundamentals of Intrusion Prevention System Testing

Servicesin ns-3. Outline SIMULACIÓN DE PROTOCOLOS DE ENRUTAMIENTO PARA REDES MÓVILES AD-HOC MEDIANTE HERRRAMIENTA DE SIMULACIÓN NS-3

An enhanced TCP mechanism Fast-TCP in IP networks with wireless links

First Workshop on Open Source and Internet Technology for Scientific Environment: with case studies from Environmental Monitoring

TFTP TRIVIAL FILE TRANSFER PROTOCOL OVERVIEW OF TFTP, A VERY SIMPLE FILE TRANSFER PROTOCOL FOR SIMPLE AND CONSTRAINED DEVICES

The Transport Layer and Implica4ons for Network Monitoring. CS 410/510 Spring 2014

SELECTIVE-TCP FOR WIRED/WIRELESS NETWORKS

TCP Westwood for Wireless

The Problem with TCP. Overcoming TCP s Drawbacks

Project 4: (E)DoS Attacks

Networks: IP and TCP. Internet Protocol

Transcription:

BM 402 Bilgisayar Ağları (Computer Networks) M.Ali Akcayol Gazi Üniversitesi Bilgisayar Mühendisliği Bölümü Not: Bu dersin sunumları, ders kitabının yazarları James F. Kurose ve Keith W. Ross tarafından sağlanan sunumlar üzerinde değişiklik yapılarak hazırlanmıştır. Ders konuları Connection Oriented Transport : TCP Segment structure Reliable data transfer Flow control Connection management 2/101 1

TCP: Overview RFCs: 793, 1122, 1323, 2018, 2581 socket door point-to-point: one sender, one receiver reliable, in-order byte stream: no message boundaries pipelined: TCP congestion and flow control set window size send & receive buffers application writes data TCP send buffer segment application reads data TCP receive buffer socket door full duplex data: bi-directional data flow in same connection MSS: maximum segment size connection-oriented: handshaking (exchange of control msgs) init s sender, receiver state before data exchange flow controlled: sender will not overwhelm receiver 3/101 Ders konuları Connection Oriented Transport : TCP Segment structure Reliable data transfer Flow control Connection management 4/101 2

TCP segment structure URG: urgent data (generally not used) ACK: ACK # valid PSH: push data now (generally not used) RST, SYN, FIN: connection estab (setup, teardown commands) Internet checksum (as in UDP) 32 bits source port # dest port # head len sequence number acknowledgement number not used UAP R S F checksum Receive window Urg data pnter Options (variable length) application data (variable length) counting by bytes of data (not segments!) # bytes rcvr willing to accept 5/101 TCP seq. # s and ACKs Seq. # s: byte stream number of first byte in segment s data ACKs: seq # of next byte expected from other side cumulative ACK Q: how receiver handles outof-order segments A: TCP spec doesn t say, - up to implementor User types C host ACKs receipt of echoed C Host A Host B simple telnet scenario host ACKs receipt of C, echoes back C time 6/101 3

TCP Round Trip Time and Timeout Q: how to set TCP timeout value? longer than RTT but RTT varies too short: premature timeout unnecessary retransmissions too long: slow reaction to segment loss Q: how to estimate RTT? SampleRTT: measured time from segment transmission until ACK receipt ignore retransmissions SampleRTT will vary, want estimated RTT smoother average several recent measurements, not just current SampleRTT 7/101 TCP Round Trip Time and Timeout EstimatedRTT = (1- )*EstimatedRTT + *SampleRTT Exponential weighted moving average influence of past sample decreases exponentially fast typical value: = 0.125 8/101 4

Example RTT estimation: RTT: gaia.cs.umass.edu to fantasia.eurecom.fr 350 300 RTT (milliseconds) 250 200 150 100 1 8 15 22 29 36 43 50 57 64 71 78 85 92 99 106 time (seconnds) SampleRTT Estimated RTT 9/101 TCP Round Trip Time and Timeout Setting the timeout EstimtedRTT plus safety margin large variation in EstimatedRTT -> larger safety margin first estimate of how much SampleRTT deviates from EstimatedRTT: DevRTT = (1- )*DevRTT + * SampleRTT-EstimatedRTT (typically, = 0.25) Then set timeout interval: TimeoutInterval = EstimatedRTT + 4*DevRTT 10/101 5

Ders konuları Connection Oriented Transport : TCP Segment structure Reliable data transfer Flow control Connection management 11/101 TCP reliable data transfer TCP creates rdt service on top of IP s unreliable service Pipelined segments Cumulative acks TCP uses single retransmission timer Retransmissions are triggered by: timeout events duplicate acks Initially consider simplified TCP sender: ignore duplicate acks ignore flow control, congestion control 12/101 6

TCP sender events: data rcvd from app: Create segment with seq # seq # is byte-stream number of first data byte in segment start timer if not already running (think of timer as for oldest unacked segment) expiration interval: TimeOutInterval timeout: retransmit segment that caused timeout restart timer Ack rcvd: If acknowledges previously unacked segments update what is known to be acked start timer if there are outstanding segments 13/101 NextSeqNum = InitialSeqNum SendBase = InitialSeqNum loop (forever) { switch(event) event: data received from application above create TCP segment with sequence number NextSeqNum if (timer currently not running) start timer pass segment to IP NextSeqNum = NextSeqNum + length(data) event: timer timeout retransmit not-yet-acknowledged segment with smallest sequence number start timer event: ACK received, with ACK field value of y if (y > SendBase) { SendBase = y if (there are currently not-yet-acknowledged segments) start timer } TCP sender (simplified) Comment: SendBase-1: last cumulatively ack ed byte Example: SendBase-1 = 71; y= 73, so the rcvr wants 73+ ; y > SendBase, so that new data is acked } /* end of loop forever */ 14/101 7

timeout Seq=92 timeout timeout Seq=92 timeout TCP: retransmission scenarios Host A Host B Host A Host B X loss Sendbase = 100 SendBase = 120 SendBase = 100 time lost ACK scenario SendBase = 120 time premature timeout 15/101 TCP retransmission scenarios (more) Host A Host B X loss SendBase = 120 time Cumulative ACK scenario 16/101 8

TCP ACK generation [RFC 1122, RFC 2581] Event at Receiver Arrival of in-order segment with expected seq #. All data up to expected seq # already ACKed Arrival of in-order segment with expected seq #. One other segment has ACK pending Arrival of out-of-order segment higher-than-expect seq #. Gap detected Arrival of segment that partially or completely fills gap TCP Receiver action Delayed ACK. Wait up to 500ms for next segment. If no next segment, send ACK Immediately send single cumulative ACK, ACKing both in-order segments Immediately send duplicate ACK, indicating seq# of next expected byte Immediate send ACK, provided that segment starts at lower end of gap 17/101 Fast Retransmit Time-out period often relatively long: long delay before resending lost packet Detect lost segments via duplicate ACKs. Sender often sends many segments back-to-back If segment is lost, there will likely be many duplicate ACKs. If sender receives 3 ACKs for the same data, it supposes that segment after ACKed data was lost: fast retransmit: resend segment before timer expires 18/101 9

Fast retransmit algorithm: event: ACK received, with ACK field value of y if (y > SendBase) { SendBase = y if (there are currently not-yet-acknowledged segments) start timer } else { increment count of dup ACKs received for y if (count of dup ACKs received for y = 3) { resend segment with sequence number y } a duplicate ACK for already ACKed segment fast retransmit 19/101 Ders konuları Connection Oriented Transport : TCP Segment structure Reliable data transfer Flow control Connection management 20/101 10

TCP Flow Control receive side of TCP connection has a receive buffer: flow control sender won t overflow receiver s buffer by transmitting too much, too fast speed-matching service: matching the send rate to the receiving app s drain rate app process may be slow at reading from buffer 21/101 TCP Flow control: how it works (Suppose TCP receiver discards out-of-order segments) spare room in buffer RcvWindow = RcvBuffer- [LastByteRcvd - LastByteRead] Rcvr advertises spare room by including value of RcvWindow in segments Sender limits unacked data to RcvWindow guarantees receive buffer doesn t overflow 22/101 11

Ders konuları Connection Oriented Transport : TCP Segment structure Reliable data transfer Flow control Connection management 23/101 TCP Connection Management Recall: TCP sender, receiver establish connection before exchanging data segments initialize TCP variables: seq. #s buffers, flow control info (e.g. RcvWindow) client: connection initiator Socket clientsocket = new Socket("hostname","port number"); server: contacted by client Socket connectionsocket = welcomesocket.accept(); Three way handshake: Step 1: client host sends TCP SYN segment to server specifies initial seq # no data Step 2: server host receives SYN, replies with SYNACK segment server allocates buffers specifies server initial seq. # Step 3: client receives SYNACK, replies with ACK segment, which may contain data 24/101 12

timed wait timed wait TCP Connection Management (cont.) Closing a connection: client server client closes socket: clientsocket.close(); close Step 1: client end system sends TCP FIN control segment to server close Step 2: server receives FIN, replies with ACK. Closes connection, sends FIN. closed 25/101 TCP Connection Management (cont.) Step 3: client receives FIN, replies with ACK. closing client server Enters timed wait - will respond with ACK to received FINs closing Step 4: server, receives ACK. Connection closed. Note: with small modification, can handle simultaneous FINs. closed closed 26/101 13

TCP Connection Management (cont) TCP server lifecycle TCP client lifecycle 27/101 14