PowerPoint Presentation
COMP30023 Computer Systems
Copyright By Assignmentchef assignmentchef
University of Melbourne 24/04/22
Transmission Control Protocol
Provides services to the Application (or Session) layer using
services from the Network layer.
The Transport layer entities (the hardware or software which
actually does the work e.g. OS kernel, processes, NIC) can exist
in multiple locations.
Services provide logical communication channels between
processes running on different hosts:
Connection-oriented
= Connection establishment, data transfer, connection release (TCP)
Like phone call
Connectionless: data transfer (UDP)
Like text messages
Recap Transport Layer
University of
Introduction to Transmission Control Protocol (TCP)
Connecting
(More basics of the transport layer will come later, but we
need TCP for project 2.)
University of
The Transmission Control Protocol lets applications transmit
and receive a stream of bytes, without worrying about
Segmenting into IP datagrams (it is stream oriented)
Bytes being dropped, or duplicated(it is reliable)
Bytes arriving out of order(it is in order)
TCP transport entity manages TCP streams and interfaces to the
TCP entity accepts user data streams, and segments them into pieces
<64Kb (often 1460 bytes in order to fit the IP and TCP headers into a single Ethernet frame), and sends each piece as a separate IP datagram Recipient TCP entities reconstruct the original byte streams from the encapsulationTCP – OverviewUniversity of Primitives: core functions which allow interface with transport services (in particular TCP)Select is a non-TCP primitive allowing non-blocking receiveTransport/TCP service primitivesUniversity of Primitive Packet Sent MeaningLISTEN (none) Block until something tries to connectCONNECT CONNECTION REQ Actively attempt to establish a connectionSEND DATA Send informationRECEIVE (none) Block until DATA packet arrivesDISCONNECT DISCONNECTION REQ This sides wants to release the connection Example: (a) Four 512-byte segments sent as separate IP datagrams (b) The 2048 bytes of data delivered to the application in a single READ callTCP Service ModelUniversity of TN 6th 6-35 The sender and receiver both create sockets A kernel data structure, named by the 5-tuple of IP address and port number of sender and receiver, and the protocol For TCP service to be activated, connections must be explicitly established between a socket at a sending host (src-host, src-port) and a socket at a receiving host (dest-host, dest-port) Example: 2 socketson port 80TCP Service ModelUniversity of TCP connections are: Full duplex – data in both directions simultaneously End to end – exact pairs of senders and receivers Byte streams, not message streams message boundaries are not preserved Buffer capable TCP entity can choose to buffer prior to sending or not Buffering reduces overhead (fewer headers), but increases delayFeatures of TCP connectionsUniversity of Data is exchanged between TCP entities in segments each has a 20 60 byte header, plus zero or more data bytes TCP entities decide how large segments should be, given two constraints: IP payload < 65,515 byte Maximum Transfer Unit (MTU) – generally 1500 bytes Sliding window protocol Initial use: reliable data delivery without overloading the receiver Now also tied closely with congestion control Described next weekTCP PropertiesUniversity of TCP Header University of For sliding windowTN 6th 6-3632-bit words,Name DescriptionSource port Sending portDestination port Receiving portSequence Number If SYN=1: initial sequence numberif SYN=0: is accumulated sequence number of the first data byte of this segmentAcknowledgement If ACK=1: next sequence number that the sender of the ACK is expectingData offset Size of the TCP Header (20-60 bytes)Flags Single bit flags (SYN, ACK, RST, FIN, etc.)Window size Size of receive window how much data the sender of this segment is willing to receiveTCP Important HeadersUniversity of Remember that TCP is a connection orientated protocol running over a connectionless network layer (IP) When networks can lose, store and duplicate packets, connection establishment can be complicated congested networks may delay acknowledgements incurring repeated multiple transmissions any of which may not arrive at all or out of sequence delayed duplicatesConnection establishment issuesUniversity of Goals of reliable connection establishment: Ensure one (and only one) connection is established, even if some set-up packets get lost Establish initial sequence numbers for sliding window Three-way handshake: A proposed solution, which avoids problems that can occur when both sides allocate same sequence numbers by accident (e.g. after host/router crash) (cf. Tomlinson, 1975). Sender and receivers exchange information about which sequencing strategy each will use, and agree on it before transmitting segmentsThree-way handshakeUniversity ofNormal operationSimultaneous connection attempts. Two simultaneous connection attempts results in only one connection(uniquely identified by end points). At end, Host 1 and Host 2 have agreed on respective sequence numbersThree-way handshakeUniversity of TN 6th 6-37 SYN is used for synchronization during connection establishment Sending SYN or FIN causes sequence number to be incremented by 1 Sequence Number first byte of this segments payload Offset by a random number initial value is arbitrary, offset will be reflected in both Sequence and Acknowledgement numbers Acknowledgement Number next byte the sender expects to Bytes received without gaps a missing segment will stop this incrementing, even if later segments have been receivedSynchronisationUniversity of Request for single image file: http://static.bbci.co.uk/weather/0.5.284/images/icons/individual_56_icons/en_on_light_bg/1.gif, HTTP (connection:close)Wireshark ExampleUniversity of http://static.bbci.co.uk/weather/0.5.284/images/icons/individual_56_icons/en_on_light_bg/1.gifhttp://static.bbci.co.uk/weather/0.5.284/images/icons/individual_56_icons/en_on_light_bg/1.gifWireshark ExampleUniversity of 104.83.244.56 SYN bit is used to establish a connection Connection request has SYN=1, ACK=0 Connection reply has SYN=1, ACK=1 SYN is used in both CONNECTION_REQUEST and CONNECTION_ACCEPTED, ACK bit distinguishes between the two After connection setup: Sequence Number first byte of this segment payload (1 + data sent prior to this Offset by a random number initial value is arbitrary, offset will be reflected in both Sequence and Acknowledgement numbers Acknowledgement Number next byte the sender expects to receive (data successfully received + 1) Bytes received without gaps a missing segment will stop this incrementing, even if later segments have been receivedTCP Synchronization RecapUniversity of Each segment sent has an associated retransmission timer Initialised with a default value and updated based on network performance If the timer expires before an ACK is received the segment is resent Receiver receives segment with a sequence number higher than expected (i.e. segment has been lost) Receiver sends ACK with sequence number it is expecting (i.e. the next byte it expects also implies data it has received) This is a duplicate of the previously sent acknowledgement (DupACK) After receiving 3 DupACKs the sender resends the lost segment, this is known as fast retransmissionError recovery: TCP RetransmissionUniversity of The FIN flag is used to signify a request to close a connection Each FIN is directional, once acknowledged no further data can be sent from the sender to the receiver Data can continue to flow in the other direction E.g. client could send FIN after making request, but before receiving the response Sender of FIN will still retransmit unacknowledged segments Typically requires 4 segments to close, 1 FIN and 1 ACK for each direction Can be optimised:FIN,FIN/ACK,ACKTCP ClosingUniversity of The RST flag is used to signify a hard close of a connection Basically states the sender is closing the connection and will not listen for any further messages Sent in reply to a packet sent to a 5-tuple with no open connection e.g., to invalid data being sent or a crashed process that left a remote socket open, that the OS is now cleaning up Can be used to close a connection, but FIN is greatly preferred because it is an orderly shutdown of the connection, as opposed to a resetTCP ClosingUniversity of Googles QUIC has shown that there is demand for a new transport protocol Why is it only now being deployed? Why does it run on top of UDP? Although the transport layer is supposed to be end to end, there are many middleboxes that inspect and modify transport layer protocols Firewalls, NAT (later lecture), intrusion detection systems, load balancers These all accept TCP and UDP, but typically drop all other transport layer protocols. Stream Control Transport Protocol is a carefully designed protocol that achieves many of the goals of QUIC, but it hasnt been widely deployed because of these middleboxes.And finallyUniversity of SYN Flooding Popular attack in the 90s to denial of service a server Remember back to the arbitrary (random) initial Sequence number This requires the server to remember an initial Sequence number for each received SYN request An attacker would make initial SYN requests then not send the appropriate ACK, causing the server to gradually fill up its queue with sequence numbers for now defunct connections One solution was SYN Cookies Rather than store the sequence number it is derived from connection information and a timer that creates a stateless SYN queue using cryptographic Incurs performance cost in validating SYN Cookies, but preferable to being unresponsive typically only enabled when under attack(This time is final for sure)University of The slides are based on slides prepared by based on material developed previously by:,,, and. Some of the images included in the notes were supplied as part of the teaching resources accompanying the text books listed in lecture 1. (And also) Computer Networks, 6th Edition, Tanenbaum A., Wetherall. D. https://ebookcentral.proquest.com/lib/unimelb/detail.action?docID=6481879 Textbook Reference: Sections 3.1,3.2, 3.5, pp.314-319AcknowledgementUniversity of https://ebookcentral.proquest.com/lib/unimelb/detail.action?docID=6481879Transmission Control ProtocolRecap Transport LayerTCP – OverviewTransport/TCP service primitivesTCP Service ModelTCP Service Model (2)Features of TCP connectionsTCP PropertiesTCP HeaderTCP Important HeadersConnection establishment issuesThree-way handshakeThree-way handshake (3)Wireshark Example (2)TCP Synchronization RecapError recovery: TCP RetransmissionTCP ClosingTCP Closing (2)And finally(This time is final for sure)Acknowledgement CS: assignmentchef QQ: 1823890830 Email: [email protected]
Reviews
There are no reviews yet.