Networking Basics CCNA 1 Chapter 11 www.ciscopress.com The TCP/IP Transport Layer • TCP/IP transport layer includes several protocols – – – – Transmission Control Protocol (TCP) User Datagram Protocol (UDP) TCP has more functions UDP has less overhead • Main goal of the transport layer: – Provide the service of taking data from one application process on one computer and delivering that data to the correct application process on another computer www.ciscopress.com The TCP/IP Transport Layer • Comparing transport and internet layers: – Internet layer delivers packets from one computer to another, but is not concerned with which application sent the data or which application on the receiving computer needs the data – If multiple instances of an application are running on the destination computer, the transport layer works to ensure the proper instance gets the data and not the others www.ciscopress.com The TCP/IP Transport Layer Comparing TCP and UDP www.ciscopress.com The TCP/IP Transport Layer Flow Control and Windowing • When a host sends data using TCP, the receiving host can control how fast each TCP sender sends the data over time – this is called flow control • Flow control is used for many reasons – Receiver needs time to process the data – Receiver has finite amount of memory, so if data keeps arriving, it could run out of memory www.ciscopress.com The TCP/IP Transport Layer Flow Control Through Dynamic Sliding Windows • Receiver tells sender how many bytes the sending host can send before it receives an acknowledgement – a value called a window • When the sending host has sent an entire window’s worth of data, it must wait for an acknowledgement, slowing its rate of sending data • The window size can be increased to allow a faster transfer rate www.ciscopress.com The TCP/IP Transport Layer Dynamic Windowing www.ciscopress.com The TCP/IP Transport Layer Flow Control Through Withholding Acknowledgements • After a sending host has sent one window worth of bytes, it must wait to send more • The receiver can wait to send acknowledgements, which prevents the sender from sending more data • This process of withholding acknowledgements is sometimes known as start/stop flow control www.ciscopress.com The TCP/IP Transport Layer Withholding Acknowledgements www.ciscopress.com The TCP/IP Transport Layer Establishing and Terminating TCP Connections • TCP is a connection-oriented protocol – Allows it to set initial values to the window and to initialize sequence number values • TCP uses a process called a three-way handshake to create a new TCP connection – Uses three TCP segments that use two of the TCP flags in the TCP header • The synchronize (SYN) flag • The acknowledge (ACK) flag www.ciscopress.com The TCP/IP Transport Layer Three-Way TCP Connection Establishment www.ciscopress.com The TCP/IP Transport Layer TCP Error Recovery (Reliability) • TCP is a reliable protocol (at least in a networking perspective) – Performs error recovery – All data eventually gets to the destination, even if some is initially lost in transport www.ciscopress.com The TCP/IP Transport Layer TCP Acknowledgements with no Error Recovery Needed www.ciscopress.com The TCP/IP Transport Layer TCP Error Recovery (Reliability) • TCP uses two header fields to signal to other computer as to whether a segment was received – Sequence number • Keeps track of all the bytes sent over a TCP connection – Acknowledgement number • Lets the sending device know the number of the segment the receiving device expects next • Practice of stating the next byte expected to be received is called a forward acknowledgement or expectational acknowledgement www.ciscopress.com The TCP/IP Transport Layer TCP Error Recovery www.ciscopress.com The TCP/IP Transport Layer TCP Error Recovery (Reliability) • If a segment is lost or destroyed during transmission, the receiving PC requests that it be retransmitted • If an acknowledgement is not received by the sending PC within a certain time (a timer has been set), the sending PC resends the segment www.ciscopress.com The TCP/IP Transport Layer Segmentation, Reassembly, and In-Order Delivery • TCP segmentation refers to the process of accepting a large chunk of data from the application protocol and breaking it into pieces that are small enough for transmission – The size of the segment is limited – Ethernet limits frames to 1500 data bytes in the data field of a frame • IP and TCP headers are each 20 bytes long • Maximum data portion is therefore 1460 bytes www.ciscopress.com The TCP/IP Transport Layer Segmentation, Reassembly, and In-Order Delivery • TCP on the receiving computer reassembles data into its original form • The data is put in the correct order – If segments of a file are assembled out-oforder, the file is useless – TCP provides a guarantee of in-order delivery www.ciscopress.com The TCP/IP Transport Layer Segmentation, Reassembly, and In-Order Delivery • Due to IP routing, a TCP receiver can receive data out of order • If multiple routes exist between a source and a destination, routers can load-balance over several routes • Packets can arrive out of order www.ciscopress.com The TCP/IP Transport Layer TCP Providing In-Order Delivery www.ciscopress.com The TCP/IP Transport Layer TCP and UDP Header Reference • TCP and UDP use a header to hold information for performing tasks – TCP needs ACK and SYN flags • First two fields in TCP and UDP are identical – Both use port numbers to identify application processes • TCP has a longer header (20 bytes vs. 8 bytes) www.ciscopress.com The TCP/IP Transport Layer TCP and UDP Headers www.ciscopress.com The TCP/IP Transport Layer TCP Header Fields www.ciscopress.com The TCP/IP Transport Layer TCP Header Fields www.ciscopress.com The TCP/IP Transport Layer UDP Header Fields www.ciscopress.com The TCP/IP Transport Layer Identifying Application Processes Using Port Numbers • Both TCP and UDP identify the specific application process that sends the data and the application process that needs to receive the data – To make this determination, TCP and UDP use port numbers – Each application uses a different local port number www.ciscopress.com The TCP/IP Transport Layer Using Port Numbers to Identify the Correct Application Process www.ciscopress.com The TCP/IP Transport Layer Identifying Application Processes Using Port Numbers • In previous slide, the application was assigned a dynamic port number by the host computer – A host typically dynamically allocates port numbers of value 1024 (210) through 65,535 (216 - 1) – When a host starts a new application process, it allocates a dynamic port number that is not already in use by another process – By each process having its own port number, a PC can have multiple conversations with other PCs (sometimes called multiplexing) www.ciscopress.com The TCP/IP Transport Layer Identifying Application Processes Using Port Numbers • Connection to Servers: Well-Known Ports – Most TCP/IP applications use a client/server model for communications – Servers cannot use dynamic port numbers because clients must know ahead of time what port numbers servers use – Servers must wait and listen on certain port numbers for client requests www.ciscopress.com The TCP/IP Transport Layer Identifying Application Processes Using Port Numbers • Connection to Servers: Well-Known Ports (continued) – For servers to work well, TCP/IP defines one or more well-known ports, each reserved for use by a specific application protocol • For example, HTTP connects to a server listening on port 80 www.ciscopress.com The TCP/IP Transport Layer Client Connecting to Well-Known Port of a Web Server (80) www.ciscopress.com The TCP/IP Transport Layer Popular Applications and Their Well-Known Port Numbers www.ciscopress.com The TCP/IP Transport Layer Identifying Application Processes Using Port Numbers • Comparing Well-Known, Dynamic, and Registered Ports – IANA assigns the values for well-known ports and for registered port numbers • Registered ports are assigned to servers that the average end-user can start, such as instant-messaging applications • Well-known ports are started by IT staff for applications such as web servers, email, FTP servers www.ciscopress.com The TCP/IP Transport Layer Uses of Port Numbers www.ciscopress.com The TCP/IP Transport Layer Identifying Application Processes Using Port Numbers • Comparing Well-Known, Dynamic, and Registered Ports (continued) – Both TCP and UDP use port numbers – To see the port numbers used on a computers running a Microsoft OS, use the netstat –an command www.ciscopress.com