Layer 4 – Transport Layer Chapter 12 Layer 1 - 4 • Layer 1: – Allows bit streams to be created and to travel. • Layer 2: – Packages data packets into frames to be converted to bit streams. – It makes LAN delivery possible. • Layer 3: – Packages data from upper layers into packets. – It makes routing and WAN delivery possible. Layer 4 = Quality of Service • Layer 4 provides "quality of service“ by: – Making sure it gets there reliably and accurately. • Sequencing numbers and acknowledgements. – Transporting and regulating the flow of information from source to destination. • Sliding windows. Connection / Connectionless Networks Connectionless • Most network services use a connectionless delivery system. • Often referred to as packet-switched. • Destination is not contacted before a packet is sent. – E.g. Postal system Connectionless • Each packet is treated separately, sending it on its way through the network. – The packets may take different paths, but are reassembled when they arrive at the destination. – Information can arrive out of order so there must be some provision for correctly re-ordering data. • Example: – Usually deal with a service provider – Frame Relay, ATM, X.25 Connectionless Connection-Oriented • In connection-oriented systems, a connection is established between the sender and the recipient before any data is transferred. – All packets travel sequentially across the same physical circuit or virtual circuit (more common). • Often referred to as circuit-switched. Connection-Oriented • An example of a connection-oriented network is the telephone system; you place a call, a connection is established, and then communication occurs. • Example: – Usually deal with the telephone company. – ISDN BRI, ISDN PRI, Asynchronous serial (modems) Connection-Oriented TCP/IP TCP/IP • In the late 1960s, it became clear that computers with different OSs needed to communicate with one another. • The Department of Defense (DoD) wanted a network that could survive a war which destroyed parts of the network. – For this reason, the concept of packet-switching and the specific implementation of IP were developed. TCP/IP • In 1970, ARPA responded by developing TCP/IP; a network protocol enabling mainframes (e.g., DEC, IBM) to communicate. • TCP/IP allows for easy cross platform communications and is the standard protocol to connect to the Internet. TCP/IP • The name TCP/IP is given to the collection (or suite) of networking protocols. • The name is taken from two of the fundamental protocols in the collection, IP and TCP. – Other core protocols in the suite are UDP and ICMP. – These protocols work together to provide a basic networking framework that is used by many different application protocols, each tuned to achieving a particular goal. TCP/IP • TCP – TCP is a Layer 4 protocol. – It is a connection-oriented service that provides flow control as well as reliability. TCP/IP • IP – IP is a Layer 3 protocol. – It is a connectionless service that provides best-effort delivery across a network. TCP and UDP Layer 4 Protocols • At the Transport Layer, TCP/IP has two protocol: – Transmission Control Protocol (TCP). – User Datagram Protocol (UDP). TCP • TCP supplies a “virtual circuit” between end- user applications. • Characteristics: – connection-oriented – reliable – divides outgoing messages into segments – reassembles messages at the destination station – re-sends anything not received – reassembles messages from incoming segments. TCP Segment Format TCP Segment Format Source Port – Number of the calling port. – Dynamically assigned by the source host with a number above 1023. – This way it is possible to multiple session of FTP running simultaneously. TCP Segment Format Destination Port – Number of the called port. – End systems use the same port numbers to select the proper application. – E.g., when telnetting, Telnet on the source (port 23) is talking to Telnet on the destination (port 23). TCP Segment Format Sequence Number – Used to establish reliability. – Number ensures correct sequencing of arriving data. – Identifies the position in the sender’s byte stream of data. TCP Segment Format Acknowledge Number – Used to establish reliability. – Next expected TCP octet. TCP Segment Format Window – Number of octets that the sender is willing to accept. – This number can be adjusted while data is being transmitted. TCP Segment Format Checksum – Calculated checksum of the header and data fields. TCP Segment Format Data – Upper-layer protocol data. UDP • UDP is a simple, unreliable protocol. – It transports data without acknowledgements or guaranteed delivery. • Unlike TCP, UDP does not segment data. • Specifically, UDP doesn't provide sequencing of the packets that the data arrives in. UDP • UDP uses the IP protocol to send data and is sometimes referred to as UDP/IP. • Characteristics: – connectionless – unreliable – transmit messages (called user datagrams) – provides no software checking for message delivery (unreliable) – does not reassemble incoming messages – uses no acknowledgements – provides no flow control UDP • Application that use UDP make sure that entire messages arrive in the right order. – Network applications that want to save processing time because they have very small data units to exchange may prefer UDP to TCP. • Protocols that use UDP include: – Trivial File Transfer Protocol (TFTP) – Simple Network Management Protocol (SNMP) – Dynamic Host Configuration Protocol (DHCP ) – DNS (Domain Name System) UDP Segment Format • It uses no sequence or acknowledgement fields. Port Numbers Port Numbers • Both TCP and UDP use port (or socket) numbers to pass information to the upper layers. • Port numbers are used to keep track of different conversations that cross the network at the same time. • Application software developers have agreed to use the well-known port numbers that are defined in RFC1700. Port Numbers • Port numbers have the following assigned ranges: – < 255 - for public applications – 255 -1023 - assigned for marketable applications – > 1023 - are unregulated • End systems use port numbers to select proper applications. • Originating source port numbers are dynamically assigned by the source host; usually, it is a number larger than 1023. TCP Port Numbers http://www.networkice.com/advice/Exploits/Ports/ TCP Connection Method Connection Oriented Services • Connection oriented services involve three phases: – The connection establishment phase • A single path between the source and destination is determined. • Resources are typically reserved at this time to ensure consistent grade of service. – The data transfer phase • Data is transmitted sequentially over the established path, arriving at the destination in the order in which it was sent. – The connection termination phase • Consists of terminating the connection between the source and destination when it is no longer needed. Connection Establishment Phase • TCP hosts establish a connection-oriented session with one another using a three-way handshake. – For a connection to be established, both sender and receiver must synchronize. – Synchronization requires that each side send its SYN and ACK characters. Connection Establishment Phase • A three-way handshake/open connection sequence synchronizes a connection at both ends before data is transferred. – This ensures that any data that is lost, due to transmission problems that may occur later can be recovered. Data Transfer Phase • When the data is being transmitted, several things are being monitored: – Is the data getting there? – Am I sending it too fast or too slow? Windowing • If a sender has to wait for an acknowledgment after sending each segment, throughput will be low. • Windowing is a method used to specify the number of data packets the sender is allowed to have outstanding (without receiving acknowledgment). – Window size = 0 - stop sending – Window size = 1 - acknowledge each packet sent – Window size = 3 - acknowledge after 3 packets • A “sliding window” means that the window size is negotiated dynamically during the TCP session. Windowing • Windowing uses sequence numbering and retransmission to ensure delivery of segments without duplication and loss. • The sender keeps a record of each data packet it sends and waits for an acknowledgment before sending the next data packet. • The sender also starts a timer when it sends a segment, and it retransmits a segment if the timer expires before an acknowledgment arrives. Avoidance Congestion • When data transfer is in progress, congestion can arise for two different reasons. – First, a high-speed computer might be able to generate traffic faster than a network can transfer it. – Second, if many computers simultaneously need to send datagrams to a single destination, that destination can experience congestion, even though no single source caused the problem. • Instead of allowing data to be lost, a “not ready” indicator can be sent to the sender. Flow Control • Flow control is a technique for ensuring that a transmitter, does not overwhelm a receiver with data. • When the buffers on the receiving device are full, a message is sent to the sending device to suspend the transmission until the data in the buffers has been processed. ?